From c56bedc5ffa81967270da44b2f76f5a7d51a7b16 Mon Sep 17 00:00:00 2001 From: Xingjian Xie Date: Fri, 7 Feb 2025 20:15:54 +0000 Subject: [PATCH] Fix tag_content_handler issue: after_tag should be remove from the current content_blocks --- backend/open_webui/utils/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 331b850ff..79210030d 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1260,10 +1260,10 @@ async def process_chat_response( match.end() : ] # Content after opening tag - # Remove the start tag from the currently handling text block + # Remove the start tag and after from the currently handling text block content_blocks[-1]["content"] = content_blocks[-1][ "content" - ].replace(match.group(0), "") + ].replace(match.group(0) + after_tag, "") if before_tag: content_blocks[-1]["content"] = before_tag