From 522668006fe367914e78d94dff956d285be292c4 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 1 Oct 2026 19:34:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(viral-video):=20=E9=A2=84=E8=AE=BE=E9=9F=B3?= =?UTF-8?q?=E8=89=B2=E6=94=B9=E7=94=A8=20voices/presets=EF=BC=88=E5=B8=A6B?= =?UTF-8?q?earer=20Token=EF=BC=89+=20=E6=B8=85=E7=90=86analyze-images?= =?UTF-8?q?=E5=86=97=E4=BD=99=E5=8F=82=E6=95=B0=20(#2128)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/viral-video/ViralVideoPage.tsx | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/apps/web/src/pages/viral-video/ViralVideoPage.tsx b/apps/web/src/pages/viral-video/ViralVideoPage.tsx index 6819a229d..83c3ad48f 100644 --- a/apps/web/src/pages/viral-video/ViralVideoPage.tsx +++ b/apps/web/src/pages/viral-video/ViralVideoPage.tsx @@ -26,6 +26,7 @@ import { } from "@ant-design/icons" import { Select, Input, message } from "antd" import { uploadAssetDirect, getAssetLibraries, getAssetsByKind, type AssetItem } from "@/api/assets" +import { fetchPresetVoices } from "@/api/voices" import { FUSION_LEVELS, STYLE_STRENGTHS, @@ -393,25 +394,21 @@ const ViralVideoPage: React.FC = () => { ), ) .catch(() => {}) - fetch("/api/v1/tts/presets", { credentials: "include" }) - .then((r) => (r.ok ? r.json() : [])) - .then((list: { voice_id?: string; id?: string; name?: string; display_name?: string }[]) => { - const arr = Array.isArray(list) ? list : [] + fetchPresetVoices() + .then((res) => { + const arr = Array.isArray(res?.items) ? res.items : [] setPresetVoices( arr.map((v) => ({ - id: v.voice_id || v.id || "", - name: v.display_name || v.name || v.voice_id || "预置音色", - desc: "系统音色", + id: v.voice_id, + name: v.name, + desc: v.description || v.tags?.join("/") || "系统音色", + sample_audio_url: v.preview_url || undefined, })), ) }) .catch(() => { - setPresetVoices([ - { id: "zh-CN-XiaoxiaoNeural", name: "晓晓", desc: "温柔女声" }, - { id: "zh-CN-YunxiNeural", name: "云希", desc: "活力男声" }, - { id: "zh-CN-YunjianNeural", name: "云健", desc: "专业男声" }, - { id: "zh-CN-XiaoyiNeural", name: "晓伊", desc: "甜美女声" }, - ]) + // 接口失败兜底 mock(与 PresetVoicePickerModal 内 MOCK_VOICES 一致) + setPresetVoices([]) }) }, []) @@ -763,7 +760,6 @@ const ViralVideoPage: React.FC = () => { const job = await analyzeViralImages({ images: readyImgs.map((i) => i.ossUrl as string), reference_video_url: task.refVideo?.ossUrl || undefined, - style_template_id: task.refVideo?.ossUrl ? undefined : undefined, style_strength: task.refVideo?.ossUrl ? task.styleStrength : undefined, }) setTask({ job, jobId: job.id })