Commit Graph

95 Commits

Author SHA1 Message Date
Audit Bot 62c8d1cdff feat: 剪辑计划编辑器后端 — 模板 CRUD + 分类 + 生成校验
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
- domain: Template, TemplateSegment, TemplateCategory 实体
- ports: TemplateRepositoryPort Protocol
- adapters: SQLAlchemyTemplateRepository + 3 个 ORM Model
- application: CRUD use cases + GenerateFromTemplateUseCase
- 业务规则: one_take=1片段, voice_over_mix=每段需material_type, 配音±30%警告
- schemas: Pydantic request/response models
- routes: /api/v1/templates CRUD + /generate + /categories
- alembic: 014_add_template_tables (templates/template_segments/template_categories)
- tests: 21 个单元测试全部通过
2026-06-29 14:14:58 +08:00
Audit Bot f2e123a017 feat: 配方复用功能后端实现
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
- domain: Recipe/RecipeItem 实体
- ports: RecipeRepository Protocol
- adapters: SQLAlchemy RecipeRepository 实现 + ORM models
- application: 6个 UseCase (CRUD + Use) + Commands
- API: 6个端点 POST/GET/PATCH/DELETE /recipes + POST /recipes/{id}/use
- feature flag: recipe_reuse 仅 basic/premium 可用
- Alembic 迁移: recipes + recipe_items 表
- 单元测试: 覆盖所有 UseCase
2026-06-29 10:59:05 +08:00
API文档维护Agent 47533e7037 fix: 修复标题/配音创建500、素材库列表500、CORS缺失
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
- titles.py/voices.py: get_by_id → find_by_id(方法名错误导致AttributeError)
- project_repository.py: cast shared_users to JSONB for @> operator(JSON列不支持@>)
- main.py: CORS allow_origins 添加 https://saas.xiaoxiajianji.com
2026-06-28 21:33:07 +08:00
xiaoxia a55a30b085 Merge pull request 'feat: Phase 2 订阅管理后端 API' (#78) from feat/phase2-subscription-api into develop
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
2026-06-28 18:35:41 +08:00
API文档维护Agent 06f0b9cc46 fix: 修复订阅API的3个P0问题
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
P0-1: 修复错误的导入路径
  - from app.database import get_db → from app.dependencies import get_user_repository
  - 移除不存在的 Session 依赖

P0-2: 修复直接修改 dataclass 的问题
  - 使用 dataclasses.replace() 创建新实例
  - 通过 UserRepository.save() 持久化更改
  - 更新 UserRepository 以支持订阅字段的读写

P0-3: 移除不存在的 quota_registry 模块
  - 硬编码配额定义 PLAN_QUOTAS
  - free: 3项目/10GB, standard: 10项目/50GB
  - pro: 无限项目/100GB, enterprise: 无限项目/1000GB

额外:
- 添加支付验证 TODO 注释(方案C)
- 更新 UserRepository.save() 保存订阅相关字段
- 更新 UserRepository._to_entity() 读取订阅相关字段
2026-06-28 18:26:01 +08:00
API文档维护Agent 9b016e3b2d fix: 回退域对象 extra_meta → metadata(5文件16处)
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
Asset 域对象属性名为 metadata,不是 extra_meta。
extra_meta 仅用于 SQLAlchemy model 层(对应 DB 列)。

修复文件:
- packages/adapters/sqlalchemy_impl/asset_repository.py (L63, L88)
- apps/api/app/api/routes/assets.py (L30, L72, L73)
- apps/api/app/api/routes/asset_diagnosis.py (L52, L55, L56, L57)
- apps/worker/worker_app/core/asset_usage.py (L5, L6, L7, L9)
- apps/worker/worker_app/tasks/voice_extraction.py (L69, L70, L71, L104, L105, L106)
2026-06-28 17:56:02 +08:00
API文档维护Agent 87360051fa fix: rename metadata to extra_meta to avoid SQLAlchemy reserved field conflict
SQLAlchemy's 'metadata' attribute is reserved for model metadata, causing
service startup crash. Changed to 'extra_meta' with Column('metadata', JSON)
mapping to preserve database column name.

Affected models (7):
- AssetLibraryModel, AssetModel, AssetClassificationModel
- GenerationTaskModel, DuplicationRecordModel
- TitleLibraryModel, VoiceLibraryModel

Updated all references across:
- packages/adapters/sqlalchemy_impl/{title_library,voice_library,asset}_repository.py
- apps/worker/worker_app/{core/asset_usage.py,tasks/voice_extraction.py}
- apps/api/app/api/routes/{asset_diagnosis.py,assets.py}
2026-06-28 16:49:23 +08:00
API文档维护Agent 312dad7497 feat: Phase 2 查重后端 API 实现
六边形架构分层实现:

Domain 层:
- DuplicationRecord / DuplicateSegment 实体
- 状态机生命周期 (pending→processing→completed/failed)

Ports 层:
- DuplicationRecordRepository Protocol

Adapters 层:
- SQLAlchemyDuplicationRecordRepository 完整实现
- DuplicationRecordModel / DuplicationSegmentModel ORM 模型

Application 层:
- UploadForDuplicationUseCase (上传查重)
- ListDuplicationRecordsUseCase (记录列表)
- GetDuplicationDetailUseCase (详情查询)
- DeleteDuplicationRecordUseCase (删除)
- RetryDuplicationUseCase (重新查重)

API 层:
- POST /api/v1/duplication/upload (上传视频查重)
- GET /api/v1/duplication/records (记录列表)
- GET /api/v1/duplication/records/{id} (详情含片段)
- DELETE /api/v1/duplication/records/{id} (删除)
- POST /api/v1/duplication/records/{id}/retry (重新查重)

Alembic 迁移:
- 011_add_duplication_tables.py (duplication_records + duplication_segments)

API 契约与前端 feat/phase2-duplication-ui (PR#75) 完全对齐。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-28 16:12:46 +08:00
API文档维护Agent a43ddb4b63 feat: Phase 1 - 核心重构(去Project层/标题库API/配音库API/清理废弃代码)
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
## 主要变更

### 1. 清理废弃代码(18个文件删除)
- 删除 TaskModel/MilestoneModel/TaskIssueModel 及相关文件
- 删除 ProjectTitleModel/EditPlanModel/EditPlanClipModel 及相关文件
- 清理 domain/ports/adapters/application/api 各层引用
- 从 GenerationTaskModel 移除 edit_plan_id 字段

### 2. 新建标题库 API(/api/v1/titles)
- Domain: TitleLibraryItem 数据类
- Ports: TitleLibraryRepository 接口
- Adapters: SQLAlchemy 实现(软删除)
- Application: CRUD Use Cases + 配额检查(max_titles: free=50, basic=500, premium=500)
- API: GET/POST/PUT/DELETE 端点
- Schema: Pydantic 请求/响应模型

### 3. 新建配音库 API(/api/v1/voices)
- Domain: VoiceLibraryItem 数据类
- Ports: VoiceLibraryRepository 接口
- Adapters: SQLAlchemy 实现(软删除)
- Application: CRUD Use Cases + 配额检查(max_voiceovers: free=10, basic=100, premium=100)
- API: GET/POST/PUT/DELETE 端点
- Schema: Pydantic 请求/响应模型

### 4. 去掉 Project 层依赖
- 修复 authenticated_user.id → authenticated_user.user.id bug
- asset_libraries.py: project_id 改为可选查询参数
- generated_videos.py: project_id 改为可选查询参数
- 无 project_id 时通过 find_accessible_projects 获取用户可访问的所有项目

### 5. 数据库迁移
- 创建 011_phase1_core_refactor.py
- 删除 6 个废弃表:tasks, milestones, task_issues, project_titles, edit_plans, edit_plan_clips
- 从 generation_tasks 表删除 edit_plan_id 列

### 6. 其他改进
- 迁移 EditingMode 到独立模块 packages/domain/editing_mode.py
- 注册 titles_router 和 voices_router
- 添加 get_title_library_repository 和 get_voice_library_repository 依赖
- 更新 domain/ports __init__.py 导出新实体和仓储接口

## 技术细节
- 遵循六边形架构模式
- 配额检查通过 QuotaRegistry 实现
- 软删除:标题库用 is_active=False,配音库用 status='deleted'
- 配音库支持可选的 project_id 关联

## 破坏性变更
- 删除 6 个废弃表(需先备份数据)
- 删除 /api/v1/edit-plans, /api/v1/project-titles, /api/v1/project-management 端点
- generation_tasks API 不再包含 edit_plan_id 字段
2026-06-28 15:02:10 +08:00
API文档维护Agent a023ba8130 feat: Phase 0 - 扩展性基础设施(模块注册/配额注册表/Feature Flags/新增表)
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
- 新增 packages/infrastructure/ 包
- 实现 ModuleRegistry:模块注册中心,支持能力声明、依赖检查、配额规则
- 重构 QuotaRegistry:注册表模式,3 套餐等级(free/basic/premium),11 配额维度
- 实现 FeatureFlags:三级控制(全局/套餐/用户白名单),5 个初始 Flag
- Alembic 迁移 010:5 表新增 metadata JSONB + title_libraries 表 + voice_libraries 表
- 更新 models.py:新增 TitleLibraryModel、VoiceLibraryModel
2026-06-28 14:13:40 +08:00
CI Test 9c287145a1 fix(P2-3): UserModel 配额字段 max_projects/max_storage_gb/used_storage_gb 从 Float 改为 Integer
Tests / test (pull_request) Failing after 0s
Tests / lint (pull_request) Failing after 0s
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
2026-06-28 10:26:52 +08:00
API文档维护Agent e3fb518ab2 refactor: remove all workspace_id references from codebase
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
- Remove workspace_id from Pydantic models in project_management routes
- Remove workspace_id from SQLAlchemy and SQLite project management repos
- Remove workspace_id from worker tasks (storage keys, entity creation)
- Remove workspace_id from video dedup and title usage modules
- Remove workspace_id from generation and ingest worker tasks
- Clean workspace_id from all test files and scripts
- Remove workspace-specific test files (list_workspaces, workspace repos)

Task: #14 workspace_id 残留清理
2026-06-27 22:52:09 +08:00
Audit Bot 627fe0eb8b fix(#23,#24): 统一 storage_key/file_url 命名和 file_size 类型
- AssetModel: 添加 storage_key 字段注释说明为 OSS 对象键
- AssetModel/GeneratedVideoModel: file_size 从 Float 改为 Integer
- 添加 file_url 字段注释说明为完整可访问 URL
- 确保字节数精度,避免浮点数精度问题
2026-06-27 17:20:17 +08:00
CI Bot 596ea163d7 fix: remove WorkspaceMember entity import from stub 2026-06-27 09:48:56 +08:00
CI Bot 034b147f92 fix: replace workspace_member_repository with stub (no model dependency) 2026-06-27 09:46:42 +08:00
CI Bot 11494918eb fix: resolve all workspace removal breakage - stub permissions, quota, ports, adapters
- Remove Workspace from domain/__init__.py exports
- Stub domain/permissions.py (all checks pass)
- Stub domain/quota.py (all checks pass)
- Create missing port stubs: workspace_member_repository, workspace_repository, workspace_invitation_repository
- Create missing adapter stubs: workspace_repository, workspace_invitation_repository
- Create routes/permissions.py stub (require_workspace_member no-op)
- Fix .env Redis URL encoding on production server
2026-06-27 09:16:53 +08:00
CI Bot 60adbf95ce chore: remove redundant .github/workflows (using Gitea Actions) 2026-06-27 00:41:09 +08:00
CI Test bd9e9fba45 chore: squash merge feature/voice-dedup into develop (resolve conflicts)
- Add voice extraction and deduplication functionality
- Add dedup.py for video deduplication
- Add voice_extraction.py task for worker
- Resolve CI/CD and deploy workflow conflicts with develop version
- Keep new voice dedup features from feature branch
2026-06-26 21:23:39 +08:00
CI Test cd887909c7 chore: squash merge feature/smart-edit-plan into develop (resolve conflicts)
- Resolve CI/CD and deploy workflow conflicts with develop version
- Resolve database and dependencies conflicts with develop version
- Keep new edit plan generator and API functionality from feature branch
2026-06-26 21:21:39 +08:00
xiaoxia f687b4207f feat: add download_url field to generated video APIs (#20) 2026-06-26 21:13:18 +08:00
xiaoxia 299f42a6aa feat: 实现四种视频剪辑模式 (#23) 2026-06-26 20:58:26 +08:00
xiaoxia 0422967229 refactor: Remove workspace concept - Projects now directly under User
BREAKING CHANGES:
- Removed Workspace, WorkspaceMember, WorkspaceInvitation entities
- Project now has owner_user_id instead of workspace_id
- Added shared_users list to Project for collaboration
- Subscription/quota moved from Workspace to User level

Changes:
- packages/domain/entities.py: Removed Workspace entities, updated Project
- packages/adapters/sqlalchemy_impl/models.py: Updated models
- packages/application/: Removed workspace use cases, updated other use cases
- packages/ports/: Removed workspace repository interfaces
- apps/api/: Updated routes, schemas, dependencies, router
- alembic/versions/007_remove_workspace_concept.py: Database migration

New APIs:
- POST /projects/{id}/share: Share project with user
- DELETE /projects/{id}/share/{user_id}: Unshare project
2026-06-26 19:16:54 +08:00
xiaoxia 0e4909e29d P2-3: workspace_member_repository.py find_by_workspace 方法添加 JOIN 预加载用户数据 2026-06-26 18:36:45 +08:00
Xiaoxia AI 0f59b412bc feat(plans): add edit plan preview workflow 2026-06-24 10:10:25 +08:00
Xiaoxia AI ee6b4a663a feat(tasks): add project task center 2026-06-24 08:39:32 +08:00
Xiaoxia AI 8acbd6c8a7 feat(results): add generated video management 2026-06-24 06:28:06 +08:00
Xiaoxia AI b4dbad2e1e fix(titles): keep selected title ids generation-safe 2026-06-24 01:13:01 +08:00
Xiaoxia AI 17021c351f feat(titles): complete title selection workflow 2026-06-24 00:55:00 +08:00
Xiaoxia AI 6b66601d67 feat(titles): add project title library 2026-06-24 00:30:58 +08:00
Xiaoxia AI 51eb9381f4 fix(api): support asset library lookup for media guards 2026-06-23 09:44:03 +08:00
Xiaoxia AI 34353506d7 fix(web): restore project workspace context 2026-06-22 13:19:45 +08:00
Xiaoxia AI 27ea04264f feat(workspace): restore member management routes 2026-06-21 09:36:08 +08:00
Xiaoxia AI 383151efcb feat(workspace): restore core routes on sqlalchemy adapters 2026-06-21 09:22:09 +08:00
Xiaoxia AI 93271f7dda refactor(auth): route simple auth through use cases 2026-06-21 08:22:49 +08:00
Xiaoxia AI ebae5f51b0 fix(schema): forbid auto create schema in deployed envs 2026-06-21 07:36:46 +08:00
Xiaoxia AI bfbaddbd9a style: normalize python formatting gates 2026-06-21 06:52:19 +08:00
Xiaoxia AI 3002160ad4 feat: 添加简化版认证API和配置文件 2026-06-20 11:29:46 +08:00
Xiaoxia AI 758c2c7e13 feat(phase7): align asset flow and scaffold generation pipeline 2026-06-18 19:59:37 +08:00
Xiaoxia AI 8d78798a7d fix(phase7): align api runtime wiring for integration 2026-06-17 18:48:08 +08:00
Xiaoxia AI db1ebc4e9d feat(phase7): add asset classification workflow 2026-06-17 18:29:48 +08:00
Xiaoxia AI 80a57ff0fe Phase 6: Complete admin pages (Analytics, Monitor, Logs) and Phase 7: Asset management foundation
Phase 6 completion:
- Add Analytics page with charts (user growth, revenue, retention)
- Add SystemMonitor page (CPU, memory, services health)
- Add LogViewer page (log search, filtering, details)
- Update sidebar navigation with Admin submenu
- Add recharts to package.json for data visualization

Phase 7 Day 1-2:
- Create Asset and AssetLibrary domain entities
- Define AssetRepository and AssetLibraryRepository interfaces
- Implement InMemory repositories for testing
- Implement PostgreSQL repository adapter
- Update SQLAlchemy models for assets and asset_libraries
- Add database migration script 004_asset_management.sql

Architecture: Strict Clean Architecture compliance
Testing: InMemory adapters ready for unit tests
Database: Migration script with indexes and foreign keys
2026-06-17 17:41:48 +08:00
Xiaoxia AI c92cf78ea1 feat: add project management module (tasks, milestones, issues)
- Domain: Task, Milestone, TaskIssue entities with business logic
- Ports: TaskRepository, MilestoneRepository, TaskIssueRepository interfaces
- Adapters: In-Memory and SQLAlchemy implementations
- Application: Use cases for task/milestone/issue operations
- API: FastAPI routes for project management
- Database: Alembic migration 002 for new tables
- Tests: 7 integration tests all passing
2026-06-16 11:02:06 +08:00
Xiaoxia AI acfa82b995 fix: serialize schema init for postgres 2026-06-15 19:41:57 +08:00
Xiaoxia AI f0ee5c6184 feat: persist ingest flow in postgres 2026-06-15 19:34:47 +08:00
Xiaoxia AI e4e2595e70 feat: add PostgreSQL persistence layer
- adapters: SQLAlchemy implementations for all 4 repositories (Project, AssetLibrary, Asset, IngestJob)
- models: SQLAlchemy ORM models with proper schema
- database: connection config and session management
- tests: SQLAlchemy repository integration test (in-memory SQLite)
- all 7 integration tests passing
2026-06-15 15:29:13 +08:00