Repository navigation
Conversation
- 写代码助手追加任务改用 continuationPrefixStripper 去掉重复前缀,删除重复的末尾截取函数 - 重新生成循环去掉空分支,按写代码助手、从头重新生成与续写三种情况判断 - 写代码助手在截断处仍在运行的任务于追加用户轮之前取消,动作数组只解析一次,两个重写提示共用调用格式说明 - 流中断后续写的用量计入中断那一次最近一帧的用量 - 模拟上游流的用例移出正式仓库,保留调用块尾随逗号修正的单元测试
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动 / Changes
internal/aistudio/generate.go: 上游在已输出纯文本且无函数调用、媒体、可执行代码与服务端工具步骤后以malformed_function_call、unexpected_tool_call、malformed_response、完成帧前断流或流尾 5xx 结束时,把已输出纯文本作为model轮并附加带<partial_reply>(末尾至多 20000 字符)的用户提示在同一流内续写(最多 3 次),以continuationPrefixStripper过滤续写轮开头重复的已输出前缀、保留思考签名并按续写规则合并各轮用量。internal/aistudio/assistant.go:repairJSONStrings在字符串字面量之外去掉}与]前的尾随逗号。function_calls代码块、缺少调用块的ask_question交回提问,以及调用search_web和ask_question之外工作区内置工具的步骤,停止读取该任务后续步骤并在同一应用中追加要求写出function_calls代码块与ask_question的用户轮(最多 3 次),去重重复前缀并合并用量。docs/protocol.md&docs/build.md: 同步说明输出纯文本后的异常续写流程与写代码助手调用块恢复行为。验证 / Verification
internal/aistudio/compatibility_test.go: 新增TestGeneratePartialTextMalformedFunctionCallContinuation与TestAssistantFunctionCallRepairAndContinuation,覆盖纯文本输出后遇到malformed_function_call的流内续写、前缀去重、思考签名保留、用量合并,以及写代码助手尾随逗号修复、损坏/缺失function_calls代码块与工作区内置工具拦截后的同应用恢复。go test ./internal/aistudio ./internal/api与go vet ./internal/aistudio ./internal/api全部通过。Summary
Evidence
malformed_function_call终止或写代码助手写出带尾随逗号的 JSON、遗漏function_calls代码块、误调远程工作区工具时,当前轮次缺失客户端函数调用。go test -v -run 'TestGeneratePartialTextMalformedFunctionCallContinuation|TestAssistantFunctionCallRepairAndContinuation' ./internal/aistudio通过,流内续写补齐工具调用且不重复已输出正文。Merge Danger
Door: two-way
Blast Radius: small