mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-25 16:23:56 +00:00
Some providers send one very large piece of a streamed answer in a single go: a long reasoning trace, a code execution result, a turn with many tool calls, or a response echo carrying a big tool list. Anything past 128 KB in one line killed the chat mid-answer with a misleading `400, message: Got more than 131072 bytes when reading`. Nothing was rejected upstream, that is our own reader giving up on an oversized line. Open WebUI already had code that assembles lines itself with no such limit, but it only ran when CHAT_STREAM_RESPONSE_CHUNK_MAX_BUFFER_SIZE was set. Unset is the default, and in that case the raw capped reader was used instead, so a default install always broke. That path now always assembles lines, and the setting goes back to being what its name says: an optional cap, off by default. It applies to the Ollama stream as well, since both now share the same reader. The assembly loop only splits once a line actually completes, because the old one re-concatenated and re-split the whole buffer on every network chunk. Without that, allowing long lines would have traded an error for multi-second event loop stalls. | | 20 MB in one line | 200k small lines | | --- | --- | --- | | before | 4249 ms | 27.3 ms | | after | 37 ms | 25.2 ms | |
||
|---|---|---|
| .. | ||
| access_control | ||
| images | ||
| mcp | ||
| telemetry | ||
| actions.py | ||
| anthropic.py | ||
| asgi_middleware.py | ||
| ask_user.py | ||
| audit.py | ||
| auth.py | ||
| automations.py | ||
| calendar.py | ||
| channels.py | ||
| chat.py | ||
| chat_fork.py | ||
| chat_id.py | ||
| chat_variables.py | ||
| code_interpreter.py | ||
| context_compaction.py | ||
| embeddings.py | ||
| files.py | ||
| filter.py | ||
| groups.py | ||
| headers.py | ||
| json_codec.py | ||
| json_response.py | ||
| logger.py | ||
| memory.py | ||
| middleware.py | ||
| misc.py | ||
| model_ids.py | ||
| models.py | ||
| notifications.py | ||
| oauth.py | ||
| payload.py | ||
| pdf_generator.py | ||
| plugin.py | ||
| rate_limit.py | ||
| redis.py | ||
| response.py | ||
| sanitize.py | ||
| security_headers.py | ||
| session_pool.py | ||
| subagents.py | ||
| task.py | ||
| terminals.py | ||
| timers.py | ||
| tool_approval.py | ||
| tools.py | ||
| validate.py | ||
| valves.py | ||
| webhook.py | ||