浏览代码

fix: tongyi empty tool_calls is not supported in message (#6719)

Joe 9 月之前
父节点
当前提交
e4542215cc
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      api/core/model_runtime/model_providers/tongyi/llm/llm.py

+ 1 - 2
api/core/model_runtime/model_providers/tongyi/llm/llm.py

@@ -501,8 +501,7 @@ You should also complete the text started with ``` but not tell ``` directly.
                     'role': 'assistant',
                     'content': content if not rich_content else [{"text": content}],
                     'tool_calls': [tool_call.model_dump() for tool_call in
-                                   prompt_message.tool_calls] if prompt_message.tool_calls else []
-
+                                   prompt_message.tool_calls] if prompt_message.tool_calls else None
                 })
             elif isinstance(prompt_message, ToolPromptMessage):
                 tongyi_messages.append({