mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-06-04 11:14:10 +08:00
fix: extract tool calls correctly while arguments is empty (#6503)
This commit is contained in:
parent
f38034e455
commit
dfb6f4fec6
@ -342,10 +342,14 @@ class FunctionCallAgentRunner(BaseAgentRunner):
|
|||||||
"""
|
"""
|
||||||
tool_calls = []
|
tool_calls = []
|
||||||
for prompt_message in llm_result_chunk.delta.message.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((
|
tool_calls.append((
|
||||||
prompt_message.id,
|
prompt_message.id,
|
||||||
prompt_message.function.name,
|
prompt_message.function.name,
|
||||||
json.loads(prompt_message.function.arguments),
|
args,
|
||||||
))
|
))
|
||||||
|
|
||||||
return tool_calls
|
return tool_calls
|
||||||
@ -359,10 +363,14 @@ class FunctionCallAgentRunner(BaseAgentRunner):
|
|||||||
"""
|
"""
|
||||||
tool_calls = []
|
tool_calls = []
|
||||||
for prompt_message in llm_result.message.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((
|
tool_calls.append((
|
||||||
prompt_message.id,
|
prompt_message.id,
|
||||||
prompt_message.function.name,
|
prompt_message.function.name,
|
||||||
json.loads(prompt_message.function.arguments),
|
args,
|
||||||
))
|
))
|
||||||
|
|
||||||
return tool_calls
|
return tool_calls
|
||||||
|
Loading…
x
Reference in New Issue
Block a user