Commit 9fbb8a4
committed
fix: preserve empty reasoning_content for DeepSeek V4 in non-streaming and streaming paths
Three truthy checks were dropping empty reasoning_content ('') from DeepSeek
V4's thinking mode responses, causing 'must be passed back to the API' errors
in multi-turn tool call chains:
1. Non-streaming parser: if (reasoning != null && reasoning.length > 0)
-> Now: if (reasoning != null) to preserve empty strings
2. Streaming parser: if (reasoningContent) truthy check
-> Now: if ('reasoning_text' in delta) to detect field presence
3. Outbound converter: if (part.text) reasoningText = part.text
-> Now: reasoningText = part.text ?? '' to preserve empty text
PR anomalyco#24146 fixed the transform.ts path; this completes the remaining cases.1 parent 0405bc7 commit 9fbb8a4
2 files changed
Lines changed: 16 additions & 10 deletions
File tree
- packages/opencode/src/provider/sdk/copilot/chat
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
230 | 232 | | |
231 | | - | |
| 233 | + | |
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
| |||
477 | 479 | | |
478 | 480 | | |
479 | 481 | | |
480 | | - | |
| 482 | + | |
| 483 | + | |
481 | 484 | | |
482 | | - | |
| 485 | + | |
483 | 486 | | |
484 | 487 | | |
485 | 488 | | |
486 | 489 | | |
487 | 490 | | |
488 | 491 | | |
489 | 492 | | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
496 | 500 | | |
497 | 501 | | |
498 | 502 | | |
| |||
0 commit comments