chore: sync develop → main (PR#94 素材库修复 + 前端优化) #96

Merged
xiaoxia merged 24 commits from develop into main 2026-06-29 09:32:55 +08:00
Owner

将 develop 最新变更同步到 main,包含:

  • PR#94: 素材库新建自动获取/创建默认项目以提供 project_id
  • getProjects 响应解析修复
将 develop 最新变更同步到 main,包含: - PR#94: 素材库新建自动获取/创建默认项目以提供 project_id - getProjects 响应解析修复
xiaoxia added 24 commits 2026-06-29 09:32:49 +08:00
feat: implement Phase 2 subscription management API
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
27303e34eb
Implement 5 subscription endpoints matching frontend subscription.ts:

API Endpoints:
- GET /api/v1/subscription/current — get current subscription info
- GET /api/v1/subscription/billing-records — get billing history
- POST /api/v1/subscription/change-plan — upgrade/downgrade plan
- POST /api/v1/subscription/cancel — cancel subscription
- POST /api/v1/subscription/toggle-auto-renew — toggle auto-renewal

Implementation Details:
- Created subscription schemas (SubscriptionInfo, BillingRecord, etc.)
- Created subscription routes with proper authentication
- Integrated with quota_registry for plan limits
- Added plan validation (free/standard/pro/enterprise)
- Added billing cycle validation (monthly/yearly)
- Registered subscription router in api_router

Note: Billing records currently returns empty list (TODO: implement billing system)
Auto-renew toggle is simulated (TODO: add auto_renew field to User model)

All endpoints follow existing patterns from titles/voices/duplication APIs.
fix: 修复一键生成页面废弃 API 调用及导航问题
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
f8cb32db56
Bug A: GeneratePage 引用已删除的 editPlans API(/edit-plans/auto-generate 不存在)
- 新增 createGenerationTask 到 tasks.ts(USE_MOCK 模式,待后端适配扁平化架构后切换)
- GeneratePage 改用 createGenerationTask 替代 autoGenerateEditPlan
- 移除对 @/api/editPlans 的引用

附带修复: window.location.href → useNavigate('/history')
Merge pull request 'fix: 修复一键生成页面废弃 API 调用(Bug A)' (#79) from fix/p1-bug-fixes 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
55e3b3fcb7
fix: 查重上传接口错误信息不再泄露内部异常
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
22196198bb
- L150: detail=f"读取文件失败: {exc}" → detail="文件读取失败,请稍后重试"
- L162: detail=f"文件上传失败: {exc}" → detail="文件上传失败,请稍后重试"
- 添加 logger.error 记录完整异常信息供内部排查
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
06f0b9cc46
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() 读取订阅相关字段
security: 升级 python-multipart 0.0.12 → 0.0.32 修复 CVE
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
f92bd25583
- CVE-2024-53981 (DoS)
- CVE-2026-24486 (RCE)
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
a55a30b085
Merge pull request 'fix: 查重上传接口错误信息不再泄露内部异常(安全审计 P1)' (#82) from fix/p1-duplication-error-info-leak 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
ce25bacbac
feat: 查重上传错误处理单元测试 (37用例)
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
e3aacb7505
fix: 禁用 redirect_slashes 修复 307 重定向导致前端新建失败
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
25ce4830a6
- FastAPI 初始化添加 redirect_slashes=False,避免反向代理后
  307 重定向 URL 丢失 HTTPS 协议
- 移除 titles.py/voices.py/generation_tasks.py 路由中的尾斜杠
  ('/' → '','/tasks/' → '/tasks','/tasks/{id}/results/' → '/tasks/{id}/results')

Fixes: 前端调用 POST /api/v1/titles 等接口时 307 重定向到 http:// 导致失败
Merge pull request 'fix: P0 - 禁用 redirect_slashes 修复 307 重定向导致前端新建失败' (#85) from fix/p0-307-redirect 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
57e4cd4776
Merge pull request '测试: 订阅管理 API + 查重上传错误处理 单元测试 (63用例)' (#83) from test/subscription-duplication-tests 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
949f243639
feat(subscription): 对接后端订阅API,移除mock数据
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
c7027c07d1
Merge pull request 'feat: Phase 2 - 订阅管理前端页面(对接真实API)' (#84) from feat/phase2-subscription-ui 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
c81b071a43
fix: remove unused formatAmount to fix web build error
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
a0d552c91a
fix: 修复标题库新建/编辑功能 — 前后端字段名不匹配导致422
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
54cbfe2adf
根因:前端发送 { content, category } 但后端 CreateTitleLibraryRequest
期望 { name (必填), text (必填), category }。字段名不匹配导致
Pydantic 校验失败返回 422,modal 不关闭,数据不保存。

修复:
- api/titles.ts: 请求时将 content 映射为 text + 自动截取 name
- api/titles.ts: 响应时将后端 text 字段映射回前端 content
- api/titles.ts: updateTitle 改用 PUT(后端实际方法)
- 页面代码无需改动,映射在 API 层透明处理

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
47533e7037
- 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
Merge pull request 'fix: 修复标题/配音创建500、素材库列表500、CORS配置' (#91) from fix/api-500-errors-cors 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
bf44bd8d9a
Merge pull request 'fix: 修复标题库新建/编辑功能 — 前后端字段名不匹配导致422' (#90) from fix/p0-create-titles-assets 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
2ee3992a94
fix: 同步改进CORS配置 - 始终包含生产域名
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
573e4485b7
与main分支PR #93保持一致:无论CORS_ORIGINS_RAW环境变量是否设置,
都确保 https://saas.xiaoxiajianji.com 在allow_origins中。
fix: 素材库新建自动获取/创建默认项目以提供 project_id
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
841b501c30
- 新增 api/projects.ts:项目 API 模块,含 getOrCreateDefaultProject
- 修改 createAssetLibrary:自动解析 project_id 再发送请求
- 后端 CreateAssetLibraryRequest 要求 project_id,前端之前未发送导致 422
- 修复 P0:新建素材库点击确定无响应

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fix: 修正 getProjects 响应解析 — 后端返回 {items:[...]} 而非裸数组
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
5eacac3abf
- BackendProjectResponse 对齐后端 ProjectResponse(仅 id/name/description)
- getProjects 改为 response.data.items 解析
- 修复代码审计 PR#94 审查发现的 P0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merge pull request 'fix: 素材库新建自动获取/创建默认项目以提供 project_id' (#94) from fix/asset-library-project-id 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
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
Tests / lint (pull_request) Failing after 243h20m43s
Tests / test (pull_request) Failing after 243h21m45s
6190752bb3
xiaoxia merged commit ae52a63131 into main 2026-06-29 09:32:55 +08:00
Sign in to join this conversation.