From 99c577751422b8919910f3c88f0f6667b9778566 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 9 Sep 2026 12:34:40 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20AI=E6=95=B0=E5=AD=97=E4=BA=BA=E5=85=8B?= =?UTF-8?q?=E9=9A=86=E9=9F=B3=E8=89=B2=E8=AF=95=E5=90=AC=E5=8A=A0=20Networ?= =?UTF-8?q?k/Console=20=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 请求前打印 voice_id/voice_name/voice_clone_profile_id - 响应后打印 audio_url 前80字符 + duration - catch 打印 HTTP status + response data + message - 帮助定位 /tts/preview 400/422/500/502 具体原因 --- .../components/PanelVoiceSelector.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx b/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx index ce7dffdfd..c0b975d82 100644 --- a/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx +++ b/apps/web/src/pages/ai-avatar/components/PanelVoiceSelector.tsx @@ -134,6 +134,14 @@ export function PanelVoiceSelector({ return } const targetId = voice.voice_clone_profile_id || voice.id + // DEBUG: 打印请求参数,帮助定位 /tts/preview 失败原因 + console.log("[AI数字人-克隆试听] previewTts 请求:", { + voice_id: targetId, + voice_name: voice.name, + voice_type: voice.type, + voice_clone_profile_id: voice.voice_clone_profile_id, + voice_id_field: voice.voice_id, + }) setPreviewingId(voice.id) try { const res = await previewTts({ @@ -141,6 +149,10 @@ export function PanelVoiceSelector({ voice_id: targetId, speed: 1.0, }) + console.log("[AI数字人-克隆试听] previewTts 响应:", { + audio_url: res.audio_url?.substring(0, 80), + duration: res.duration, + }) if (!res.audio_url) { setPreviewingId(null) message.error("合成试听失败:未返回音频") @@ -148,8 +160,14 @@ export function PanelVoiceSelector({ } previewCacheRef.current.set(targetId, res.audio_url) playAudioUrl(voice.id, res.audio_url) - } catch { + } catch (err) { setPreviewingId(null) + // DEBUG: 打印详细错误信息 + console.error("[AI数字人-克隆试听] previewTts 失败:", { + status: (err as { response?: { status?: number } })?.response?.status, + data: (err as { response?: { data?: unknown } })?.response?.data, + message: err instanceof Error ? err.message : String(err), + }) // apiClient 拦截器已统一 toast } return -- 2.54.0