## T1: P0 测试补全(+67 个测试)
- test_utils_llm.py: extract_reply_text / extract_content_from_llm_response / parse_json_from_llm_text 各边界
- test_file_repository.py: 分类 CRUD / 树形结构 / 级联删除 / 文件创建/查询/删除/物理文件清理
- test_report.py: generate_report / generate_compare_report / render_markdown / render_json
- test_llm_score.py: OpenAI 格式 / Anthropic content-block 格式 / JSON 回退解析 / 异常降级
## T2: P1 测试补全(+28 个测试)
- test_scenarios.py: 模板列表/字段完整性/规则类型有效性 + YAML/JSON 加载/校验
- test_webhook.py: 未配置不发送 / 正确 payload / secret header / 异常静默忽略
- test_reports_api.py: GET /reports/{id} / /html / /json / /markdown / /compare 集成测试
## UTC 时区根本修复
- storage/db.py: 新增 iso_utc() 函数,确保所有 datetime 序列化输出带 Z 后缀
- runs.py / files.py / report.py: 6 处 .isoformat() → iso_utc()
- 前端 toDate() 兜底仍保留(向下兼容),但后端不再输出无时区时间戳
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| agenteval_skill.py | ||
| README.md | ||
OpenClaw 插件 for AgentEvalTool
本目录提供 OpenClaw 调用 AgentEvalTool 的示例技能,使 OpenClaw 能够自闭环完成评测策略设计。
设计原则
- AgentEvalTool 作为独立的 CLI 工具集存在,负责:
- 评测对象管理
- 评测场景管理
- 评测执行与原始数据收集
- 评估分析与报告生成
- OpenClaw 通过本插件调用
agentevalCLI,负责:- 评测策略编排(选择对象、场景、触发时机)
- 定时调度(OpenClaw 自身的 cron + skill 机制)
- 结果通知与后续动作
前置条件
- 已安装 AgentEvalTool CLI:
pip install -e /path/to/AgentEvalTool agenteval命令已在 PATH 中可用。- 已通过
agenteval target add注册评测对象。 - 已通过
agenteval scenario import导入评测场景。
接入方式
方式一:直接调用 CLI(推荐)
在 OpenClaw Skill 中直接调用系统命令:
import subprocess
# 触发评测
subprocess.run([
"agenteval", "run", "start",
"--target-id", "<target-id>",
"--scenario-id", "<scenario-id>",
], check=True)
# 获取报告(需要在运行输出中解析 run_id)
report = subprocess.check_output([
"agenteval", "report", "show", "<run-id>", "--format", "json",
])
方式二:使用本目录封装的 Skill
参考 agenteval_skill.py,在 OpenClaw 中注册技能时传入配置:
{
"target_id": "<target-id>",
"scenario_id": "<scenario-id>",
"report_format": "json"
}
OpenClaw 定时评测示例
OpenClaw 的 cron 配置(具体格式以 OpenClaw 平台为准):
skill: agenteval_skill
schedule: "0 9 * * *" # 每天早上 9 点执行
config:
target_id: "<target-id>"
scenario_id: "<scenario-id>"
report_format: "json"
CLI 返回的 run_id 解析
agenteval run start 成功后会输出:
评测完成: run_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, status=completed
OpenClaw Skill 需要从 stdout 中提取 run_id,然后调用 agenteval report show <run_id> 获取报告。
扩展建议
- 可以在 OpenClaw Skill 中根据报告结果触发告警、创建工单或通知相关人员。
- 可以将报告推送到企业微信、钉钉、邮件等通道。