From 2aa5e7372809c2b80e831e23dec0b0f6e435bcdb Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Fri, 16 May 2025 18:01:55 +0400 Subject: [PATCH] refac: filter details --- backend/open_webui/utils/middleware.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 2c7acbb78..21495f04a 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -949,15 +949,15 @@ async def process_chat_response( if message: messages = get_message_list(message_map, message.get("id")) - # Remove reasoning details and files from the messages. + # Remove details tags and files from the messages. # as get_message_list creates a new list, it does not affect # the original messages outside of this handler for message in messages: message["content"] = re.sub( - r"]*>.*?<\/details>", + r"]*>.*?<\/details>", "", message["content"], - flags=re.S, + flags=re.S | re.I, ).strip() if message.get("files"):