Fixes connection interruptions from ChatGPT API by catching ChunkedEncodingError and gracefully ending the stream with [DONE] instead of returning 500 errors. Two-level error handling: 1. Catches errors during stream initialization 2. Catches errors during stream iteration This prevents abrupt failures when the upstream connection is interrupted mid-response.
37 KiB
37 KiB