"""Action run routes. Moved from app.admin_dashboard in v4.7.2. The handlers still reuse legacy helpers to keep this refactor behavior-preserving. """ from fastapi import APIRouter import app.admin_dashboard as legacy from app.admin_dashboard import * # noqa: F401,F403 router = APIRouter() @router.get("/runs", response_class=HTMLResponse) async def runs_page(limit: int = 100): runs = list_action_runs(limit=limit) rows = "" for run in runs: decision = run.get("action_decision") or {} result = run.get("action_result") or {} rows += f""" {esc(run["created_at"])} #{esc(run.get("conversation_id"))} {esc(run.get("decision_source"))} {esc(decision.get("action_code"))} {esc(result.get("route"))} {esc(run.get("provider"))} {esc(run.get("total_tokens"))} {esc(run.get("cost"))} {status_badge("failed" if run.get("needs_review") else "sent")} """ body = f""" {rows}
Criado Conversa Fonte Ação Rota Provider Tokens Custo Review
""" return layout("Action Runs", "Histórico de decisões do Action Core.", body, "runs")