MCPcopy Create free account
hub / github.com/InternScience/InternAgent / NodeInfo

Class NodeInfo

visualize_mcts_claude.py:12–31  ·  view source on GitHub ↗

节点信息

Source from the content-addressed store, hash-verified

10from typing import Dict, List, Optional, Tuple
11
12class NodeInfo:
13 """节点信息"""
14 def __init__(self, node_id: str, stage: str, parent_id: Optional[str] = None):
15 self.id = node_id
16 self.stage = stage # root, draft, improve
17 self.parent_id = parent_id
18 self.children_ids: List[str] = []
19 self.metric: Optional[float] = None
20 self.is_terminal: bool = False
21 self.continue_improve: bool = False
22 self.improve_failure_depth: int = 0 # 改进失败次数
23 self.run_status: str = "unknown" # SUCCESS, FAILED, unknown
24
25 def __str__(self):
26 status_sym = "✓" if self.run_status == "SUCCESS" else "✗" if self.run_status == "FAILED" else "?"
27 metric_str = f" m:{self.metric:.4f}" if self.metric else ""
28 terminal_str = " [T]" if self.is_terminal else ""
29 improve_fail_str = f" [F{self.improve_failure_depth}]" if self.improve_failure_depth > 0 else ""
30 stage_abbrev = {"root": "R", "draft": "D", "improve": "I"}.get(self.stage, self.stage[:1])
31 return f"{status_sym} {stage_abbrev}-{self.id[:8]}{metric_str}{improve_fail_str}{terminal_str}"
32
33
34def parse_log_claude(log_file: str) -> Tuple[Dict[str, NodeInfo], str]:

Callers 1

parse_log_claudeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected