feat(#1196): /voices?type=clone从克隆音色档案读取(智能剪辑配音可选克隆音色) #1202

Merged
auto-approve-bot merged 3 commits from feat/voices-clone-from-profile-1196 into develop 2026-07-30 14:46:12 +08:00
Owner

问题

智能剪辑配音选不到克隆音色。根因:/voices?type=clone 之前从 voice_library(配音库)读取,而配音库存的是「已合成的配音作品」,不是「可用的克隆音色选项」。

修复

克隆音色改为从 voice_clone_profile 读取 ready 状态 的音色模型,符合「音色列表」的语义。

变更

  • apps/api/app/api/routes/voices.py:
    • 克隆音色数据源从 voice_library 改为 voice_clone_profile
    • 新增 _clone_profile_to_unified_response 转换函数
    • 默认返回 ready 状态,支持 status=all 或具体状态过滤
  • tests/unit/test_voices_clone_from_profile.py: 12个单元测试

前端对接说明

  • 克隆音色条目带 voice_clone_profile_id 字段,可用于调用 /voice-clones/{id}/preview 试听
  • voice_id 字段可直接用于 TTS 合成配音
  • audio_url 为空(克隆音色是音色模型,没有预合成音频),试听请用 preview 接口

测试

本地12个单测 + 74个原有 voice_clone 测试,共86个全绿。

## 问题 智能剪辑配音选不到克隆音色。根因:`/voices?type=clone` 之前从 voice_library(配音库)读取,而配音库存的是「已合成的配音作品」,不是「可用的克隆音色选项」。 ## 修复 克隆音色改为从 `voice_clone_profile` 读取 **ready 状态** 的音色模型,符合「音色列表」的语义。 ## 变更 - apps/api/app/api/routes/voices.py: - 克隆音色数据源从 voice_library 改为 voice_clone_profile - 新增 `_clone_profile_to_unified_response` 转换函数 - 默认返回 ready 状态,支持 `status=all` 或具体状态过滤 - tests/unit/test_voices_clone_from_profile.py: 12个单元测试 ## 前端对接说明 - 克隆音色条目带 `voice_clone_profile_id` 字段,可用于调用 `/voice-clones/{id}/preview` 试听 - `voice_id` 字段可直接用于 TTS 合成配音 - `audio_url` 为空(克隆音色是音色模型,没有预合成音频),试听请用 preview 接口 ## 测试 本地12个单测 + 74个原有 voice_clone 测试,共86个全绿。
xiaoxia added 1 commit 2026-07-30 14:04:04 +08:00
feat(#1196): /voices?type=clone从克隆音色档案读取(智能剪辑配音可选克隆音色)
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 / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1m8s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m27s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m33s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m2s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 2m30s
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Waiting to run
CI/CD Pipeline / Frontend Lint (pull_request) Waiting to run
CI/CD Pipeline / Frontend Unit Tests (pull_request) Waiting to run
CI/CD Pipeline / PR Build API Image (pull_request) Waiting to run
CI/CD Pipeline / PR Build Web Image (pull_request) Waiting to run
CI/CD Pipeline / PR Build Worker Image (pull_request) Waiting to run
CI/CD Pipeline / Staging E2E Tests (pull_request) Waiting to run
CI/CD Pipeline / Staging API Integration Tests (pull_request) Waiting to run
CI/CD Pipeline / Build Production API Image (pull_request) Blocked by required conditions
CI/CD Pipeline / Build Production Web Image (pull_request) Blocked by required conditions
CI/CD Pipeline / Build Production Worker Image (pull_request) Blocked by required conditions
CI/CD Pipeline / Deploy Production (pull_request) Blocked by required conditions
CI/CD Pipeline / Production Browser E2E (pull_request) Blocked by required conditions
CI/CD Pipeline / ACR Image Cleanup (pull_request) Waiting to run
CI/CD Pipeline / Canary Release to Production (pull_request) Blocked by required conditions
CI/CD Pipeline / CI Gate (pull_request) Blocked by required conditions
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
4940a35cf9
- 克隆音色改为从 voice_clone_profile 读取 ready 状态的音色模型
- 原配音库 clone 条目语义是「配音作品」,与「音色选项」语义不符
- 新增 _clone_profile_to_unified_response 转换函数
- 默认返回 ready 状态,支持 status=all 或具体状态过滤
- 12 个单元测试覆盖分页/状态过滤/字段校验等场景

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1202 | | 预览链接 | [https://pr-1202.preview.xiaoxiajianji.com](https://pr-1202.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia added 1 commit 2026-07-30 14:34:55 +08:00
fix(lint): 移除voices.py未使用的VoiceCloneStatus导入
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 7s
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 / Validate - Type Check (mypy) (pull_request) Successful in 1m16s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m16s
AI Code Review / AI Code Review (pull_request) Failing after 1m32s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 57s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m7s
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 Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Code Quality (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build 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 Approve on CI Green (pull_request) Has been cancelled
a7fe0efc24
xiaoxia force-pushed feat/voices-clone-from-profile-1196 from e039287016 to a7fe0efc24 2026-07-30 14:34:55 +08:00 Compare
auto-approve-bot added 1 commit 2026-07-30 14:37:18 +08:00
style: auto-format with black + isort + prettier [skip ci-format-check]
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 / Check if frontend-only change (pull_request) Successful in 59s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m54s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m4s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m2s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 46s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m30s
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 57s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 2m6s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m2s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m57s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 5m23s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 4m0s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 4m35s
CI/CD Pipeline / Build Production API 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 / Canary Release to Production (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
AI Code Review / AI Code Review (pull_request) Successful in 5m56s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m37s
CI/CD Pipeline / CI Gate (pull_request) Successful in 5s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 32s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 53s
ef74a30700
Collaborator

代码审查结果 - PR #1202

⚠️ 问题(0个需要修改)

💡 建议(2个可选)

  1. 文件权限设置不当apps/api/app/api/routes/voices.pytests/unit/test_voices_clone_from_profile.py 被修改为可执行权限(100755)。Python 源文件通常不需要可执行权限,建议保持默认的 644 权限,以符合规范并避免不必要的 Git diff 噪音。
  2. 硬编码默认值:在 apps/api/app/api/routes/voices.py_clone_profile_to_unified_response 函数中,voice_providerlanguage 的默认值使用了硬编码字符串("cosyvoice""zh-CN")。建议将这些魔法字符串提取为常量或配置项,以便于后续维护和多语言/多模型支持。

格式检查通过 | 逻辑审查需修改 | 建议关注性能


🤖 由 AI 代码审查机器人自动生成 | 2026-07-30 06:43:48 | 模型:

## 代码审查结果 - PR #1202 ### ⚠️ 问题(0个需要修改) ### 💡 建议(2个可选) 1. **文件权限设置不当**:`apps/api/app/api/routes/voices.py` 和 `tests/unit/test_voices_clone_from_profile.py` 被修改为可执行权限(`100755`)。Python 源文件通常不需要可执行权限,建议保持默认的 `644` 权限,以符合规范并避免不必要的 Git diff 噪音。 2. **硬编码默认值**:在 `apps/api/app/api/routes/voices.py` 的 `_clone_profile_to_unified_response` 函数中,`voice_provider` 和 `language` 的默认值使用了硬编码字符串(`"cosyvoice"` 和 `"zh-CN"`)。建议将这些魔法字符串提取为常量或配置项,以便于后续维护和多语言/多模型支持。 --- ✅ 格式检查通过 | ✅ 逻辑审查需修改 | ✅ 建议关注性能 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-07-30 06:43:48 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
auto-approve-bot approved these changes 2026-07-30 14:45:41 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

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

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot merged commit 265ec7460b into develop 2026-07-30 14:46:12 +08:00
auto-approve-bot deleted branch feat/voices-clone-from-profile-1196 2026-07-30 14:46:12 +08:00

🗑️ 预览环境已清理

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

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

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