SPOC_V1 / utils.py
JatsTheAIGen's picture
Upload autonomous lab application
906d397
raw
history blame
439 Bytes
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