Fixes issue 21157/20661 extra quote in agent node (#21674)
Co-authored-by: Wang Han <wanghan@zhejianglab.org>
This commit is contained in:
parent
6013d90426
commit
69b6f6f5d2
1 changed files with 6 additions and 2 deletions
|
|
@ -158,7 +158,10 @@ class AgentNode(ToolNode):
|
||||||
# variable_pool.convert_template expects a string template,
|
# variable_pool.convert_template expects a string template,
|
||||||
# but if passing a dict, convert to JSON string first before rendering
|
# but if passing a dict, convert to JSON string first before rendering
|
||||||
try:
|
try:
|
||||||
|
if not isinstance(agent_input.value, str):
|
||||||
parameter_value = json.dumps(agent_input.value, ensure_ascii=False)
|
parameter_value = json.dumps(agent_input.value, ensure_ascii=False)
|
||||||
|
else:
|
||||||
|
parameter_value = str(agent_input.value)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
parameter_value = str(agent_input.value)
|
parameter_value = str(agent_input.value)
|
||||||
segment_group = variable_pool.convert_template(parameter_value)
|
segment_group = variable_pool.convert_template(parameter_value)
|
||||||
|
|
@ -166,6 +169,7 @@ class AgentNode(ToolNode):
|
||||||
# variable_pool.convert_template returns a string,
|
# variable_pool.convert_template returns a string,
|
||||||
# so we need to convert it back to a dictionary
|
# so we need to convert it back to a dictionary
|
||||||
try:
|
try:
|
||||||
|
if not isinstance(agent_input.value, str):
|
||||||
parameter_value = json.loads(parameter_value)
|
parameter_value = json.loads(parameter_value)
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
parameter_value = parameter_value
|
parameter_value = parameter_value
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue