AgentEvalTool/.scratch/v0.8/issues/02-comparison-narrative-agent-and-api.md
sinohqb 1e55a21649 feat(comparison): v0.8 周期对比 — 计划指纹自动基线配对、机械指标 diff 与 LLM 演进叙述
正式线活动分析完成后自动链式生成对比;报告抽屉新增「周期对比」区块
(趋势徽章、指标 delta 表、问题演变、建议追踪,无自动基线时手动选择)。
版本号升至 0.8.0。
2026-08-03 13:32:48 +08:00

14 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 02 — 对比叙述生成(表 + Agent + POST
**What to build:** 周期对比的 LLM 半边与完整生命周期。新表 `campaign_period_comparisons`(当前活动 id 唯一 upsert、baseline_campaign_id、generating/completed/failed、result JSON、model_config_id 快照、error、triggered_by、时间戳+ 迁移。单次 LLM 调用编排:输入两期分析 JSON + 机械 diff复用 `resolve_analysis_model` 与 ChatClient 注入 seam输出 schema 见 spectrend/summary/problem_evolution/suggestion_trackingscenario_ids 白名单剔除非法枚举归一trend→stable、演化→persisting、建议→unaddressed解析失败落 failed。`POST /api/campaigns/{id}/comparison`:非终态 400本期无 completed 分析 400body 可带 `baseline_campaign_id`(缺省走自动基线,仍无 → 400 引导;手动基线须有 completed 分析);无模型 400 引导;成功 → 后台任务 + `{"status": "generating"}`。GET 扩展合并:状态行字段 + 机械 diff + 叙述 + 基线信息。
**Blocked by:** 01GET 与配对复用)
**Status:** done
- [x] 迁移:`campaign_period_comparisons` 表campaign_id 唯一约束)+ 迁移测试
- [x] 仓储 upsert / get_by_campaign
- [x] 编排FakeChatClient 断言输入含两期分析与 diff解析失败→failed白名单剔除虚构 scenario_ids非法枚举归一
- [x] POST 各 400 分支 + 成功分支 + 重跑 upsert 不新增行GET 合并返回
- [x] `pytest` + `ruff` 全绿