import { z } from 'zod' /** 确认章节:生成摘要、更新故事记忆;continue=true 时接着写下一章 */ export default defineEventHandler(async (event) => { const chapter = getChapter(param(event)) const { continue: next } = await readJson(event, z.object({ continue: z.boolean().default(false) })) if (!chapter.activeVersionId) throw createError({ statusCode: 400, message: '本章还没有正文' }) runExclusive(chapter.projectId, next ? `确认第${chapter.index}章并继续` : `确认第${chapter.index}章`, async (signal) => { await approveChapter(chapter.projectId, chapter.id, signal) if (next) await runPipeline(chapter.projectId, signal) }) return { started: true } })