## Webhook 通知(S3-1)
- settings.py: 增加 AGENTEVAL_WEBHOOK_URL / AGENTEVAL_WEBHOOK_SECRET
- utils/webhook.py: send_run_webhook(),非阻断,任何异常仅 warning log
- runs.py: run 完成后自动触发 webhook(payload 含 run_id/status/summary/report_url)
- .env.example: 新增 webhook 配置示例
## OpenClaw Skill HTTP 改造(S3-2)
- plugins/openclaw/agenteval_skill.py: 完全重写
- 改用 HTTP API(POST /api/runs + GET /api/runs/{id} 轮询 + GET /api/reports/{id})
- 移除 subprocess + CLI 依赖
- 轮询等待至 completed/failed,支持配置 poll_interval / timeout
- 返回结构化中文摘要(summary_text),直接可用于 OpenClaw 对话展示
## Markdown 报告导出(S3-3)
- report.py: render_markdown_report() — 完整的 Markdown 表格 + 对话展示
- save_report: 支持 fmt="markdown",输出 .md 文件
- reports.py: GET /api/reports/{run_id}/markdown,Content-Disposition 附件下载
- api.ts: reportsApi.markdownUrl()
- Reports.tsx: 「导出 MD」按钮
## 对比报告(S3-4)
- report.py: generate_compare_report(run_id_1, run_id_2)
- run_a / run_b 汇总 + delta(pass_rate / passed_cases / passed_rules)
- case-level diff,标记 changed 用例
- reports.py: GET /api/reports/compare?run1=&run2=
- api.ts: reportsApi.compare()
- Reports.tsx: 完整对比视图
- Segmented 切换「单次报告」/「对比报告」
- 双 Select(报告 A vs B)+ 对比按钮
- 汇总 delta card(pass_rate 变化 + 变化用例数徽章)
- 用例对比表(通过/失败/改善↑/退步↓)+ 展开规则明细
Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Webhook notification for run completion events."""
|
|
|
|
import logging
|
|
from typing import Any
|
|
|
|
import httpx
|
|
|
|
from agenteval.config import get_settings
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
async def send_run_webhook(run_id: str, status: str, summary: dict[str, Any]) -> None:
|
|
"""POST run completion payload to the configured webhook URL.
|
|
|
|
Silently logs and returns on any error — webhook failure must never
|
|
affect the run itself.
|
|
"""
|
|
settings = get_settings()
|
|
if not settings.webhook_url:
|
|
return
|
|
|
|
payload = {
|
|
"event": "run_completed",
|
|
"run_id": run_id,
|
|
"status": status,
|
|
"summary": summary,
|
|
"report_url": f"/api/reports/{run_id}",
|
|
}
|
|
|
|
headers = {"Content-Type": "application/json"}
|
|
if settings.webhook_secret:
|
|
headers["X-Webhook-Secret"] = settings.webhook_secret
|
|
|
|
try:
|
|
async with httpx.AsyncClient(timeout=10) as client:
|
|
resp = await client.post(settings.webhook_url, json=payload, headers=headers)
|
|
logger.info("webhook sent: run=%s status=%s http=%d", run_id, status, resp.status_code)
|
|
except Exception as exc:
|
|
logger.warning("webhook failed (non-fatal): run=%s error=%s", run_id, exc)
|