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

Class NodeInfo

visualize_mcts.py:12–30  ·  view source on GitHub ↗

节点信息

Source from the content-addressed store, hash-verified

10from typing import Dict, List, Set, 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, debug
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.is_buggy: bool = False
22 self.continue_improve: bool = False
23 self.improve_failure: Optional[int] = None # 记录失败次数
24 self.run_status: str = "unknown" # OK, FAIL, unknown
25
26 def __str__(self):
27 status_sym = "✓" if self.run_status == "OK" else "✗" if self.run_status == "FAIL" else "?"
28 metric_str = f" m:{self.metric:.4f}" if self.metric else ""
29 terminal_str = " [T]" if self.is_terminal else ""
30 return f"{status_sym} {self.stage[:1]}{self.id[:8]}{metric_str}{terminal_str}"
31
32
33def parse_log(log_file: str) -> Tuple[Dict[str, NodeInfo], str]:

Callers 1

parse_logFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected