Fix recipe steps display and DAG visualization

- Check multiple locations for nodes: dag.nodes, recipe.nodes, pipeline, steps
- Add dagre layout libraries for cytoscape DAG visualization
- Fix inputs parsing when stored as JSON string in Redis

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-11 20:21:24 +00:00
parent 209d416442
commit a6dd470623
4 changed files with 19 additions and 1 deletions

View File

@@ -155,10 +155,18 @@ async def get_recipe(
"output": "#f59e0b",
}
# Get nodes from dag - can be list or dict
# Get nodes from dag - can be list or dict, can be under "dag" or directly on recipe
dag = recipe.get("dag", {})
nodes = dag.get("nodes", [])
# Also check for nodes directly on recipe (alternative formats)
if not nodes:
nodes = recipe.get("nodes", [])
if not nodes:
nodes = recipe.get("pipeline", [])
if not nodes:
nodes = recipe.get("steps", [])
# Convert list of nodes to steps format
if isinstance(nodes, list):
for node in nodes:

View File

@@ -114,6 +114,12 @@ class RunService:
task_actor_id = parsed.get("actor_id")
task_recipe = parsed.get("recipe")
task_inputs = parsed.get("inputs")
# Ensure inputs is a list (might be JSON string)
if isinstance(task_inputs, str):
try:
task_inputs = json.loads(task_inputs)
except json.JSONDecodeError:
task_inputs = None
task_output_name = parsed.get("output_name")
task_created_at = parsed.get("created_at")
except json.JSONDecodeError:

View File

@@ -5,6 +5,8 @@
{% block head %}
{{ super() }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.23.0/cytoscape.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dagre/0.8.5/dagre.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/cytoscape-dagre@2.5.0/cytoscape-dagre.min.js"></script>
{% endblock %}
{% block content %}

View File

@@ -5,6 +5,8 @@
{% block head %}
{{ super() }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.23.0/cytoscape.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dagre/0.8.5/dagre.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/cytoscape-dagre@2.5.0/cytoscape-dagre.min.js"></script>
{% endblock %}
{% block content %}