shell_gpt icon indicating copy to clipboard operation
shell_gpt copied to clipboard

fix: handle empty chunks in response stream

Open belingud opened this issue 9 months ago • 0 comments

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.choices in 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.

belingud avatar Mar 30 '25 15:03 belingud