ForcePilot/backend/package/yuxi/channel/config/defaults.py

66 lines
1.7 KiB
Python
Raw Normal View History

from __future__ import annotations
from pydantic import BaseModel
# ── Streaming defaults ────────────────────────────────────
STREAMING_PREVIEW_THROTTLE_MS: int = 160
STREAMING_PREVIEW_MIN_INITIAL_CHARS: int = 18
BLOCK_STREAMING_BREAK: str = "text_end"
BLOCK_STREAMING_CHUNK_MIN_CHARS: int = 800
BLOCK_STREAMING_CHUNK_MAX_CHARS: int = 1200
BLOCK_STREAMING_CHUNK_BREAK_PREFERENCE: str = "paragraph"
BLOCK_STREAMING_COALESCE_MIN_CHARS: int | None = None
BLOCK_STREAMING_COALESCE_MAX_CHARS: int | None = None
BLOCK_STREAMING_COALESCE_IDLE_MS: int = 1000
BLOCK_STREAMING_COALESCE_JOINER: str = "\n\n"
SSE_MAX_REASONING_CHARS: int = 4096
class HttpTimeoutConfig(BaseModel):
short: float = 10.0
normal: float = 30.0
long: float = 60.0
class WebhookTimeoutConfig(BaseModel):
process: float = 120.0
body_read: float = 5.0
class GatewayTimeoutConfig(BaseModel):
send: float = 15.0
stream_rpc: float = 30.0
connect: float = 5.0
heartbeat: float = 90.0
heartbeat_interval: float = 30.0
negotiation: float = 5.0
class CronTimeoutConfig(BaseModel):
gather: float = 15.0
task: float = 10.0
delivery: float = 300.0
class DoctorTimeoutConfig(BaseModel):
check: float = 30.0
class TimeoutConfig(BaseModel):
http: HttpTimeoutConfig = HttpTimeoutConfig()
webhook: WebhookTimeoutConfig = WebhookTimeoutConfig()
gateway: GatewayTimeoutConfig = GatewayTimeoutConfig()
cron: CronTimeoutConfig = CronTimeoutConfig()
doctor: DoctorTimeoutConfig = DoctorTimeoutConfig()
stream_finalize: float = 30.0
stream_queue_poll: float = 0.5
connection: float = 10.0
job_timeout: int = 900
TIMEOUT = TimeoutConfig()