Commit 436bc15
committed
Fix: Add empty checks for reasoning content arrays in stream handler
Add defensive checks before accessing array elements in reasoning content
processing to prevent IndexError when arrays are empty.
Changes:
- Line 154: Check summary array is non-empty before accessing summary[0]
- Line 204: Change 'is None' to truthiness check to handle both None and []
This prevents crashes when 3rd-party APIs initialize with empty arrays and
later receive content in OpenAI format.1 parent 03dca68 commit 436bc15
1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| |||
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
204 | | - | |
| 210 | + | |
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
| |||
0 commit comments