From fbac28bc7e6e24342ed63bc7b3637b8dacb2068c Mon Sep 17 00:00:00 2001 From: sinohqb Date: Wed, 29 Jul 2026 14:34:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20always=20show=20trigger=20sou?= =?UTF-8?q?rce=20labels=20(=E6=89=8B=E5=8A=A8/AI=20=E5=8A=A9=E6=89=8B/CLI)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 运行列表、报告页运行下拉、仪表盘最近评测行不再隐藏手动标签; 报告头与对比 A/B 卡片新增"触发方式"(报告 payload 补 triggered_by)。 --- backend/agenteval/evaluation/report.py | 3 +++ frontend/web/src/components/RunList.tsx | 2 +- frontend/web/src/pages/Home.tsx | 8 +++---- frontend/web/src/pages/Reports.tsx | 28 ++++++++++++++++++------- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/backend/agenteval/evaluation/report.py b/backend/agenteval/evaluation/report.py index ebab83e..1351285 100644 --- a/backend/agenteval/evaluation/report.py +++ b/backend/agenteval/evaluation/report.py @@ -173,6 +173,7 @@ def generate_report(run_id: str, session=None) -> dict[str, Any]: "scenario_id": run.scenario_id, "scenario_name": scenario.name if scenario else "未知", "scenario_version": run.scenario_version, + "triggered_by": run.triggered_by.value, "status": run.status.value, "started_at": iso_utc(run.started_at), "completed_at": iso_utc(run.completed_at), @@ -249,6 +250,7 @@ def generate_compare_report(run_id_1: str, run_id_2: str, session=None) -> dict[ "target_name": report_a.get("target_name"), "scenario_name": report_a.get("scenario_name"), "scenario_version": report_a.get("scenario_version"), + "triggered_by": report_a.get("triggered_by"), "status": report_a.get("status"), "started_at": report_a.get("started_at"), "summary": report_a["summary"], @@ -258,6 +260,7 @@ def generate_compare_report(run_id_1: str, run_id_2: str, session=None) -> dict[ "target_name": report_b.get("target_name"), "scenario_name": report_b.get("scenario_name"), "scenario_version": report_b.get("scenario_version"), + "triggered_by": report_b.get("triggered_by"), "status": report_b.get("status"), "started_at": report_b.get("started_at"), "summary": report_b["summary"], diff --git a/frontend/web/src/components/RunList.tsx b/frontend/web/src/components/RunList.tsx index df09596..61787b6 100644 --- a/frontend/web/src/components/RunList.tsx +++ b/frontend/web/src/components/RunList.tsx @@ -299,7 +299,7 @@ function RunRow({ r, selected, targetName, scenarioName, onSelect, onOpenReport, )} - {r.triggered_by && r.triggered_by !== 'manual' && ( + {r.triggered_by && ( void }) { v{run.scenario_version} )} - {trigger !== 'manual' && ( - - {triggerLabels[trigger] ?? trigger} - - )} + + {triggerLabels[trigger] ?? trigger} + {statusLabels[run.status] ?? run.status} = 0.8 ? '#3f8600' : '#cf1322', fontSize: 12, fontWeight: 600, }}>{pct} - {trigger !== 'manual' && ( - - {triggerLabels[trigger] ?? trigger} - - )} + + {triggerLabels[trigger] ?? trigger} + ), } @@ -404,6 +403,11 @@ function SingleReportView({ report }: { report: Report | null }) { {report.scenario_version != null && v{report.scenario_version}} + + + {triggerLabels[report.triggered_by as keyof typeof triggerLabels] ?? report.triggered_by ?? '手动'} + + {formatDateTime(report.started_at)} {report.completed_at ? formatDateTime(report.completed_at) : '-'} @@ -502,6 +506,11 @@ function CompareView({ result }: { result: CompareResult | null }) { {run_a.scenario_name} {run_a.scenario_version != null && v{run_a.scenario_version}} + + + {triggerLabels[run_a.triggered_by as keyof typeof triggerLabels] ?? run_a.triggered_by ?? '手动'} + + {formatDateTime(run_a.started_at)} {(run_a.summary.pass_rate * 100).toFixed(1)}% {run_a.summary.passed_cases}/{run_a.summary.total_cases} @@ -523,6 +532,11 @@ function CompareView({ result }: { result: CompareResult | null }) { {run_b.scenario_name} {run_b.scenario_version != null && v{run_b.scenario_version}} + + + {triggerLabels[run_b.triggered_by as keyof typeof triggerLabels] ?? run_b.triggered_by ?? '手动'} + + {formatDateTime(run_b.started_at)} {(run_b.summary.pass_rate * 100).toFixed(1)}% {run_b.summary.passed_cases}/{run_b.summary.total_cases}