AI 小说工坊:主编 + 作家多模型协作写作应用

- Nuxt 4 + Nuxt UI 4 + AI SDK 7 + Drizzle/SQLite
- 主编规划大纲与章节简报、选派作家;作家流式写入章节文件并实时推送前端
- 逐章确认模式(默认)与自动模式;摘要与故事记忆
- 酒馆角色卡(PNG/JSON,V1-V3)与世界书导入
- 自定义最高优先级系统提示词、审稿/修改/多版本、任务日志与提示词检视
- 模拟 LLM 服务与端到端测试脚本

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jocay
2026-10-18 02:04:40 +08:00
commit 3c9b65d982
106 changed files with 16286 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { writeFile } from 'node:fs/promises'
import { eq } from 'drizzle-orm'
import { z } from 'zod'
/** 手动编辑版本正文(直接改写文件) */
export default defineEventHandler(async (event) => {
const v = getVersion(param(event))
if (!v) throw createError({ statusCode: 404, message: '版本不存在' })
if (v.status === 'writing') throw createError({ statusCode: 409, message: '该版本正在写作中,无法编辑' })
const { content } = await readJson(event, z.object({ content: z.string() }))
const chapter = getChapter(v.chapterId)
await writeFile(absPath(v.filePath), `# 第${chapter.index}章 ${chapter.title}\n\n${content}`, 'utf8')
useDb().update(tables.chapterVersions).set({ wordCount: countWords(content), status: 'done' }).where(eq(tables.chapterVersions.id, v.id)).run()
emitProject(chapter.projectId, { type: 'chapter', chapterId: chapter.id })
return { ok: true }
})