a3bb78e06b
Security Quality Gate / npm audit, Bandit, pip-audit, detect-secrets (pull_request) Failing after 16m35s
75 lines
3.5 KiB
Markdown
75 lines
3.5 KiB
Markdown
# V2 AI 质量改进项执行记录闭环 - 2026-06-23
|
|
|
|
## 本轮目标
|
|
|
|
按照《AI 合同平台 V2 重构版开发方案》的边界继续推进:AI 中台负责模型参数、Prompt、知识库索引和 AI 审计闭环;合同系统只负责管理后台展示和业务入口。本轮把“执行动作”挂回质量改进项详情页,让管理员能从一个质量问题直接看到对应的模型参数发布记录、Prompt 发布记录、知识库重建索引记录,并查看执行后的 Trace 质量变化。
|
|
|
|
## 已完成内容
|
|
|
|
1. AI Platform 执行记录能力
|
|
- 新增 Prompt 发布记录模型 `PromptTemplateChange`。
|
|
- 新增知识库重建索引记录模型 `KnowledgeReindexExecution`。
|
|
- 新增聚合返回模型 `AiQualityImprovementExecutionBundle`。
|
|
- 新增 `GET /api/v1/audit/quality-improvement-actions/{action_id}/executions`。
|
|
- `POST /api/v1/prompt-templates/{name}/publish` 支持 `changed_by`、`change_note`。
|
|
- `POST /api/v1/knowledge-documents/reindex` 支持 `triggered_by`、`execution_note`。
|
|
|
|
2. 数据库闭环
|
|
- 新增迁移 `20260623_0010_add_prompt_and_reindex_execution_records.py`。
|
|
- 新增表 `prompt_template_changes`。
|
|
- 新增表 `knowledge_reindex_executions`。
|
|
- SQLAlchemy 仓库和内存仓库均支持执行记录写入、查询和按质量改进项聚合。
|
|
|
|
3. OpenAPI 与 Python SDK
|
|
- OpenAPI 同步新增执行记录接口和 schema。
|
|
- Python SDK 新增:
|
|
- `PromptTemplateChange`
|
|
- `KnowledgeReindexExecution`
|
|
- `AiQualityImprovementExecutionBundle`
|
|
- `get_quality_improvement_action_executions(action_id)`
|
|
- SDK 请求模型同步支持执行人和说明字段。
|
|
|
|
4. 合同系统后台
|
|
- 新增同源代理:
|
|
- `/api/ai-platform/audit/quality-improvement-actions/[actionId]/executions`
|
|
- 质量改进项详情页新增 `Execution records` 区块:
|
|
- Model config publishes
|
|
- Prompt publishes
|
|
- Knowledge reindex
|
|
- 同页显示执行后质量回看指标:
|
|
- Post-change traces
|
|
- Post-change issue rate
|
|
- Quality score delta
|
|
- Source traces
|
|
|
|
## 当前闭环价值
|
|
|
|
现在质量运营链路变成:
|
|
|
|
1. AI Trace 或质量看板发现问题。
|
|
2. 管理员创建质量改进项。
|
|
3. 管理员执行模型参数调整、Prompt 发布、知识库重建索引。
|
|
4. 执行动作自动写入 AI 中台审计表。
|
|
5. 管理员回到质量改进项详情页,能直接看到执行记录和后续 Trace 质量变化。
|
|
|
|
这让“发现问题 -> 执行动作 -> 效果回看”真正形成闭环,而不是停留在人工备注。
|
|
|
|
## 验证结果
|
|
|
|
- `python -m py_compile yuqei-ai-platform\services\ai-platform-api\src\yuqei_ai_platform_api\repository.py yuqei-ai-platform\services\ai-platform-api\src\yuqei_ai_platform_api\main.py yuqei-ai-platform\services\ai-platform-api\src\yuqei_ai_platform_api\models.py yuqei-ai-sdk-python\src\yuqei_sdk\ai_platform.py`
|
|
- `python -m pytest yuqei-ai-platform\services\ai-platform-api\tests\test_platform_data.py -q`
|
|
- 16 passed
|
|
- `python -m pytest yuqei-ai-sdk-python\tests\test_ai_platform.py -q`
|
|
- 2 passed
|
|
- `npm --prefix yuqei-contract-platform/apps/contract-web run build`
|
|
- passed
|
|
|
|
## 下一步建议
|
|
|
|
继续沿 V2 方案推进“配置执行动作自动化”:
|
|
|
|
- 从质量改进项详情页直接发起 Prompt 草稿创建/发布。
|
|
- 从质量改进项详情页直接进入知识库导入批次并上传真实文件。
|
|
- 模型参数发布增加版本对比和回滚入口。
|
|
- 将执行动作与后续 Trace 自动按时间窗口关联,形成更精确的改善率统计。
|