fix(viral-video): 预设音色改用 voices/presets(带Bearer Token)+ 清理analyze-images冗余参数 #2128
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user