Skip to content

Add Robust SSE Buffering for OpenAI Stream Responses#55

Open
moulai wants to merge 1 commit intoreply2future:mainfrom
moulai:main
Open

Add Robust SSE Buffering for OpenAI Stream Responses#55
moulai wants to merge 1 commit intoreply2future:mainfrom
moulai:main

Conversation

@moulai
Copy link

@moulai moulai commented Nov 7, 2025

  • Add chunk buffering in helper.php::streamOpenAiApi() so partial SSE payloads are accumulated until a full event is available before decoding.
  • Normalize line endings, parse event: / data: segments, and requeue incomplete JSON payloads to avoid fatal errors when chunks split mid-object.
  • Buffer non-200 responses to capture the full error message before surfacing it to the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant