mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 06:39:06 +08:00
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
parent
a640803fc9
commit
f30bf08580
@ -739,6 +739,12 @@ class OpenAILargeLanguageModel(_CommonOpenAI, LargeLanguageModel):
|
||||
|
||||
delta = chunk.choices[0]
|
||||
has_finish_reason = delta.finish_reason is not None
|
||||
# to fix issue #12215 yi model has special case for ligthing
|
||||
# FIXME drop the case when yi model is updated
|
||||
if model.startswith("yi-"):
|
||||
if isinstance(delta.finish_reason, str):
|
||||
# doc: https://platform.lingyiwanwu.com/docs/api-reference
|
||||
has_finish_reason = delta.finish_reason.startswith(("length", "stop", "content_filter"))
|
||||
|
||||
if (
|
||||
not has_finish_reason
|
||||
|
Loading…
x
Reference in New Issue
Block a user