Originally created by @hide212131 on GitHub (May 4, 2025).
Check Existing Issues
I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
Installation Method
Git Clone
Open WebUI Version
main
Ollama Version (if applicable)
No response
Operating System
macOS Sequoia
Browser (if applicable)
No response
Confirmation
I have read and followed all instructions in README.md.
I am using the latest version of both Open WebUI and Ollama.
I have included the browser console logs.
I have included the Docker container logs.
I have listed steps to reproduce the bug in detail.
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.
Originally created by @hide212131 on GitHub (May 4, 2025).
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
- [x] I am using the latest version of Open WebUI.
### Installation Method
Git Clone
### Open WebUI Version
main
### Ollama Version (if applicable)
_No response_
### Operating System
macOS Sequoia
### Browser (if applicable)
_No response_
### Confirmation
- [x] I have read and followed all instructions in `README.md`.
- [x] I am using the latest version of **both** Open WebUI and Ollama.
- [x] I have included the browser console logs.
- [x] I have included the Docker container logs.
- [x] I have listed steps to reproduce the bug in detail.
### 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
1. Run a Java-based SSE server (example: https://github.com/hide212131/openai-compatible-api-java-example)
2. In Settings > Connections, specify localhost:8000
3. Select 'mock-gpt-model' as the model and enter a conversation prompt
### Logs & Screenshots
<img width="1686" alt="Image" src="https://github.com/user-attachments/assets/4c96b4ed-661e-4708-aaaa-bcfca54f6cd7" />
```
2025-05-04 15:24:46.671 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63779 - "OPTIONS /api/v1/chats/2fdfe2ca-4b5e-4f38-a59b-cf60d5d584d7 HTTP/1.1" 200 - {}
2025-05-04 15:24:46.722 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63779 - "POST /api/v1/chats/2fdfe2ca-4b5e-4f38-a59b-cf60d5d584d7 HTTP/1.1" 200 - {}
2025-05-04 15:24:46.726 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63779 - "OPTIONS /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-04 15:24:46.734 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63779 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-04 15:24:46.738 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63779 - "OPTIONS /api/chat/completions HTTP/1.1" 200 - {}
2025-05-04 15:24:46.745 | INFO | open_webui.utils.chat:generate_direct_chat_completion:69 - generate_direct_chat_completion - {}
2025-05-04 15:24:46.759 | INFO | open_webui.utils.chat:generate_direct_chat_completion:106 - res: {'status': True} - {}
2025-05-04 15:24:46.762 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63779 - "POST /api/chat/completions HTTP/1.1" 200 - {}
2025-05-04 15:24:46.772 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63779 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-04 15:24:50.047 | INFO | open_webui.utils.chat:generate_direct_chat_completion:69 - generate_direct_chat_completion - {}
2025-05-04 15:24:50.051 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63799 - "OPTIONS /api/chat/completed HTTP/1.1" 200 - {}
2025-05-04 15:24:50.062 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63799 - "POST /api/chat/completed HTTP/1.1" 200 - {}
2025-05-04 15:24:50.071 | INFO | open_webui.utils.chat:generate_direct_chat_completion:69 - generate_direct_chat_completion - {}
2025-05-04 15:24:50.075 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63799 - "POST /api/v1/chats/2fdfe2ca-4b5e-4f38-a59b-cf60d5d584d7 HTTP/1.1" 200 - {}
2025-05-04 15:24:50.077 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63801 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-04 15:24:50.080 | INFO | open_webui.models.chats:count_chats_by_tag_name_and_user_id:817 - Count of chats for tag 'tag3': 0 - {}
2025-05-04 15:24:50.082 | INFO | open_webui.models.chats:count_chats_by_tag_name_and_user_id:817 - Count of chats for tag 'tag1': 0 - {}
2025-05-04 15:24:50.083 | INFO | open_webui.models.chats:count_chats_by_tag_name_and_user_id:817 - Count of chats for tag 'tag2': 0 - {}
2025-05-04 15:24:50.092 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63799 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-04 15:24:50.094 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63801 - "GET /api/v1/chats/2fdfe2ca-4b5e-4f38-a59b-cf60d5d584d7 HTTP/1.1" 200 - {}
2025-05-04 15:24:50.099 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63801 - "OPTIONS /api/v1/chats/all/tags HTTP/1.1" 200 - {}
2025-05-04 15:24:50.103 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:63801 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 - {}
```
### Additional Information
_No response_
GiteaMirror
added the bug label 2025-11-11 16:10:20 -06:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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