Преглед на файлове

refac: reasoning detection

Timothy Jaeryang Baek преди 3 месеца
родител
ревизия
6d81eef425
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      backend/open_webui/utils/middleware.py

+ 3 - 1
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., </tag>