Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: close #12215 for yi special case (#12222)

yihongf30bf08580a6
diff --git a/api/core/model_runtime/model_providers/openai/llm/llm.py b/api/core/model_runtime/model_providers/openai/llm/llm.py
index 73cd7e3c341..86042de6f41 100644
--- a/api/core/model_runtime/model_providers/openai/llm/llm.py
+++ b/api/core/model_runtime/model_providers/openai/llm/llm.py
@@ -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