From b43acc2b3d1ee66cb2cc2f1eb2860b9dcee3d837 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 14 Aug 2025 04:04:34 +0400 Subject: [PATCH] refac/fix: tag attribute handling --- backend/open_webui/utils/middleware.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 15fd08d2dd..e0c38c4a03 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1619,9 +1619,13 @@ async def process_chat_response( match = re.search(start_tag_pattern, content) if match: - attr_content = ( - match.group(1) if match.group(1) else "" - ) # Ensure it's not None + try: + attr_content = ( + match.group(1) if match.group(1) else "" + ) # Ensure it's not None + except: + attr_content = "" + attributes = extract_attributes( attr_content ) # Extract attributes safely