const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();

async function checkResults() {
  const audioIds = [
    'bc4f2bdd-6062-40a5-ae20-0767cbfbadd2',
    'd3597f27-e44d-4ed6-bfdf-2413bebacdbb'
  ];
  
  console.log('\n🎵 音频生成结果检查：\n');
  console.log('=' .repeat(60));
  
  for (let i = 0; i < audioIds.length; i++) {
    const audio = await prisma.audioRecord.findUnique({
      where: { audioId: audioIds[i] },
      select: {
        id: true,
        title: true,
        wordCount: true,
        status: true,
        audioUrl: true,
        audioDuration: true,
        errorMsg: true,
      }
    });
    
    console.log(`\n${i + 1}. ${audio?.title || '未知'}`);
    
    if (!audio) {
      console.log('   ❌ 未找到记录');
      continue;
    }
    
    console.log(`   字数: ${audio.wordCount}字`);
    console.log(`   状态: ${audio.status}`);
    
    if (audio.status === 'completed') {
      console.log(`   时长: ${audio.audioDuration}秒`);
      console.log(`   URL: ${audio.audioUrl}`);
      console.log(`   ✅ 生成成功！`);
    } else if (audio.status === 'failed') {
      console.log(`   ❌ 失败: ${audio.errorMsg}`);
    } else {
      console.log(`   ⏳ 生成中...`);
    }
  }
  
  console.log('\n' + '='.repeat(60));
  await prisma.$disconnect();
}

checkResults().catch(console.error);
