const { prisma } = require('../src/models'); (async () => { // Reset all chapters with content to content_completed, clear audio const r = await prisma.bookChapter.updateMany({ where: { content: { not: null } }, data: { genStage: 'content_completed', audioUrl: '', audioDuration: 0, lrcLyrics: '', contentError: null } }); console.log(`Reset ${r.count} chapters to content_completed`); // Also reset book genStages const br = await prisma.book.updateMany({ where: { genStage: { notIn: ['draft', 'failed', 'outlining'] } }, data: { genStage: 'content_completed' } }); console.log(`Reset ${br.count} books to content_completed`); // Show counts console.log(`TtsTask: ${await prisma.ttsTask.count()}`); console.log(`AiCallLog: ${await prisma.aiCallLog.count()}`); await prisma.$disconnect(); })();