feat(config): configurable conversation history window (B3)
FastGPT maintains full history server-side; LangGraph truncated the injected history at a hardcoded 50 messages, so long conversations behaved differently across backends. - Config.AGENT_HISTORY_MESSAGES (env): max messages injected into the model prompt (recent N, both roles counted); default 50 unchanged; larger values support long conversations; 0 = no truncation, matching FastGPT's full-history semantics. Only the injected window is affected - dialogue stays fully persisted in the checkpoint. - validate(): rejects negative values; 0 and positive accepted - conversation_history reads the config (import-time class attribute, monkeypatched in tests); explicit None-check keeps 0 falsy-safe - .env.example documents the knob Verified: 225 unit tests (6 new history-window tests)
This commit is contained in:
@@ -19,6 +19,9 @@ VOICE_CONFIG=config/voice.json
|
||||
# 如思考开关 KIMI 网关为 {"reasoning_effort":"none"})。
|
||||
# 超时/重试缺省 60 秒 / 3 次,与 FastGPT 客户端 SLA 对齐
|
||||
# (契约测试 test/backends/test_sla_alignment.py)。
|
||||
# AGENT_HISTORY_MESSAGES=50:注入模型的对话历史上限(最近 N 条,
|
||||
# 双向计数);调大支持长对话;0 = 不截断(对齐 FastGPT 全量历史)。
|
||||
# AGENT_HISTORY_MESSAGES=0
|
||||
# LLM_PROVIDERS=deepseek,kimi,gpt6luna
|
||||
# LLM_PROVIDER=deepseek
|
||||
# LLM_DEEPSEEK_BASE_URL=https://api.openai.com/v1
|
||||
|
||||
Reference in New Issue
Block a user