fix: add missing project_id to extract-voice FormData #1687

Merged
auto-approve-bot merged 1 commits from fix/extract-voice-missing-project-id into develop 2026-09-04 14:27:14 +08:00
Owner

Problem

Clicking "提取视频配音" button triggers POST /api/v1/voices/extract-voice which returns 422 Unprocessable Entity.

Root cause: Backend voices.py:541 defines project_id: str = Form(...) as a required field, but the frontend FormData only appends file without project_id. FastAPI validation fails and returns 422.

Fix

Added formData.append("project_id", "default") after the file append in apps/web/src/api/tts/jobs.ts.

Changes

  • apps/web/src/api/tts/jobs.ts — line 84: add project_id to FormData

Verification

  • Prettier formatted
  • TypeScript compiles (tsc --noEmit)
  • ESLint passes
## Problem Clicking "提取视频配音" button triggers `POST /api/v1/voices/extract-voice` which returns **422 Unprocessable Entity**. **Root cause:** Backend `voices.py:541` defines `project_id: str = Form(...)` as a required field, but the frontend FormData only appends `file` without `project_id`. FastAPI validation fails and returns 422. ## Fix Added `formData.append("project_id", "default")` after the file append in `apps/web/src/api/tts/jobs.ts`. ## Changes - `apps/web/src/api/tts/jobs.ts` — line 84: add `project_id` to FormData ## Verification - ✅ Prettier formatted - ✅ TypeScript compiles (tsc --noEmit) - ✅ ESLint passes
xiaoxia added 1 commit 2026-09-04 14:20:25 +08:00
fix: add missing project_id to extract-voice FormData
AI Code Review / AI Code Review (pull_request) Successful in 49s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m31s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m41s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 4m4s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 8s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 29s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Validate - Style (pull_request) Has been skipped
CI/CD Pipeline / Validate - Security (pull_request) Has been skipped
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 36s
CI/CD Pipeline / CI Gate (pull_request) Successful in 1s
f1a04aee92
Backend voices.py:541 requires project_id as a mandatory Form field,
but the frontend FormData only appended 'file', causing FastAPI to
return 422 Unprocessable Entity.

Added formData.append('project_id', 'default') to satisfy the
backend validation.
Collaborator

【阻塞级判定】

  • 是否存在阻塞级问题:否
  • 阻塞级问题数量:0 个

📊 审查概览

  • 整体评价:有建议
  • 建议级问题数量:1 个

🔴 阻塞级问题(必须修复)

💡 改进建议(不阻塞合并)

  1. [apps/web/src/api/tts/jobs.ts:83] 硬编码业务参数风险
    • 具体内容:代码中直接硬编码了 project_id 为字符串 "default"。在多项目或多租户场景下,这会导致所有上传的资源都归属于同一个项目,造成数据隔离问题。建议确认业务逻辑,如果支持多项目,应将其改为函数参数或从上下文获取。

良好实践


🤖 由 AI 代码审查机器人自动生成 | 2026-09-04 06:21:14 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:有建议 - 建议级问题数量:1 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 1. **[apps/web/src/api/tts/jobs.ts:83] 硬编码业务参数风险** - 具体内容:代码中直接硬编码了 `project_id` 为字符串 `"default"`。在多项目或多租户场景下,这会导致所有上传的资源都归属于同一个项目,造成数据隔离问题。建议确认业务逻辑,如果支持多项目,应将其改为函数参数或从上下文获取。 ### ✅ 良好实践 无 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-09-04 06:21:14 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1687 | | 预览链接 | [https://pr-1687.preview.xiaoxiajianji.com](https://pr-1687.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot approved these changes 2026-09-04 14:23:08 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-09-04 14:23:08 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot merged commit ed72a91990 into develop 2026-09-04 14:27:14 +08:00
auto-approve-bot deleted branch fix/extract-voice-missing-project-id 2026-09-04 14:27:14 +08:00

🗑️ 预览环境已清理

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

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

🗑️ **预览环境已清理** PR #1687 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.