From eef0ee5f5c8a056eaca551789785e54931036e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E4=BF=8A=E7=94=B7?= Date: Tue, 13 Jan 2026 18:00:45 +0800 Subject: [PATCH] feat(workflow tool node): Change the data output variable of the tool node to a string --- api/app/core/workflow/nodes/tool/node.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/app/core/workflow/nodes/tool/node.py b/api/app/core/workflow/nodes/tool/node.py index 883df01a..496812a6 100644 --- a/api/app/core/workflow/nodes/tool/node.py +++ b/api/app/core/workflow/nodes/tool/node.py @@ -71,16 +71,14 @@ class ToolNode(BaseNode): if result.success: logger.info(f"节点 {self.node_id} 工具执行成功") return { - "text": json.dumps(result.data, ensure_ascii=False), - "data": result.data, + "data": result.data if isinstance(result.data, str) else json.dumps(result.data, ensure_ascii=False), "error_code": "", "execution_time": result.execution_time } else: logger.error(f"节点 {self.node_id} 工具执行失败: {result.error}") return { - "text": json.dumps(result.error, ensure_ascii=False), - "data": result.error, + "data": result.error if isinstance(result.error, str) else json.dumps(result.error, ensure_ascii=False), "error_code": result.error_code, "execution_time": result.execution_time } \ No newline at end of file