Commit 5289304
Elizabeth
fix: emit reasoning-end before text-end in chat completions stream
Close AiMsgReasoningEnd inline on first content delta instead of
deferring to post-loop cleanup. This ensures SSE event order matches
the Anthropic backend: reasoning-start → delta×N → reasoning-end →
text-start → delta×M → text-end.
Fallback reasoning-end kept for the edge case where the stream ends
during reasoning with no content ever arriving (e.g. max_tokens).1 parent 77d0cf1 commit 5289304
1 file changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
| |||
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
264 | | - | |
265 | | - | |
266 | | - | |
| 268 | + | |
| 269 | + | |
267 | 270 | | |
268 | 271 | | |
269 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
270 | 276 | | |
271 | 277 | | |
272 | 278 | | |
| |||
0 commit comments