feat(points): P2 step 2.4 - generation_tasks 视频生成 points gate #1941

Closed
xiaoxia wants to merge 7 commits from feat/points-gen-tasks-gate into develop
Owner

#1895 P2 扣点接入 - 视频生成

  • create_generation_task() 扣 ai_video 积分(3分/条,count 批量计价,30s+每段+1分)
  • 非会员每日 2 条免费(Redis Lua 原子,已在 gate 内置)
  • @points_gate 装饰器自动退费
  • 修复:装饰器 inspect 签名过滤 _points_deducted 等内部 kwarg,避免路由无 **kwargs 时报 TypeError
  • 55个新增/适配单测
#1895 P2 扣点接入 - 视频生成 - create_generation_task() 扣 ai_video 积分(3分/条,count 批量计价,30s+每段+1分) - 非会员每日 2 条免费(Redis Lua 原子,已在 gate 内置) - @points_gate 装饰器自动退费 - 修复:装饰器 inspect 签名过滤 _points_deducted 等内部 kwarg,避免路由无 **kwargs 时报 TypeError - 55个新增/适配单测

🚀 预览环境已部署

项目 详情
PR号 #1941
预览链接 https://pr-1941.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1941 | | 预览链接 | [https://pr-1941.preview.xiaoxiajianji.com](https://pr-1941.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia force-pushed feat/points-gen-tasks-gate from 56d245b406 to 8d743c3c23 2026-09-15 22:52:11 +08:00 Compare
xiaoxia force-pushed feat/points-gen-tasks-gate from bdab390918 to 421cc3f25d 2026-09-16 00:27:43 +08:00 Compare
xiaoxia added 6 commits 2026-09-16 03:04:08 +08:00
- synthesize(): deduct ai_voice points (1/min, est ceil(chars/240)), refund on workflow/Celery failure
- preview_tts(): deduct ai_voice points, refund on CosyVoiceError/ValueError
- get_voice_clone_preview(): deduct voice_clone_synth points (1/min), refund on CosyVoiceError/ValueError
- All points logic gated by settings.points_enabled (default false)
- Raises HTTP 402 INSUFFICIENT_POINTS when balance insufficient
- create_lipsync_job(): deduct ai_digital_human points (15/min), estimated from audio_duration (if provided) or script_text (chars/240), min 1 min; refund on ValueError/MediaKitError/Exception; refund on failed job
- preview_tts(): deduct ai_digital_human points by script_text length; refund on MediaKitError/Exception
- Both gated by settings.points_enabled (default false)
- Raises HTTP 402 INSUFFICIENT_POINTS on insufficient balance
- 14 new unit tests; 15468 total passed
- extract_from_douyin: @points_gate("douyin_extract") 1分/次
- ai_rewrite: @points_gate("ai_rewrite") 1分/次
- ai_generate_titles: @points_gate("ai_title") 1分/次
- All gated by settings.points_enabled (default false)
- Refund on exception handled by decorator
- Renamed authenticated_user → current_user in route + tests for decorator compat
- 4 new points tests; 32+4=36 scripts_ai tests pass; 15472 total passed
test(points): add lipsync endpoint tests for insufficient/refund paths
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m17s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m49s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 27s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 29s
AI Code Review / AI Code Review (pull_request) Successful in 6m43s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 4m20s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m29s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 5m34s
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 12h8m29s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 12h7m43s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 12h7m43s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 12h7m43s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 12h13m13s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 12h7m43s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 12h7m43s
827e89f224
xiaoxia force-pushed feat/points-gen-tasks-gate from d6c2a8fb6f to 827e89f224 2026-09-16 03:04:08 +08:00 Compare
auto-approve-bot added 1 commit 2026-09-16 03:20:59 +08:00
style: auto-format with black + isort + ruff + prettier [skip ci-format-check]
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 3m44s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 5m57s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 14s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 17s
AI Code Review / AI Code Review (pull_request) Failing after 12m8s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Failing after 12m13s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m35s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 4m22s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m28s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 4m41s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 11m0s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 10m29s
CI/CD Pipeline / CI Gate (pull_request) Successful in 3s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 52s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 11h29m50s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 11h39m6s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 11h44m14s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 11h38m23s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 11h40m13s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 11h40m14s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 11h43m27s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 11h43m27s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 11h43m35s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 11h29m6s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 11h29m7s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 11h29m7s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 11h29m3s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 11h38m20s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 11h38m20s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 11h38m23s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 11h38m23s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 11h40m13s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 11h52m34s
9226c63558
xiaoxia closed this pull request 2026-09-16 04:05:36 +08:00

🗑️ 预览环境已清理

PR #1941 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #1941 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Some checks are pending
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 3m44s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 5m57s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 14s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 17s
AI Code Review / AI Code Review (pull_request) Failing after 12m8s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Failing after 12m13s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m35s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 4m22s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m28s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 4m41s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 11m0s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 10m29s
CI/CD Pipeline / CI Gate (pull_request) Successful in 3s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 52s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 11h29m50s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 11h39m6s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 11h44m14s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 11h38m23s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 11h40m13s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 11h40m14s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 11h43m27s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 11h43m27s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 11h43m35s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 11h29m6s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 11h29m7s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 11h29m7s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 11h29m3s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 11h38m20s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 11h38m20s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 11h38m23s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 11h38m23s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 11h40m13s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 11h52m34s

Pull request closed

Sign in to join this conversation.