修复火山部分流式输出没有finish_reason导致的报错
This commit is contained in:
@@ -235,7 +235,7 @@ class LLM_request:
|
||||
delta_content = ""
|
||||
accumulated_content += delta_content
|
||||
# 检测流式输出文本是否结束
|
||||
finish_reason = chunk["choices"][0]["finish_reason"]
|
||||
finish_reason = chunk["choices"][0].get("finish_reason")
|
||||
if finish_reason == "stop":
|
||||
usage = chunk.get("usage", None)
|
||||
if usage:
|
||||
|
||||
Reference in New Issue
Block a user