Commit b0b0a3a
committed
fix: utf8 decoder, finish_reason override, and chunk boundary handling
Fix: streaming proxy
- Use utf8.decoder.bind() instead of per-chunk utf8.decode() to avoid
FormatException on incomplete UTF-8 sequences across TCP chunks
Fix: finish_reason consistency
- Override finish_reason to tool_calls when toolCalls is non-empty
even if upstream reports finishReason stop
- Prevents OpenCode from treating a tool-call response as conversation
end and starting extra rounds
Fix: non-streaming handler
- Add leftover buffer for chunk boundary handling, matching streaming
handler behavior1 parent 8875321 commit b0b0a3a
1 file changed
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
280 | 279 | | |
281 | 280 | | |
282 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
283 | 286 | | |
284 | 287 | | |
285 | 288 | | |
| |||
394 | 397 | | |
395 | 398 | | |
396 | 399 | | |
| 400 | + | |
397 | 401 | | |
398 | 402 | | |
399 | 403 | | |
400 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
401 | 408 | | |
402 | 409 | | |
403 | 410 | | |
| |||
424 | 431 | | |
425 | 432 | | |
426 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
427 | 438 | | |
428 | 439 | | |
429 | 440 | | |
| |||
0 commit comments