debug: 添加语音生成历史页面音频信息调试
添加详细的调试信息来诊断音频播放和下载功能问题: � 调试功能: - 打印原始记录数据和音频URL信息 - 统计音频文件的存在情况 - 在UI中显示每条记录的音频状态 - 追踪播放/下载按钮的显示条件 � 调试信息包括: - 记录状态和类型 - audio_url 和 local_file_path 的存在情况 - 按钮显示逻辑的判断结果 - 音频统计信息 这将帮助定位为什么已完成的记录看不到音频信息和无法下载的问题。
This commit is contained in:
parent
4f133f3fbe
commit
4d1d118148
|
|
@ -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 && <span>情感: {record.emotion}</span>}
|
||||
</div>
|
||||
|
||||
{/* 调试:音频信息 */}
|
||||
<div className="mb-3 p-2 bg-yellow-50 border border-yellow-200 rounded text-xs">
|
||||
<div className="font-medium text-yellow-800 mb-1">调试信息:</div>
|
||||
<div className="text-yellow-700 space-y-1">
|
||||
<div>状态: {record.status} (类型: {typeof record.status})</div>
|
||||
<div>音频URL: {record.audio_url ? '✅ 有' : '❌ 无'} {record.audio_url && `(${record.audio_url.substring(0, 50)}...)`}</div>
|
||||
<div>本地路径: {record.local_file_path ? '✅ 有' : '❌ 无'} {record.local_file_path && `(${record.local_file_path.substring(0, 50)}...)`}</div>
|
||||
<div>显示按钮: {(record.audio_url || record.local_file_path) && record.status === SpeechGenerationRecordStatus.COMPLETED ? '✅ 是' : '❌ 否'}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 时间信息 */}
|
||||
<div className="flex items-center gap-4 text-xs text-gray-500">
|
||||
<div className="flex items-center gap-1">
|
||||
|
|
|
|||
Loading…
Reference in New Issue