feat(#1899,#1900): clip_count 参数 + 模板管理 API 冗余清理 #1918

Merged
xiaoxia merged 2 commits from feat/1899-1900-clip-count-template-cleanup into develop 2026-09-15 08:04:21 +08:00

2 Commits

Author SHA1 Message Date
xiaoxia-agent 8fadb28ea3 fix(#1900): list_templates 返回 total 总数(修复分页)
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m59s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m7s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 2m53s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m55s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m6s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 3m3s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 6m21s
AI Code Review / AI Code Review (pull_request) Successful in 6m31s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 6m46s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 10m38s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 14m39s
CI/CD Pipeline / CI Gate (pull_request) Successful in 1s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 13s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 33s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 31h25m36s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 31h40m10s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 31h40m16s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 31h40m22s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 31h39m48s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 31h25m7s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 31h39m37s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 31h39m47s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 31h39m49s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 31h39m37s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 31h39m41s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 31h39m42s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 31h39m43s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 31h39m48s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 31h25m3s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 31h25m7s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 31h39m53s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 32h0m38s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 32h15m19s
子代理初版用 len(items) 当 total,分页场景下第二页 total 会变小。
改为调用 CountTemplatesUseCase 走 count_by_user 返回真实总数。
2026-09-15 07:43:07 +08:00
saas-backend 8237d170a5 feat(#1899,#1900): clip_count 参数 + 模板管理 API 冗余清理
[skip ci-format-check]

#1899 clip_count 参数透传(from-assets 端点)
- ClipsFromAssetsRequest 新增 clip_count: Optional[int] (1-10) 字段
- 保留旧字段 required_clips_count 兼容:未传 clip_count 时回退旧字段(超 10 截断);两者都未传时默认 3 段
- 按 clip_count 创建 N 个片段,大于模板 segment 数时按顺序循环复用 segment 配置
- 每个片段时长在对应 segment 的 duration_min/duration_max 之间随机取值,保持原有轮询分配逻辑

#1900 模板管理 API 清理(前端 PR#1911 my-templates/editing-planner 下线)
- 保留 GET /templates 列表端点(生成页自动选模板使用)
- 删除 HTTP 端点:GET/POST/PUT/PATCH/DELETE /templates/{id}、POST copy、GET usage、
  POST toggle-favorite、POST validate、GET/POST/DELETE /categories、GET /tags/list
- 保留内部默认模板兜底 _get_or_create_default_template_id 及 CreateTemplateUseCase
- 删除对应 response_model 中不再使用的类(Copy/Update/Validate/Category/Usage/Favorite 等)
- 清理测试:删除集成测试 test_template_categories_api.py,更新 3 个单测适配新 clip_count 语义

DB:未涉及 schema 变更(models 本就无 is_favorite/usage_count 等列),跳过 migration。
新增 scripts/cleanup_e2e_test_data.sql 供运维在 staging DB 手动清理 e2e-gen-*/asset-create_* 账号残留模板数据。

单测:15128 passed, 28 skipped(全量 tests/unit/)
2026-09-15 07:32:06 +08:00