fix(backends): make streamed replies and session state consistent
- Validate stage prefixes before forwarding model tokens. Invalid prefixes may use the existing repair budget; once output starts, validation failure aborts the turn without appending a regenerated reply. Bound the token queue and close inner streams when consumption stops. - Replace delete-time lock eviction with reference-counted session locks covering holders and waiters. Serialize set/get with chat/stream/delete and release cancelled waiters without replacing a live lock. - Store person synonyms under workflow-native driver keys and expose consistent alias views to single/group reads and graph prompt injection. - Separate committed field patches from public formUpdate visibility. Commit callbacks keep repository fields synchronized even when updates are hidden or the consumer closes after graph completion. - Disable OpenAI SDK automatic retries. Own bounded retry attempts in the application, use 1/2/4 second backoff, retry streams only before text is emitted, enforce attempt timeouts, and close upstream/client resources. - Translate FastGPT SDK max_retries (total attempts) from the configured extra-retry count, and verify the real SDK loop uses four attempts. - Document the per-LLM budget and streaming failure semantics without claiming the whole multi-call HTTP turn has the same timeout. Validation: 267 offline tests passed, including actual SDK requests through MockTransport, stream repair/abort, timeout/close, lock races, aliases and formUpdate visibility; existing four dependency deprecation warnings.
This commit is contained in:
+3
-2
@@ -17,8 +17,9 @@ VOICE_CONFIG=config/voice.json
|
||||
# 每组 LLM_<名>_BASE_URL / _API_KEY / _MODEL 必填;
|
||||
# 可选 _TIMEOUT_SECONDS / _MAX_RETRIES / _TEMPERATURE / _EXTRA_BODY(JSON 字符串,
|
||||
# 如思考开关 KIMI 网关为 {"reasoning_effort":"none"})。
|
||||
# 超时/重试缺省 60 秒 / 3 次,与 FastGPT 客户端 SLA 对齐
|
||||
# (契约测试 test/backends/test_sla_alignment.py)。
|
||||
# 超时/重试缺省:每次尝试 60 秒,最多额外重试 3 次,退避 1、2、4 秒。
|
||||
# SDK 自动重试关闭;流式发出首个文本 token 后不重试。
|
||||
# 单次 LLM 调用预算最多 247 秒(另加响应关闭清理);不是整轮聊天总超时。
|
||||
# AGENT_HISTORY_MESSAGES=50:注入模型的对话历史上限(最近 N 条,
|
||||
# 双向计数);调大支持长对话;0 = 不截断(对齐 FastGPT 全量历史)。
|
||||
# AGENT_HISTORY_MESSAGES=0
|
||||
|
||||
Reference in New Issue
Block a user