Repository navigation
Commit c020b2d
fix: yield content from final streaming chunk before stopping (#1198)
* fix: use configured midjourney_temp_folder instead of hardcoded ./tmp (fixes #1100)
* fix: yield content from final streaming chunk before stopping (fixes #1169)
When finish_reason is "stop", some third-party APIs include content in
the same chunk. The previous code broke out of the loop before yielding
that content, causing truncated responses.
Also fix KeyError when neither finish_details nor finish_reason is present
in chunk["choices"][0] — fall back to chunk.get("finish_details") instead
of chunk["finish_details"] to avoid crashing.
Co-Authored-By: Octopus <liyuan851277048@icloud.com>
---------
Co-authored-by: octo-patch <octo-patch@github.com>1 parent 6de06a5 commit c020b2d
1 file changed
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
272 | | - | |
| 270 | + | |
273 | 271 | | |
274 | | - | |
275 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
276 | 275 | | |
277 | 276 | | |
278 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
282 | 285 | | |
283 | 286 | | |
284 | 287 | | |
| |||
0 commit comments