feat: 任务 3.15 克隆进度展示 — 轮询 Hook + 进度条 + 状态标签
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 162h42m48s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 162h42m54s

- 新增 useCloneProgress hook:processing 状态自动 3s 轮询,全部就绪后停止
- 新增 voiceClone API 层:VoiceClone 类型、CRUD 函数、进度模拟
- 重构 MyVoices.tsx:使用共享 API 和 hook,支持进度条/状态标签/轮询提示
- 重构 GeneratePage.tsx 克隆区域:调用 createVoiceClone API,显示进度和状态
- 新增 generate.css / my-voices.css 进度条、轮询提示、状态变体样式
This commit is contained in:
Audit Bot
2026-07-01 16:36:27 +08:00
committed by 灵应
parent 37e54cf713
commit c52be9b036
7 changed files with 413 additions and 199 deletions
+4
View File
@@ -1,6 +1,7 @@
/**
* 音色克隆 API
* 任务 3.11:替换 Mock 数据,对接后端真实 API(3.05)
* 任务 3.15:新增 progress 字段用于进度展示
*/
import apiClient from "./client";
@@ -16,6 +17,8 @@ export interface VoiceClone {
description: string;
duration_seconds: number;
status: VoiceCloneStatus;
/** 克隆进度 0-100,仅 processing 状态时有值 */
progress: number;
sample_url?: string;
language: string;
gender: string;
@@ -92,6 +95,7 @@ export const toVoiceClone = (profile: VoiceCloneProfile): VoiceClone => ({
description: profile.description || "",
duration_seconds: 0,
status: profile.status === "pending" ? "processing" : profile.status,
progress: 0,
sample_url: profile.source_audio_url || undefined,
language: profile.language || "",
gender: profile.gender || "",