Introduce ModelPurpose.ANALYSIS and a globally-unique is_analysis_default marker on chat model configs so campaign analysis can resolve its model. Service rejects disabled or non-chat configs; repo clears the previous holder on set. Documented the analysis role in CONTEXT.md.
15 lines
1.1 KiB
Markdown
15 lines
1.1 KiB
Markdown
# 02 — 活动级分析模型覆盖
|
||
|
||
**What to build:** 创建评估活动时,表单左列「时间与速度」区新增「分析模型」下拉(选项 = 启用中的 chat 配置,默认项「全局默认(当前默认配置名)」),不选则跟随全局默认。后端 `campaigns` 表加可空 `analysis_model_config_id` 列(迁移),创建 API 接受该字段并校验引用的配置存在(不存在 400),活动详情/列表响应透出该字段。
|
||
|
||
**Blocked by:** 01(「全局默认」语义与下拉数据来自 01 的分析默认标记)
|
||
|
||
**Status:** ready-for-agent
|
||
|
||
- [ ] Alembic 迁移:`campaigns` 加可空 `analysis_model_config_id` 列
|
||
- [ ] `POST /api/campaigns` 接受 `analysis_model_config_id`(可空);引用不存在的配置返回 400
|
||
- [ ] 活动响应模型透出 `analysis_model_config_id`
|
||
- [ ] 创建表单加「分析模型」下拉:默认「全局默认(<名称>)」,选项为启用的 chat 配置;无全局默认时默认项提示「未配置」
|
||
- [ ] 集成测试:带覆盖创建、不带覆盖创建(存 NULL)、无效 id 400
|
||
- [ ] `pytest` + `ruff` + `npx tsc --noEmit` + `npm run build` 全绿
|