chore: use 'json_list' instead of 'json' to prevent ambiguity (#22739)

Co-authored-by: 刘江波 <jiangbo721@163.com>
This commit is contained in:
jiangbo721
2025-07-22 02:40:40 +08:00
committed by GitHub
parent 29f0a9ab94
commit e9893f1518

View File

@@ -486,7 +486,7 @@ class AgentNode(BaseNode):
text = "" text = ""
files: list[File] = [] files: list[File] = []
json: list[dict] = [] json_list: list[dict] = []
agent_logs: list[AgentLogEvent] = [] agent_logs: list[AgentLogEvent] = []
agent_execution_metadata: Mapping[WorkflowNodeExecutionMetadataKey, Any] = {} agent_execution_metadata: Mapping[WorkflowNodeExecutionMetadataKey, Any] = {}
@@ -564,7 +564,7 @@ class AgentNode(BaseNode):
if key in WorkflowNodeExecutionMetadataKey.__members__.values() if key in WorkflowNodeExecutionMetadataKey.__members__.values()
} }
if message.message.json_object is not None: if message.message.json_object is not None:
json.append(message.message.json_object) json_list.append(message.message.json_object)
elif message.type == ToolInvokeMessage.MessageType.LINK: elif message.type == ToolInvokeMessage.MessageType.LINK:
assert isinstance(message.message, ToolInvokeMessage.TextMessage) assert isinstance(message.message, ToolInvokeMessage.TextMessage)
stream_text = f"Link: {message.message.text}\n" stream_text = f"Link: {message.message.text}\n"
@@ -676,8 +676,8 @@ class AgentNode(BaseNode):
} }
) )
# Step 2: normalize JSON into {"data": [...]}.change json to list[dict] # Step 2: normalize JSON into {"data": [...]}.change json to list[dict]
if json: if json_list:
json_output.extend(json) json_output.extend(json_list)
else: else:
json_output.append({"data": []}) json_output.append({"data": []})