Commit 78b9aa7
committed
fix: initialize streaming tool call arguments to empty string
When the first streaming chunk from an OpenAI-compatible provider
includes a tool call with function.name but no arguments field,
function.arguments is undefined. Subsequent chunks concatenate to
it via +=, producing "undefined{...}" which fails JSON parsing
and results in empty fn_args.
Initializing to "" on the first chunk prevents this.1 parent ac17487 commit 78b9aa7
2 files changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| |||
0 commit comments