fix(relay): remove extra blank line from Claude SSE stream#5773
Draft
zhangzhichaolove wants to merge 1 commit into
Draft
fix(relay): remove extra blank line from Claude SSE stream#5773zhangzhichaolove wants to merge 1 commit into
zhangzhichaolove wants to merge 1 commit into
Conversation
- stop appending a trailing newline to Claude stream data frames before CustomEvent writes the SSE terminator - keep Claude native /v1/messages stream output at the standard single blank line between events - add a regression test for consecutive Claude SSE chunks Refs QuantumNous#5402
Contributor
WalkthroughClaude SSE chunk rendering now omits the trailing newline on the ChangesClaude SSE blank-line fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Important
📝 变更描述 / Description
修复 Claude 原生
/v1/messages流式转发时,SSE event 之间多输出一个空行的问题。问题原因是
ClaudeChunkData在data:行尾主动追加了\n,而common.CustomEvent在写出data:字段时还会自动补上标准 SSE event 终止符\n\n,最终导致输出变成data: ...\n\n\n。本次改动移除了ClaudeChunkData中的多余换行,让 Claude stream event 恢复为标准的单个空行分隔。同时新增回归测试,连续写出两个 Claude SSE chunk,断言输出不包含三连换行,避免后续再次引入同类格式回归。
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
Summary by CodeRabbit