Skip to content

Commit

Permalink
Merge pull request #1070 from Ikaros-521/owner
Browse files Browse the repository at this point in the history
优化:LLM流式响应 openai接口的数据时,有的服务端会返回none数据,进行特殊处理
  • Loading branch information
Ikaros-521 authored Dec 29, 2024
2 parents afc30e7 + 08fbc77 commit 13a2fd9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions utils/my_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down

0 comments on commit 13a2fd9

Please sign in to comment.