import { PrismaClient } from '@prisma/client'; const p = new PrismaClient(); (async () => { const b43 = await p.book.findUnique({ where: { id: 43 }, include: { chapters: true } }); console.log('=== 线上 Book 43 ==='); console.log('genStage :', b43?.genStage); console.log('progress :', b43?.progress); console.log('errorMsg :', b43?.errorMsg); console.log('failedStage:', b43?.failedStage); console.log('chapters :', b43?.chapters.length); for (const c of b43?.chapters || []) { console.log(' #' + c.id, c.title, '|', c.genStage, '| audio=' + (c.audioUrl ? 'YES' : 'NO')); } const reportLike = await p.book.count({ where: { OR: [ { errorMsg: { startsWith: '[质量校验]' } }, { errorMsg: { startsWith: '[连贯性编辑]' } }, { errorMsg: { startsWith: '[改写优化]' } }, { errorMsg: { startsWith: '[改写降级]' } } ]}}); const audioStuck = await p.book.count({ where: { genStage: 'audio_generating', chapters: { some: { audioUrl: { not: '' } } } } }); console.log('--- 整体 ---'); console.log('errorMsg 残留报告:', reportLike); console.log('卡死书籍: ', audioStuck); await p.$disconnect(); })();