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: extract tool calls correctly while arguments is empty (#6503)

sinodfb6f4fec6f6
diff --git a/api/core/agent/fc_agent_runner.py b/api/core/agent/fc_agent_runner.py
index bec76e7a246..7019b5e39fd 100644
--- a/api/core/agent/fc_agent_runner.py
+++ b/api/core/agent/fc_agent_runner.py
@@ -342,10 +342,14 @@ class FunctionCallAgentRunner(BaseAgentRunner):
"""
tool_calls = []
for prompt_message in llm_result_chunk.delta.message.tool_calls:
+ args = {}
+ if prompt_message.function.arguments != '':
+ args = json.loads(prompt_message.function.arguments)
+
tool_calls.append((
prompt_message.id,
prompt_message.function.name,
- json.loads(prompt_message.function.arguments),
+ args,
))
return tool_calls
@@ -359,10 +363,14 @@ class FunctionCallAgentRunner(BaseAgentRunner):
"""
tool_calls = []
for prompt_message in llm_result.message.tool_calls:
+ args = {}
+ if prompt_message.function.arguments != '':
+ args = json.loads(prompt_message.function.arguments)
+
tool_calls.append((
prompt_message.id,
prompt_message.function.name,
- json.loads(prompt_message.function.arguments),
+ args,
))
return tool_calls