ExplosiveCoderflome/AI-Novel-Writing-Assistant
面向长篇小说创作的 AI Native 开源系统,用 Agent、世界观、写法引擎、RAG 和整本生产工作流,帮助新手从一句灵感走到完整小说。AI-native engine for end-to-end novel creation — from idea to full chapters, with structured planning, worldbuilding, and agent-driven workflows.
What it is
AI Novel Writing Assistant is an open‑source, full‑stack application that helps you write a complete long‑form novel with the help of large language models. It isn’t a simple “write a sentence, AI completes it” chat UI – it orchestrates a multi‑step production pipeline (planning, world‑building, character sheets, chapter generation, review, repair, and even spin‑off manga/short‑drama creation). The core of the system is built on LangChain and LangGraph agents that run inside an Express backend, while the front‑end is a React + Vite client. All data lives in a local SQLite database, with optional vector search via Qdrant for RAG (retrieval‑augmented generation).
Who it’s for
| Audience | Why it matters |
|---|---|
| Novice writers who have an idea but don’t know how to structure a whole book | The “automatic director” turns a single seed sentence into a full book outline, character roster, and chapter‑by‑chapter plan, letting the user follow a guided workflow. |
| Developers / AI researchers interested in agent‑based workflows, LangGraph orchestration, or AI‑native product design | The repo exposes the whole agent runtime, model‑routing, checkpoint/recovery logic, and RAG integration – a concrete example of a long‑chain AI application. |
| Content creators wanting to generate derivative comics or short‑drama scripts from a novel | Built‑in “derivative workshop” modules can turn generated chapters into visual storyboards and script drafts. |
Core features (as described in the README)
- Automatic Director – start from one inspirational line; the system proposes multiple full‑book directions, titles, world‑building, and character setups. Users can iterate on a direction or accept it and move to writing.
- Creative Hub / Agent Runtime – a unified UI where natural‑language intents are routed to the appropriate agent stage (planning, tool calls, status cards, etc.).
- Production chain – a pause‑able, resumable pipeline that links:
- book‑level framing → world & character prep → volume strategy → chapter pacing → chapter generation → AI review → quality repair → state back‑fill → next chapter.
- Checkpoint & recovery – each stage saves its state; if a model quota runs out or an error occurs, the workflow can be resumed from the last checkpoint.
- Role & world asset libraries – hierarchical character profiles (brief → deep) and a “world handbook” that can be queried via RAG during generation.
- Style Engine & anti‑AI rules – reusable writing‑style assets that can be toggled, combined, and applied during generation to avoid template‑like prose.
- RAG with Qdrant – book analysis (拆书) and knowledge‑base documents are indexed in Qdrant; embeddings are stored with deduplication and can be retrieved to inform later chapters.
- Derivative workshops – optional modules for generating manga panels or short‑drama scripts from the completed novel content.
- Desktop client – Windows installer (
Setup.exe) and a portable version for quick start, plus a GitHub Pages site that shows docs and demos. - Multi‑provider model routing – supports OpenAI, DeepSeek, SiliconFlow, xAI, etc.; each task (planning, generation, review, embedding) can be assigned a different model.
- Extensive documentation – >30 markdown docs covering installation, FAQ, step‑by‑step novel creation, architecture, and recovery guides.
How to get started (quick‑start summary)
- Prerequisites – Node 20.19 LTS (or newer) and pnpm ≥ 10.6.
- Install –
pnpm install(backend and frontend deps; Electron runtime is fetched only if you run the desktop version). - Configure – copy the example
.envfiles for the server and client, set at leastDATABASE_URL(SQLite works out‑of‑box) and an LLM API key. - Run –
pnpm devstarts the Express API onhttp://localhost:3000and the React UI onhttp://localhost:5173. - First use – open the UI, go to Settings → add your model API key, then start a new novel by entering a single inspirational sentence.
- (Optional) Enable RAG – set
RAG_ENABLED=trueand provide a Qdrant Cloud URL/API‑key to use vector search for world/knowledge retrieval.
Technical highlights
- Monorepo managed with pnpm workspaces (
client/,server/,shared/). - Backend: Express 5 + Prisma ORM (SQLite) + Zod for validation.
- AI orchestration: LangChain for LLM calls, LangGraph for multi‑step agent graphs and state management.
- Frontend: React 19, Vite, TanStack Query, Plate (rich‑text editor) – all written in TypeScript.
- RAG stack: Qdrant vector DB, configurable embedding providers, automatic chunk hashing to avoid duplicate vectors.
- Model routing UI – a dedicated settings page lets you hide/show individual provider models and assign them to specific tasks.
- Checkpoint system – each pipeline stage records its output in the SQLite DB; the UI can resume from any checkpoint without losing progress.
License & contribution
- Dual‑license: AGPL‑3.0 by default, with a commercial SaaS license available from the author.
- Contributions are accepted via pull‑requests; a CLA is required. The README lists a clear contribution guide and a list of high‑impact areas (stability of the production chain, novice onboarding, style engine, knowledge‑base back‑fill, etc.).
Bottom line
If you’re looking for a research‑grade example of how to chain LLM agents together for a real‑world, long‑duration creative task, or you simply want a tool that can take a single idea and help you finish a full novel (with optional comic/short‑drama spin‑offs), this repository provides a complete, documented, and runnable solution.
Related
- Project
- Project
- Project
- Project
- Project