mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 23:21:44 -05:00
[PR #22397] [CLOSED] fix: strip thinking blocks before parsing tool result JSON #113966
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/22397
Author: @Tattooed-Geek
Created: 3/8/2026
Status: ❌ Closed
Base:
main← Head:fix-21888-rag-thinking-models📝 Commits (1)
2db41c2fix: strip thinking blocks before parsing tool result JSON📊 Changes
1 file changed (+23 additions, -1 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+23 -1)📄 Description
Summary
Fixes #21888
RAG query JSON extraction was failing with "thinking" models like GLM-5 and DeepSeek-R1 because these models output thinking blocks (e.g.,
<think>...</think>) before the actual JSON response. The parser tried to parse the thinking block as JSON, causing failures.Changes
<think>...</think>and similar thinking block patternsTesting
Fixes #21888
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.