Spaces:
Paused
Paused
| def generate_mermaid_diagram(path: list) -> str: | |
| """Generates Mermaid.js syntax for the execution path.""" | |
| if not path: | |
| return "" | |
| diagram = "graph TD;\n" | |
| # Replace spaces with underscores for valid Mermaid node names | |
| path_nodes = [p.replace(' ', '_') for p in path] | |
| for i in range(len(path_nodes) - 1): | |
| diagram += f" {path_nodes[i]} --> {path_nodes[i+1]};\n" | |
| return diagram |