From 6d81eef425b1a602a1b6933c58ff7848acd0b9af Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Fri, 2 May 2025 14:04:12 +0400 Subject: [PATCH] refac: reasoning detection --- backend/open_webui/utils/middleware.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 8cc2b2b772..d81170f018 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1422,8 +1422,10 @@ async def process_chat_response( if after_tag: content_blocks[-1]["content"] = after_tag + content = after_tag break - elif content_blocks[-1]["type"] == content_type: + + if content and content_blocks[-1]["type"] == content_type: start_tag = content_blocks[-1]["start_tag"] end_tag = content_blocks[-1]["end_tag"] # Match end tag e.g.,