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

Function print_tree_html

visualize_mcts_claude.py:224–330  ·  view source on GitHub ↗

生成 HTML 格式的可视化树

(nodes: Dict[str, NodeInfo], root_id: str, output_file: str = "mcts_tree_claude.html")

Source from the content-addressed store, hash-verified

222
223
224def print_tree_html(nodes: Dict[str, NodeInfo], root_id: str, output_file: str = "mcts_tree_claude.html"):
225 """
226 生成 HTML 格式的可视化树
227 """
228 html = """
229<!DOCTYPE html>
230<html>
231<head>
232 <meta charset="UTF-8">
233 <title>Claude Code MCTS Search Tree</title>
234 <style>
235 body {
236 font-family: 'Courier New', monospace;
237 margin: 20px;
238 background: #f5f5f5;
239 }
240 .container {
241 background: white;
242 padding: 20px;
243 border-radius: 8px;
244 box-shadow: 0 2px 4px rgba(0,0,0,0.1);
245 }
246 .tree {
247 margin-top: 20px;
248 }
249 .node {
250 margin: 2px 0;
251 padding: 4px 8px;
252 border-radius: 4px;
253 }
254 .root { background: #e3f2fd; }
255 .draft { background: #fff3e0; }
256 .improve { background: #e8f5e9; }
257 .success { color: #2e7d32; font-weight: bold; }
258 .failed { color: #c62828; font-weight: bold; }
259 .terminal { border: 2px solid #d32f2f; }
260 h1 { color: #1976d2; }
261 .legend {
262 background: #f5f5f5;
263 padding: 10px;
264 border-radius: 4px;
265 margin-bottom: 20px;
266 }
267 .best-node {
268 background: #90EE90;
269 font-weight: bold;
270 border: 2px solid #2e7d32;
271 }
272 </style>
273</head>
274<body>
275 <div class="container">
276 <h1>Claude Code MCTS Search Tree Visualization</h1>
277
278 <div class="legend">
279 <strong>Legend:</strong><br>
280 ✓=SUCCESS ✗=FAILED ?=unknown | [R/D/I]=root/draft/improve | m=metric | [T]=terminal | [FN]=failed N times
281 </div>

Callers 1

Calls 3

writeMethod · 0.80
dfs_htmlFunction · 0.70
valuesMethod · 0.45

Tested by

no test coverage detected