mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
SSE streaming in Open WebUI API Endpoints (Chat Completions) fails to handle incomplete chunks #5032
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hide212131 on GitHub (May 4, 2025).
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
main
Ollama Version (if applicable)
No response
Operating System
macOS Sequoia
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
The Open WebUI Chat Completions API endpoint (/api/chat/completions) should properly handle SSE streaming messages that are split across multiple chunks, automatically combining incomplete lines with subsequent reads to form complete messages.
Actual Behavior
When using the Chat Completions API endpoint (/api/chat/completions) with streaming=true, SSE messages from certain backends (especially Java/Spring MVC/SseEmitter implementations) can be split across chunks. For example, a message starting with 'data: ' might arrive in one chunk, with its content arriving in the next chunk. The current implementation processes these fragments separately instead of combining them, resulting in malformed data in the client application.
Steps to Reproduce
Logs & Screenshots
Additional Information
No response