Просмотр исходного кода

Merge pull request #9619 from XingjianXie/fix_after_tag

Fix tag_content_handler issue
Timothy Jaeryang Baek 2 месяцев назад
Родитель
Сommit
4271b652a5
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      backend/open_webui/utils/middleware.py

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