Create codex/visualizer.py
Browse files- codex/visualizer.py +16 -0
codex/visualizer.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def render_flow_svg(task, steps):
|
| 2 |
+
y = 40
|
| 3 |
+
nodes = ""
|
| 4 |
+
for step in steps:
|
| 5 |
+
nodes += f"""
|
| 6 |
+
<rect x="20" y="{y}" width="600" height="40" fill="#222" stroke="#00ffcc"/>
|
| 7 |
+
<text x="30" y="{y+25}" fill="white">{step}</text>
|
| 8 |
+
"""
|
| 9 |
+
y += 60
|
| 10 |
+
|
| 11 |
+
return f"""
|
| 12 |
+
<svg width="700" height="{y+20}">
|
| 13 |
+
<rect width="100%" height="100%" fill="#111"/>
|
| 14 |
+
{nodes}
|
| 15 |
+
</svg>
|
| 16 |
+
"""
|