From 4d1d118148d7e6fa83728959d97899fc168a181f Mon Sep 17 00:00:00 2001 From: imeepos Date: Thu, 31 Jul 2025 13:55:39 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E6=B7=BB=E5=8A=A0=E8=AF=AD=E9=9F=B3?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=8E=86=E5=8F=B2=E9=A1=B5=E9=9D=A2=E9=9F=B3?= =?UTF-8?q?=E9=A2=91=E4=BF=A1=E6=81=AF=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加详细的调试信息来诊断音频播放和下载功能问题: � 调试功能: - 打印原始记录数据和音频URL信息 - 统计音频文件的存在情况 - 在UI中显示每条记录的音频状态 - 追踪播放/下载按钮的显示条件 � 调试信息包括: - 记录状态和类型 - audio_url 和 local_file_path 的存在情况 - 按钮显示逻辑的判断结果 - 音频统计信息 这将帮助定位为什么已完成的记录看不到音频信息和无法下载的问题。 --- .../pages/tools/VoiceGenerationHistory.tsx | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/pages/tools/VoiceGenerationHistory.tsx b/apps/desktop/src/pages/tools/VoiceGenerationHistory.tsx index f013d09..bc636be 100644 --- a/apps/desktop/src/pages/tools/VoiceGenerationHistory.tsx +++ b/apps/desktop/src/pages/tools/VoiceGenerationHistory.tsx @@ -63,13 +63,30 @@ const VoiceGenerationHistory: React.FC = () => { // 调试:打印原始记录数据 console.log('🔍 原始记录数据:', allRecords); if (allRecords.length > 0) { - console.log('🔍 第一条记录状态:', { + console.log('🔍 第一条记录详细信息:', { + id: allRecords[0].id, status: allRecords[0].status, statusType: typeof allRecords[0].status, - statusValue: JSON.stringify(allRecords[0].status) + statusValue: JSON.stringify(allRecords[0].status), + audio_url: allRecords[0].audio_url, + local_file_path: allRecords[0].local_file_path, + hasAudio: !!(allRecords[0].audio_url || allRecords[0].local_file_path), + text: allRecords[0].text?.substring(0, 50) + '...' }); } + // 统计音频信息 + const audioStats = allRecords.reduce((stats, record) => { + stats.total++; + if (record.audio_url) stats.hasAudioUrl++; + if (record.local_file_path) stats.hasLocalPath++; + if (record.audio_url || record.local_file_path) stats.hasAnyAudio++; + if (record.status === 'completed') stats.completed++; + return stats; + }, { total: 0, hasAudioUrl: 0, hasLocalPath: 0, hasAnyAudio: 0, completed: 0 }); + + console.log('📊 音频统计信息:', audioStats); + // 标准化记录状态 const normalizedRecords = allRecords.map(record => ({ ...record, @@ -503,6 +520,17 @@ const VoiceGenerationHistory: React.FC = () => { {record.emotion && 情感: {record.emotion}} + {/* 调试:音频信息 */} +
+
调试信息:
+
+
状态: {record.status} (类型: {typeof record.status})
+
音频URL: {record.audio_url ? '✅ 有' : '❌ 无'} {record.audio_url && `(${record.audio_url.substring(0, 50)}...)`}
+
本地路径: {record.local_file_path ? '✅ 有' : '❌ 无'} {record.local_file_path && `(${record.local_file_path.substring(0, 50)}...)`}
+
显示按钮: {(record.audio_url || record.local_file_path) && record.status === SpeechGenerationRecordStatus.COMPLETED ? '✅ 是' : '❌ 否'}
+
+
+ {/* 时间信息 */}