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.

Fixes issue 21157/20661 extra quote in agent node (#21674)

Han69b6f6f5d2d9
diff --git a/api/core/workflow/nodes/agent/agent_node.py b/api/core/workflow/nodes/agent/agent_node.py
index 2f28363955a..987f670acbe 100644
--- a/api/core/workflow/nodes/agent/agent_node.py
+++ b/api/core/workflow/nodes/agent/agent_node.py
@@ -158,7 +158,10 @@ class AgentNode(ToolNode):
# variable_pool.convert_template expects a string template,
# but if passing a dict, convert to JSON string first before rendering
try:
- parameter_value = json.dumps(agent_input.value, ensure_ascii=False)
+ if not isinstance(agent_input.value, str):
+ parameter_value = json.dumps(agent_input.value, ensure_ascii=False)
+ else:
+ parameter_value = str(agent_input.value)
except TypeError:
parameter_value = str(agent_input.value)
segment_group = variable_pool.convert_template(parameter_value)
@@ -166,7 +169,8 @@ class AgentNode(ToolNode):
# variable_pool.convert_template returns a string,
# so we need to convert it back to a dictionary
try:
- parameter_value = json.loads(parameter_value)
+ if not isinstance(agent_input.value, str):
+ parameter_value = json.loads(parameter_value)
except json.JSONDecodeError:
parameter_value = parameter_value
else: