mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #22761] [CLOSED] fix: Fix streaming JSON parsing and preserve model tool_ids #49898
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22761
Author: @teenccu
Created: 3/17/2026
Status: ❌ Closed
Base:
dev← Head:fix/openwebui-streaming-toolids📝 Commits (10+)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/devd95f533Merge pull request #19729 from open-webui/deva7271530.6.43 (#20093)6adde20Merge pull request #20394 from open-webui/devf9b0534Merge pull request #20522 from open-webui/dev📊 Changes
2 files changed (+70 additions, -5112 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+17 -4870)📝
backend/open_webui/utils/response.py(+53 -242)📄 Description
Title: Fix streaming JSON parsing and preserve model tool_ids
Description:
to avoid partial-chunk JSON decode errors when processing SSE/text streams.
tool_idsfrom model presets when requests omit them,preventing accidental removal of available tools.
Files added:
How to test locally:
backend/open_webui/utils/with the ones inthis patch.
streaming) work without JSON decode errors and that model presets retain
their configured
tool_idswhen issuing chat requests withouttool_ids.Suggested PR body:
This patch fixes two related runtime issues observed in environments where
model/tool responses are streamed via SSE or where model presets include a
list of
tool_ids.response.pyensures partial text chunks are buffered and JSON objectsare only parsed once a full newline-delimited message is available. This
removes intermittent JSON decoding errors and prevents loss of streamed
tool_call messages.
middleware.pypreserves model presettool_idswhen a request does notexplicitly provide
tool_ids, ensuring the model retains access to toolspreviously configured in Open WebUI.
Both changes are small and low-risk; they improve stability of tool-calling
flows and streaming responses.
I confirm: I have read and agree to the Contributor License Agreement (CLA).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.