Ver Fonte

refac/fix: tag attribute handling

Timothy Jaeryang Baek há 1 mês atrás
pai
commit
b43acc2b3d
1 ficheiros alterados com 7 adições e 3 exclusões
  1. 7 3
      backend/open_webui/utils/middleware.py

+ 7 - 3
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