Repository navigation
feat: v1.7 同协议直通流式 + 未实现流式方向显式 501 - #13
Merged
Merged
Conversation
- 直通流式(chat←chat / anthropic←anthropic):tee_lines 逐行透传字节不动;旁路收集流尾汇总(anthropic 复用 AnthropicToChatStream,chat 新增 ChatStreamCollector);落库/埋点仍走 finalize_turn 单一路径 - 隐藏 bug 修复:stream:true 落到未实现方向此前被 post_json 当 JSON 解析炸成 502,现显式 501(附已支持方向清单) - 客户端中途断开:已收部分照常落账 - mock:/chat/completions 发 Chat 形状 chunk(role 首帧 + finish + usage + [DONE]) - 测试:TestChatStreamCollector 3 项单测 + 冒烟第 7 组 7 项(透传文本拼合 / 逐块到达 ~31ms / 501);56 单测 + 25 冒烟全过 - 文档:LIMITATIONS #1 范围更新;README/REVIEW/capability-matrix/CHANGELOG 同步
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.
目的
PR #12 闭环了 chat←anthropic 的转换流式,但同协议方向(chat←chat、anthropic←anthropic)的 stream:true 请求经网关会直接 502——
post_json把上游 SSE 当 JSON 解析必炸。这不是「未实现的特性」,是一个会被真实用户踩到的隐藏 bug。方案
tee_lines三通——每行原样写给客户端(字节不动、即时 flush),同时 yield 给旁路收集器AnthropicToChatStream做汇总(产出的 Chat 帧丢弃,只取 usage/文本)ChatStreamCollector(文本/usage 汇总、工具槽位拼接、脏数据容错;Chat 流默认不带 usage,收不到如实记 0,不编造)finalize_turn+synthetic_response()单一路径,不另造语义测试(56 单测 + 25 冒烟全过)
TestChatStreamCollector3 项:文本+usage 汇总、工具槽位拼接、脏数据容错备注
本分支因本机代理对 github.com 的 CONNECT 隧道临时故障,经 GitHub API(git/trees + git/commits + git/refs)推送,内容与前述本地验证完全一致。