mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 修复Xinference 模型回答问题最后几个字会重复一次
--bug=1045125 --user=王孝刚 【模型管理】本地 Xinference 模型回答问题最后几个字会重复一次 https://www.tapd.cn/57709429/s/1565685
This commit is contained in:
parent
df33fc80d8
commit
d50c008979
|
|
@ -42,7 +42,8 @@ class BaseChatOpenAI(ChatOpenAI):
|
|||
for chunk in response:
|
||||
if not isinstance(chunk, dict):
|
||||
chunk = chunk.model_dump()
|
||||
if len(chunk["choices"]) == 0 or chunk["choices"][0]["finish_reason"] == "length" or chunk["choices"][0]["finish_reason"] == "stop":
|
||||
if (len(chunk["choices"]) == 0 or chunk["choices"][0]["finish_reason"] == "length" or
|
||||
chunk["choices"][0]["finish_reason"] == "stop") and chunk.get("usage") is not None:
|
||||
if token_usage := chunk.get("usage"):
|
||||
self.__dict__.setdefault('_last_generation_info', {}).update(token_usage)
|
||||
logprobs = None
|
||||
|
|
|
|||
Loading…
Reference in New Issue