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: [azure_openai] Error: 'NoneType' object has no attribute 'content' (#3389)

saga.reyb699945b4772
diff --git a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py
index 4b89adaa49b..eb6d985f230 100644
--- a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py
+++ b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py
@@ -343,8 +343,12 @@ class AzureOpenAILargeLanguageModel(_CommonAzureOpenAI, LargeLanguageModel):
delta = chunk.choices[0]
- if delta.finish_reason is None and (delta.delta.content is None or delta.delta.content == '') and \
- delta.delta.function_call is None:
+ # Handling exceptions when content filters' streaming mode is set to asynchronous modified filter
+ if delta.delta is None or (
+ delta.finish_reason is None
+ and (delta.delta.content is None or delta.delta.content == '')
+ and delta.delta.function_call is None
+ ):
continue
# assistant_message_tool_calls = delta.delta.tool_calls