From 83af50368f2367f6d8ee82f1e83e171fc36cc1f4 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Sat, 27 Jul 2024 00:05:21 +0800 Subject: [PATCH] fix(api/core/model_runtime/model_providers/azure_openai/llm/llm.py): Try to skip if `delta.delta` is None. (#6727) Signed-off-by: -LAN- --- .../model_runtime/model_providers/azure_openai/llm/llm.py | 4 ++++ 1 file changed, 4 insertions(+) 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 34d1f64210953a..1911caa952bbba 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 @@ -375,6 +375,10 @@ def _handle_chat_generate_stream_response( continue delta = chunk.choices[0] + # NOTE: For fix https://github.com/langgenius/dify/issues/5790 + if delta.delta is None: + continue + # extract tool calls from response self._update_tool_calls(tool_calls=tool_calls, tool_calls_response=delta.delta.tool_calls)