Repository navigation
Conversation
- Add RawLineMode to transparently forward all SSE lines (event:, data:, empty) instead of filtering out event: lines, matching sub2api's passthrough design - Parse usage data as a side-effect without modifying the stream - Continue reading upstream after client disconnect to collect billing usage - Add Anthropic-native ping format (event: ping) for Claude relay - Change STREAMING_TIMEOUT default from 300s to 0 (disabled), matching sub2api - Fixes Agent tool-call disconnections and missing token statistics AI-assisted: code generated with Claude Code
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughAdds a raw SSE pass-through streaming mode for Claude relay. RelayInfo gains RawLineMode and ClientDisconnected fields; a new HandleRawLineStreamData handler and ClaudePingData helper support this mode; StreamScannerHandler is updated with mode-aware ticker, ping, and end-reason logic; and the default STREAMING_TIMEOUT fallback changes from 300 to 0. ChangesRaw Line Streaming Mode
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ClaudeStreamHandler
participant StreamScannerHandler
participant HandleRawLineStreamData
participant Upstream
Client->>ClaudeStreamHandler: stream request (Claude format)
ClaudeStreamHandler->>ClaudeStreamHandler: set RawLineMode = true
ClaudeStreamHandler->>StreamScannerHandler: start scanning
loop each scanned line
Upstream-->>StreamScannerHandler: raw line
alt RawLineMode
StreamScannerHandler->>HandleRawLineStreamData: forward line
HandleRawLineStreamData->>HandleRawLineStreamData: parse data:/update ClaudeResponseInfo
HandleRawLineStreamData-->>Client: write line, flush on empty
else legacy mode
StreamScannerHandler->>StreamScannerHandler: HandleStreamResponseData
end
end
alt client disconnected
StreamScannerHandler->>StreamScannerHandler: mark ClientDisconnected, continue reading upstream
end
Poem
✨ 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 |
|
AI-assisted: code generated with Claude Code
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit