File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,11 +124,14 @@ export class SDKChatStreamingAdapter {
124124 }
125125 }
126126
127- // Also handle reasoning content (for models like gpt-oss-20b that output to reasoning)
128- const reasoning = data . choices ?. [ 0 ] ?. delta ?. reasoning ;
129- if ( reasoning ) {
130- totalReasoning += reasoning ;
131- }
127+ // Note: We do NOT accumulate delta.reasoning here because:
128+ // 1. The backend sends reasoning via dedicated "event: reasoning" SSE events
129+ // 2. It also includes delta.reasoning in chunks for compatibility
130+ // 3. Accumulating from both sources causes text duplication
131+ // 4. We only accumulate from the reasoning event (lines 260-272)
132+ //
133+ // If a provider sends ONLY delta.reasoning without reasoning events,
134+ // that's a backend issue that should be fixed by emitting reasoning events.
132135
133136 // Handle tool calls in streaming response
134137 const deltaToolCalls = data . choices ?. [ 0 ] ?. delta ?. tool_calls as Array < {
You can’t perform that action at this time.
0 commit comments