mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-16 07:33:06 +08:00
thinking 块开始时不关闭已打开的 message item,直接覆盖 CurrentItemType/ CurrentItemID,累积的助手文本既不进 state.Outputs 也拿不到 output_item.done, response.completed 只带 reasoning——客户端收到「成功但无输出」。同 switch 的 tool_use 分支本来就先调 closeCurrentResponsesItem,只有 thinking 漏了。 content_index 只在 item 打开时置 0,从不推进。同一 message item 里第二个 text 块会再发一次 content_part.added(content_index=0),与第一个 part 撞在同一下标, SDK 累积式 helper 按 content[content_index] 写入时后者覆盖前者。反方向 responses_to_anthropic.go 有三处 ContentBlockIndex++,正方向一处都没有。 新增用例覆盖两条坏顺序,外加一条生命周期不变式用例(output_item.added 与 output_item.done 必须配平、terminal 事件按announce 顺序逐项携带)。