Repository navigation
fix(api): 修正 malformed_response 映射、无内容自动重新生成与默认安全类别 - #100
Merged
Mag1cFall merged 2 commits intoNov 3, 2026
Merged
Conversation
- 排除隐藏的只读服务端工具步骤,MCP 调用仍阻止重新生成,重新生成时保留已输出的思考与停止序列状态 - 丢弃被重新生成取代的那一次的网页来源与引用 - 撤销默认安全设置中的公民诚信类别,删除断言内部函数与类别数量的测试 - 补充协议文档的重新生成条件与来源处理,构建文档的安全类别恢复为四类
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/api/openai.go: 从contentFilterFinishReason中移除malformed_response,避免上游网络波动或长文本格式异常导致的 Playground 19 号 finishReason 被误判定为content_filter/refusal。internal/aistudio/generate.go:regenerable()中增加finish.FinishReason == "malformed_response",在未产生可见输出前允许自动重新生成(最多 3 次)。output与matchedStopSequence局部状态。output.Add(event)移至服务端隐藏事件过滤之后,避免被隐藏的步骤误阻塞重新生成。internal/aistudio/safety.go: 默认安全设置覆盖全部harmCategories(包含HARM_CATEGORY_CIVIC_INTEGRITY),将所有类别默认阈值均设为OFF。docs/protocol.md&docs/build.md: 同步更新默认安全设置类别数量、重新生成条件与终态映射说明。验证 / Verification
TestResolveSafetySettingsCivicIntegrity与TestRegenerableMalformedResponse单元测试,验证安全类别推导与无正文时的重新生成判定行为。malformed_response时可正常自动重试并在 200 响应中按正常stop结束,不再触发content_filter报错熔断。