feat(phase8): AutoClipService 智能选片服务 (任务 2.07) #156

Merged
xiaoxia merged 1 commits from feature/phase8-task207-autoclip-service into develop 2026-07-01 19:45:25 +08:00
Owner

任务 2.07: AutoClipService 智能选片

实现内容

  • AutoClipService — 自动为剪辑计划片段分配最佳素材
    • auto_select_assets(plan_id, project_id) — 批量自动分配
    • select_for_clip(clip_id, project_id) — 单个片段分配
  • 评分算法 (0.0~1.0):
    • 质量分 (quality_score): 权重 0.5
    • 时长匹配度: 权重 0.3 (线性衰减)
    • 分类匹配度: 权重 0.2 (完全匹配=1.0, 部分=0.3, 无=0.0)
  • AssetRepository.search_candidates() — 新增素材筛选方法
    • 支持 file_type / quality_score / duration / classification / tags 筛选
    • 按质量分降序排列
    • 抽象接口 + SQLAlchemy 实现

文件变更

  • packages/ports/asset_repository.py — 新增 search_candidates() 抽象方法
  • packages/adapters/sqlalchemy_impl/asset_repository.py — 实现 search_candidates()
  • apps/api/app/services/__init__.py — 新建,导出 AutoClipService
  • apps/api/app/services/auto_clip_service.py — 新建,338行
  • tests/unit/test_auto_clip_service.py — 新建,18个测试全部通过

测试

18 passed in 0.26s
## 任务 2.07: AutoClipService 智能选片 ### 实现内容 - **AutoClipService** — 自动为剪辑计划片段分配最佳素材 - `auto_select_assets(plan_id, project_id)` — 批量自动分配 - `select_for_clip(clip_id, project_id)` — 单个片段分配 - **评分算法** (0.0~1.0): - 质量分 (quality_score): 权重 0.5 - 时长匹配度: 权重 0.3 (线性衰减) - 分类匹配度: 权重 0.2 (完全匹配=1.0, 部分=0.3, 无=0.0) - **AssetRepository.search_candidates()** — 新增素材筛选方法 - 支持 file_type / quality_score / duration / classification / tags 筛选 - 按质量分降序排列 - 抽象接口 + SQLAlchemy 实现 ### 文件变更 - `packages/ports/asset_repository.py` — 新增 `search_candidates()` 抽象方法 - `packages/adapters/sqlalchemy_impl/asset_repository.py` — 实现 `search_candidates()` - `apps/api/app/services/__init__.py` — 新建,导出 AutoClipService - `apps/api/app/services/auto_clip_service.py` — 新建,338行 - `tests/unit/test_auto_clip_service.py` — 新建,18个测试全部通过 ### 测试 ``` 18 passed in 0.26s ```
xiaoxia added 2 commits 2026-07-01 17:46:03 +08:00
feat(task-2.15): 素材选择器优化 — 批量选择 + 拖拽排序 + 预览缩略图 + 质量分筛选
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 187h50m29s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 187h50m32s
Deploy / Deploy Staging (push) Failing after 188h16m12s
CI/CD Pipeline / Frontend Lint (push) Failing after 188h16m34s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 188h16m38s
7e954405f3
- 新增 AssetSelector 可复用组件(批量选择/拖拽排序/悬浮预览/质量分筛选/视图切换)
- MediaPanel 集成 AssetSelector,素材 Tab 使用 useQuery 内部获取数据
- TimelinePanel 支持批量素材拖入(application/x-media-assets)
- EditingPlanner 新增 handleBatchAddAssets 批量添加逻辑
- editPlans.ts 扩展 MediaAsset 类型(quality_score/classification_status)
- V21 设计系统响应式样式(1200/900/768/480 断点)
fix(asset-selector): 修复 PR #154 代码审查 4 项问题
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 187h18m49s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 187h18m52s
Deploy / Deploy Staging (push) Failing after 187h19m15s
CI/CD Pipeline / Frontend Lint (push) Failing after 187h19m37s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 187h19m42s
1fd93c95ba
P1-1: 质量分筛选 — parseInt 返回 NaN,改用 QUALITY_OPTIONS min/max 区间匹配
P1-2: AssetSelector→TimelinePanel 拖拽链断裂 — 恢复 application/x-media-asset(s) MIME 数据
P2-1: handleBatchAddAssets 忽略 insertIdx — 接受可选 insertIdx 参数,使用 splice 插入
P2-2: 拖拽语义区分 — 内部排序(text/plain)与外部素材投放(MIME types)互不干扰

同时修复 handleDragStart 依赖数组缺少 selectedIds 的问题
Author
Owner

任务 2.07 已完成

✅ 任务 2.07 已完成
xiaoxia force-pushed feature/phase8-task207-autoclip-service from 5eb019c519 to 18ea6cfadb 2026-07-01 19:40:08 +08:00 Compare
xiaoxia merged commit 04550b6eb3 into develop 2026-07-01 19:45:25 +08:00
Sign in to join this conversation.