feat: clarify workflow run history

This commit is contained in:
2026-06-13 13:28:40 +08:00
parent 70e3b1859a
commit d3837fc975
5 changed files with 100 additions and 0 deletions
@@ -570,12 +570,23 @@ async def list_workflow_runs(
def _build_run_list_item(run: AIWorkflowRun, workflow_name: str = "") -> dict:
execution_log = run.execution_log or []
last_log = next(
(log for log in reversed(execution_log) if isinstance(log, dict)),
{},
)
return {
"id": run.id,
"workflow_id": run.workflow_id,
"workflow_name": workflow_name,
"status": run.status or "pending",
"trigger_type": run.trigger_type or "api",
"inputs": run.inputs or {},
"outputs": run.outputs or {},
"current_node_id": run.current_node_id or "",
"last_node_id": last_log.get("node_id", ""),
"last_node_label": last_log.get("node_label", ""),
"last_node_type": last_log.get("node_type", ""),
"total_steps": run.total_steps or 0,
"total_tokens": run.total_tokens or 0,
"elapsed_time": run.elapsed_time or 0,