From af11cd88c179318993b70c8e77093731524157eb Mon Sep 17 00:00:00 2001 From: LiHtCocoa <1051293382@qq.com> Date: Wed, 23 Jul 2025 17:43:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=84=8F=E5=A4=96?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1=E6=B5=81=E5=BC=8Fchunk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openai_compatible_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openai_compatible_server.py b/openai_compatible_server.py index 3fc5065..0766b11 100644 --- a/openai_compatible_server.py +++ b/openai_compatible_server.py @@ -231,7 +231,7 @@ def stream_and_update_state(task_id: str, request_base: dict, user_or_tool_messa try: # findall直接返回捕获组的内容 text = json.loads(f'"{match_group}"') - if text and not text.startswith("**"): + if text and (len(text.strip()) > 2 or not text.startswith("**")): full_ai_response_text += text yield format_openai_chunk(text, model, request_id) except json.JSONDecodeError: @@ -270,7 +270,7 @@ def generate_non_streaming_response(task_id: str, request_base: dict, user_or_to try: # findall直接返回捕获组的内容 text = json.loads(f'"{match_group}"') - if text and not text.startswith("**"): + if text and (len(text.strip()) > 2 or not text.startswith("**")): full_ai_response_text += text except json.JSONDecodeError: continue