Forráskód Böngészése

fix: incorrect use of node execution id

Yeuoly 7 hónapja%!(EXTRA string=óta)
szülő
commit
63206a7967

+ 4 - 4
api/core/app/task_pipeline/workflow_cycle_manage.py

@@ -287,12 +287,12 @@ class WorkflowCycleManage:
         process_data = WorkflowEntry.handle_special_values(event.process_data)
         outputs = WorkflowEntry.handle_special_values(event.outputs)
         execution_metadata_dict = event.execution_metadata
-        if self._wip_workflow_agent_logs.get(event.node_execution_id):
+        if self._wip_workflow_agent_logs.get(workflow_node_execution.id):
             if not execution_metadata_dict:
                 execution_metadata_dict = {}
 
             execution_metadata_dict[NodeRunMetadataKey.AGENT_LOG] = self._wip_workflow_agent_logs.get(
-                event.node_execution_id, []
+                workflow_node_execution.id, []
             )
 
         execution_metadata = json.dumps(jsonable_encoder(execution_metadata_dict)) if execution_metadata_dict else None
@@ -343,12 +343,12 @@ class WorkflowCycleManage:
         finished_at = datetime.now(UTC).replace(tzinfo=None)
         elapsed_time = (finished_at - event.start_at).total_seconds()
         execution_metadata_dict = event.execution_metadata
-        if self._wip_workflow_agent_logs.get(event.node_execution_id):
+        if self._wip_workflow_agent_logs.get(workflow_node_execution.id):
             if not execution_metadata_dict:
                 execution_metadata_dict = {}
 
             execution_metadata_dict[NodeRunMetadataKey.AGENT_LOG] = self._wip_workflow_agent_logs.get(
-                event.node_execution_id, []
+                workflow_node_execution.id, []
             )
 
         execution_metadata = json.dumps(jsonable_encoder(execution_metadata_dict)) if execution_metadata_dict else None

+ 10 - 11
api/core/workflow/nodes/tool/tool_node.py

@@ -56,17 +56,6 @@ class ToolNode(BaseNode[ToolNodeData]):
             "plugin_unique_identifier": node_data.plugin_unique_identifier,
         }
 
-        yield AgentLogEvent(
-            id=self.node_id,
-            node_execution_id=self.id,
-            parent_id=None,
-            error=None,
-            status="running",
-            data={
-                "tool_info": tool_info,
-            },
-        )
-
         # get tool runtime
         try:
             tool_runtime = ToolManager.get_workflow_tool_runtime(
@@ -289,6 +278,16 @@ class ToolNode(BaseNode[ToolNodeData]):
             elif message.type == ToolInvokeMessage.MessageType.FILE:
                 assert message.meta is not None
                 files.append(message.meta["file"])
+            elif message.type == ToolInvokeMessage.MessageType.LOG:
+                assert isinstance(message.message, ToolInvokeMessage.LogMessage)
+                yield AgentLogEvent(
+                    id=message.message.id,
+                    node_execution_id=self.id,
+                    parent_id=message.message.parent_id,
+                    error=message.message.error,
+                    status=message.message.status.value,
+                    data=message.message.data,
+                )
 
         yield RunCompletedEvent(
             run_result=NodeRunResult(