Commit d76a97e
committed
fix: guard against non-string content delta and thinking blocks
Mistral (and potentially other providers) may send thinking content as
an object in choice.delta.content rather than a string. Without a type
guard, the object is coerced to "[object Object]" when appended to the
text buffer.
Two fixes:
1. openai-transport-stream.ts: add typeof === "string" check on
choice.delta.content before appending to the text buffer
2. message-extract.ts: handle object-form thinking blocks where the
text lives in a .text property instead of being a plain string
Fixes #683091 parent 9a93ea9 commit d76a97e
2 files changed
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1182 | 1182 | | |
1183 | 1183 | | |
1184 | 1184 | | |
1185 | | - | |
| 1185 | + | |
1186 | 1186 | | |
1187 | 1187 | | |
1188 | 1188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
0 commit comments