Replies: 1 comment
|
这个根因我们 FAQ 已收录(#725 同族):SSE 流式分块对 block.name/callId 覆盖赋值,空 delta 把首块值抹空。官方修复前可:降级非流式 / 及时中止重试。 详见:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/faq.md |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
DeepSeek 流式返回工具调用时,首块带正常 id/name,后续 delta 里 id/name 若为空字符串,会把首块的值覆盖成空,导致
unknown tool ""且 callId 为空;该会话下次加载时历史直接读不出来。最小复现
两个 SSE data 帧,第二帧把 id/name 清成空串:
装配出来的 tool call:
id=""、name=""→ToolNotFoundError("unknown tool \"\""),且 tool/result 的source.callId为空字符串。根因
packages/llm/llm-deepseek/src/translate.ts:!== undefined对空串为真,后续 delta 的空串 id/name 覆盖首块。closeBlock里id: CallId(block.callId ?? '')在流里没有 id 时直接落空串,没有兜底(通用装配器packages/llm/llm/src/assembler.ts有?? CallId('call-${index}'))。空 callId 写进
tool/result后,会话校验assertMessageEventShape(packages/core/session/src/index.ts,空source.callId被拒)在重新加载时抛must have tool source→SessionPersistenceCorruptionError→history unavailable,整条会话历史加载失败。模型发一次空 id 工具调用就卡死该会话。修复(已本地验证)
closeBlock加兜底:加了两个测试(空串 delta 覆盖、流里无 id),并更新了原断言“无 id 输出空 id”的用例;
pnpm vitest run packages/llm/llm-deepseek/tests/translate.spec.ts32/32 通过。和 #879 #885 #161 #615 #725 #887 #890 同一根因,这条补上具体复现和补丁。
修复已在 fork 上:
WilShi/deepseek-harness分支fix/llm-deepseek-empty-toolcall-delta(commit 82f3634),含两个回归测试。All reactions