From 08fbc77067f81146ae67ae0d655f47ab89c9e850 Mon Sep 17 00:00:00 2001 From: ikaros <327209194@qq.com> Date: Sun, 29 Dec 2024 14:48:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9ALLM=E6=B5=81?= =?UTF-8?q?=E5=BC=8F=E5=93=8D=E5=BA=94=20openai=E6=8E=A5=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=B6=EF=BC=8C=E6=9C=89=E7=9A=84=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E4=BC=9A=E8=BF=94=E5=9B=9Enone=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=EF=BC=8C=E8=BF=9B=E8=A1=8C=E7=89=B9=E6=AE=8A=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/my_handle.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/my_handle.py b/utils/my_handle.py index 52f849b1..a00697e1 100644 --- a/utils/my_handle.py +++ b/utils/my_handle.py @@ -1779,9 +1779,10 @@ def split_by_chinese_punctuation(s): else: continue else: - # 流式的内容是追加形式的 - tmp += chunk.choices[0].delta.content - resp_content += chunk.choices[0].delta.content + if chunk.choices[0].delta.content: + # 流式的内容是追加形式的 + tmp += chunk.choices[0].delta.content + resp_content += chunk.choices[0].delta.content elif chat_type in ["tongyi"]: # 这个是一直输出全部的内容,所以要切分掉已经处理的文本长度 tmp = chunk.output.choices[0].message.content[cut_len:]