Add chat_id, variables, detail, timeout_sec, and send_system_prompt to LLMConfig; update create_llm_service to accept new parameters and handle FastGPT integration. Modify pipeline to utilize chat_id and adjust message handling based on provider settings.

This commit is contained in:
Xin Wang
2026-05-25 08:45:30 +08:00
parent b918eec5c1
commit 2edcb51805
5 changed files with 406 additions and 6 deletions

View File

@@ -104,6 +104,11 @@ class LLMConfig:
base_url: str | None = None
model: str = "gpt-4o-mini"
temperature: float | None = 0.7
chat_id: str | None = None
variables: dict[str, str] = field(default_factory=dict)
detail: bool = False
timeout_sec: float = 60.0
send_system_prompt: bool = False
@dataclass(frozen=True)
@@ -180,6 +185,12 @@ def config_from_dict(data: dict) -> EngineConfig:
if stt.get("language") == "":
stt["language"] = None
llm = _dict(services.get("llm"))
if llm.get("chat_id") == "":
llm["chat_id"] = None
if not isinstance(llm.get("variables"), dict):
llm["variables"] = {}
turn = _dict(data.get("turn"))
vad = _dict(turn.get("vad"))
@@ -207,7 +218,7 @@ def config_from_dict(data: dict) -> EngineConfig:
),
agent=AgentConfig(**agent),
services=ServicesConfig(
llm=LLMConfig(**_dict(services.get("llm"))),
llm=LLMConfig(**llm),
stt=STTConfig(**stt),
tts=TTSConfig(**_dict(services.get("tts"))),
),