refactor: separate provider capability policy

This commit is contained in:
2026-04-18 13:37:59 +08:00
parent 0444b81df6
commit 7b8e7c9944
11 changed files with 393 additions and 88 deletions

View File

@@ -53,7 +53,7 @@
- 已新增数据库迁移:
- `0009_add_story_generation_statuses.py`
- `0010_add_story_audio_cache_path.py`
- 已完成一轮后端回归验证:`backend/``pytest -q` 结果为 `66 passed`
- 已完成一轮后端回归验证:`backend/``pytest -q` 结果为 `71 passed`
- 已完成全量后端 lint 清理:`ruff check app tests` 可通过
- 已修复 admin-frontend 构建阻塞,主前端与管理端前端均可生产构建
- 已落地首版统一资产重试入口:`POST /api/stories/{story_id}/assets/retry`
@@ -70,6 +70,11 @@
- 绘本缺失插图补全
- 故事音频缓存读取与 TTS 生成
- 已引入首版服务层 `AssetCompletionResult`,用于统一表达资产补全结果
- 已完成 Provider 分层首版落地:
- 新增 `provider_policy.py`,定义 Capability / Routing Policy / 默认 Provider 顺序
- Provider Router 专注运行时 failover、熔断、成本和指标记录
- 新增 `/admin/providers/capabilities` 展示能力分层
- 新增 `docs/technical/provider-routing.md` 作为术语表和分层说明
### What Is In Progress
@@ -79,7 +84,6 @@
### What Is Still Pending
- Provider 的 Capability / Provider / Routing Policy 边界整理
- Week 2 可直接执行的开发任务表
- 演示 checklist 与最终收尾策略
@@ -178,7 +182,7 @@
- [ ] 明确 admin-frontend 的处理方案
- [x] 明确 Storybook 恢复方案
- [ ] 明确 Provider 重构边界
- [x] 明确 Provider 重构边界
---
@@ -191,7 +195,7 @@
| W1-03 | Product / System | 盘点现有生成路径:普通故事、完整生成、绘本生成 | 现状流程图或对照表 | P0 | 0.5d | Done |
| W1-04 | Product / System | 定义统一 Generation Workflow 状态模型 | 状态流转说明 | P0 | 1.0d | Done |
| W1-05 | Product / Backend | 定义统一工作流下的 API / 数据结构影响 | 接口与模型变更清单 | P0 | 0.5d | In Progress |
| W1-06 | Product / Backend | 梳理 Provider 概念层Capability / Provider / Routing Policy | 分层图与术语表 | P1 | 0.5d | Pending |
| W1-06 | Product / Backend | 梳理 Provider 概念层Capability / Provider / Routing Policy | 分层图与术语表 | P1 | 0.5d | Done |
| W1-07 | Product / Frontend | 梳理 Storybook 当前问题与恢复方案 | 恢复方案说明 | P0 | 0.5d | Done |
| W1-08 | Product / Frontend | 确认 admin 前端是修复、裁剪还是暂时降级 | 决策记录 | P0 | 0.5d | Done |
| W1-09 | Planning | 产出 Week 2 开发任务清单 | 下周 backlog | P1 | 0.5d | In Progress |