MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / _process_result

Method _process_result

workflow/graph.py:657–687  ·  view source on GitHub ↗

Process a single input result using strategy pattern executors. This method delegates to specific node executors based on node type. Returns a list of messages (maybe empty if node suppresses output).

(self, node: Node, input_payload: List[Message])

Source from the content-addressed store, hash-verified

655 self._process_edge_output(pseudo_link, output_msg, node)
656
657 def _process_result(self, node: Node, input_payload: List[Message]) -> List[Message]:
658 """Process a single input result using strategy pattern executors.
659
660 This method delegates to specific node executors based on node type.
661 Returns a list of messages (maybe empty if node suppresses output).
662 """
663 if not self.node_executors:
664 raise RuntimeError("Node executors not initialized. Call _build_memories_and_thinking() first.")
665
666 if node.type not in self.node_executors:
667 raise ValueError(f"Unsupported node type: {node.type}")
668
669 executor = self.node_executors[node.type]
670 hook = self.runtime_context.workspace_hook
671 workspace = self.runtime_context.code_workspace
672 if hook:
673 try:
674 hook.before_node(node, workspace)
675 except Exception:
676 self.log_manager.warning("workspace hook before_node failed for %s", node.id)
677 success = False
678 try:
679 result = executor.execute(node, input_payload)
680 success = True
681 return result
682 finally:
683 if hook:
684 try:
685 hook.after_node(node, workspace, success=success)
686 except Exception:
687 self.log_manager.warning("workspace hook after_node failed for %s", node.id)
688
689
690 def _collect_all_outputs(self) -> None:

Callers 2

node_executor_funcMethod · 0.95
_execute_nodeMethod · 0.95

Calls 4

before_nodeMethod · 0.80
after_nodeMethod · 0.80
warningMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected