shell_gpt
shell_gpt copied to clipboard
fix: handle empty chunks in response stream
Description
This PR fixes an issue with empty chunks in the response stream that could cause errors when processing streaming responses.
Changes
- Added handling for empty
chunk.choicesin the response stream - Skip empty chunks gracefully by yielding an empty string and continuing the loop
Related Issues
- Fixed the streaming API that may return an empty data block causing an out-of-index error.
Additional Notes
This change makes the streaming handler more robust by properly handling edge cases in the response stream without breaking the processing flow.