From 236965c7e9238bb98630d940fa83666fd323d6e9 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 8 Oct 2026 21:55:05 +0400 Subject: [PATCH] refac --- backend/open_webui/utils/middleware.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 896f0ac5e6..2fb967edd6 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -5623,11 +5623,15 @@ async def streaming_chat_response_handler(response, ctx): tag_output = None if DETECT_REASONING_TAGS: - tag_output, _ = tag_output_handler( - 'reasoning', - reasoning_tags, - output, - ) + if not any( + item.get('attributes', {}).get('type') == 'reasoning_content' + for item in output + ): + tag_output, _ = tag_output_handler( + 'reasoning', + reasoning_tags, + output, + ) solution_output, _ = tag_output_handler( 'solution',