Skip to content

About

SuperNovel: An advanced AI-powered novel generation framework. Craft coherent, long-form narratives with multi-agent collaboration, dynamic plot structuring, and persistent world-building memory.

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“– SuperNovel

δΈ­ζ–‡ζ–‡ζ‘£ | English | ζ—₯本θͺž | FranΓ§ais

✨ Core Features ✨

Module Key Capabilities
🎨 Novel Setting Workshop Worldbuilding / Character Design / Plot Blueprint
πŸ“– Intelligent Chapter Generation Multi-stage generation to ensure plot coherence
🧠 State Tracking System Character development trajectory / Foreshadowing management
πŸ” Semantic Search Engine Vector-based long-term context consistency
πŸ“š Knowledge Base Integration Supports local document references
βœ… Automatic Proofreading Detects plot contradictions and logical conflicts
🌐 Apple-style Web UI FastAPI backend + responsive browser interface

A multifunctional novel generator built on large language models. Helps you efficiently create long-form stories with consistent settings and rigorous logic.


πŸ“‘ Table of Contents

  1. Tech Stack
  2. Project Structure
  3. Quick Start
  4. Configuration Guide
  5. User Guide
  6. FAQ

πŸ”§ Tech Stack

Layer Technology
Backend Python 3.11+, FastAPI, Uvicorn
Frontend Vanilla HTML/CSS/JS (Apple-style design)
LLM Integration LangChain + OpenAI SDK + Google Genai SDK + Azure SDK
Vector Database ChromaDB (via langchain-chroma)
Package Manager uv

Supports 10+ LLM providers: OpenAI, DeepSeek, Gemini, Azure OpenAI, Azure AI, Ollama, ML Studio, ι˜Ώι‡ŒδΊ‘η™Ύη‚Ό, η«ε±±εΌ•ζ“Ž, η‘…εŸΊζ΅εŠ¨, Grok.


πŸ—‚ Project Structure

SuperNovel/
β”œβ”€β”€ web/                           # Web application
β”‚   β”œβ”€β”€ app.py                     # FastAPI backend (REST API + WebSocket)
β”‚   └── static/
β”‚       β”œβ”€β”€ index.html             # Apple-style single-page UI
β”‚       β”œβ”€β”€ css/style.css          # Stylesheet
β”‚       └── js/app.js              # Frontend logic
β”‚
β”œβ”€β”€ novel_generator/               # Core generation engine
β”‚   β”œβ”€β”€ architecture.py            # Step 1: Novel architecture (4-stage pipeline)
β”‚   β”œβ”€β”€ blueprint.py               # Step 2: Chapter blueprint generation
β”‚   β”œβ”€β”€ chapter.py                 # Step 3: Chapter draft generation
β”‚   β”œβ”€β”€ finalization.py            # Step 4: Finalization (summary/roles/vectors)
β”‚   β”œβ”€β”€ knowledge.py               # Knowledge base file import
β”‚   β”œβ”€β”€ vectorstore_utils.py       # ChromaDB operations
β”‚   └── common.py                  # Retry logic, text cleaning, logging
β”‚
β”œβ”€β”€ llm_adapters.py                # LLM adapter factory (10+ providers)
β”œβ”€β”€ embedding_adapters.py          # Embedding adapter factory (6+ providers)
β”œβ”€β”€ config_manager.py              # Config load/save (JSON, atomic writes)
β”œβ”€β”€ consistency_checker.py         # LLM-driven consistency proofreading
β”œβ”€β”€ prompt_definitions.py          # Chinese prompt templates
β”œβ”€β”€ prompt_definitions_en.py       # English prompt templates
β”œβ”€β”€ chapter_directory_parser.py    # Blueprint text parser
β”œβ”€β”€ utils.py                       # File I/O, word count utilities
β”œβ”€β”€ config.example.json            # Configuration template
β”œβ”€β”€ pyproject.toml                 # Project metadata & dependencies
└── tests/                         # Unit tests

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • uv package manager (recommended) or pip

Installation

# Clone the repository
git clone https://github.com/StanleyChanH/SuperNovel
cd SuperNovel

# Install dependencies with uv (recommended)
uv sync

# Or with pip
pip install -e .

Run the Web App

# With uv (recommended)
uv run novel-web

# Or directly with uvicorn
uv run python -m uvicorn web.app:app --host 0.0.0.0 --port 8000

# Or with pip environment
python -m uvicorn web.app:app --host 0.0.0.0 --port 8000

Open your browser and navigate to http://localhost:8000

Legacy Desktop App (Optional)

The CustomTkinter desktop UI is available as an optional extra:

uv sync --extra desktop
uv run python main.py

βš™οΈ Configuration Guide

First-Time Setup

  1. Open the web UI at http://localhost:8000
  2. Navigate to the Config tab
  3. Add your LLM provider configuration (API key, base URL, model name, etc.)
  4. Optionally add an Embedding provider configuration
  5. Click Save Config

Configuration Structure (config.json)

{
  "llm_configs": {
    "My GPT": {
      "api_key": "sk-...",
      "base_url": "https://api.openai.com/v1",
      "interface_format": "OpenAI",
      "model_name": "gpt-4o-mini",
      "temperature": 0.7,
      "max_tokens": 4096,
      "timeout": 600
    }
  },
  "embedding_configs": {
    "My Embedding": {
      "api_key": "sk-...",
      "base_url": "https://api.openai.com/v1",
      "interface_format": "OpenAI",
      "model_name": "text-embedding-ada-002",
      "retrieval_k": 4
    }
  },
  "choose_configs": {
    "architecture_llm": "My GPT",
    "chapter_outline_llm": "My GPT",
    "final_chapter_llm": "My GPT",
    "consistency_review_llm": "My GPT"
  }
}

Supported LLM Providers

Provider Interface Format Notes
OpenAI "OpenAI" Official API
DeepSeek "DeepSeek" DeepSeek API
Google Gemini "Gemini" Google Genai SDK
Azure OpenAI "Azure OpenAI" Azure-hosted OpenAI
Azure AI "Azure AI" Azure AI Inference
Ollama "Ollama" Local models
ML Studio "ML Studio" Local OpenAI-compatible
ι˜Ώι‡ŒδΊ‘η™Ύη‚Ό "ι˜Ώι‡ŒδΊ‘η™Ύη‚Ό" Alibaba Cloud
η«ε±±εΌ•ζ“Ž "η«ε±±εΌ•ζ“Ž" ByteDance Volcano Engine
η‘…εŸΊζ΅εŠ¨ "η‘…εŸΊζ΅εŠ¨" SiliconFlow
Grok "Grok" xAI Grok

πŸ“˜ User Guide

Generation Pipeline

Step 1: Generate Architecture β†’ Novel_architecture.txt
Step 2: Generate Blueprint    β†’ Novel_directory.txt
Step 3: Generate Chapter      β†’ chapters/chapter_N.txt
Step 4: Finalize Chapter      β†’ Updates summary, characters, vectors

Step-by-Step Workflow

  1. Set novel parameters β€” Enter topic, genre, chapter count, words per chapter, and output directory.

  2. Step 1: Generate Architecture β€” Creates worldbuilding, character dynamics, initial character states, and plot architecture.

  3. Step 2: Generate Blueprint β€” Produces chapter titles, positions, roles, cliffhangers, and plot hooks for all chapters.

  4. Step 3: Generate Chapter β€” Select a chapter number and click generate. The system automatically retrieves context from the architecture, blueprint, summaries, character states, and previous chapters via semantic search.

  5. Step 4: Finalize Chapter β€” Updates the global summary, character states, vector database, and optionally expands the chapter if word count is insufficient.

  6. Consistency Check (Optional) β€” Compares settings against chapter content to detect contradictions.

  7. Repeat Steps 3–4 until all chapters are generated and finalized.

Vector Retrieval Tips

  • Explicitly set the embedding interface and model name in the config.
  • For local Ollama embeddings, start the service first:
    ollama serve
    ollama pull nomic-embed-text
  • Clear the vectorstore directory after switching embedding models.

❓ FAQ

Q: "Expecting value: line 1 column 1 (char 0)"

The API returned non-JSON content (possibly an HTML error page). Check your API key, base URL, and network connectivity.

Q: HTTP 504 Gateway Timeout

Check the stability of your API endpoint and network connection. Consider increasing the timeout value in your LLM config.

Q: How do I switch Embedding providers?

Add or edit an embedding configuration in the Config tab, then save.


🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

πŸ“„ License

This project is open source. Feel free to use and modify.

About

SuperNovel: An advanced AI-powered novel generation framework. Craft coherent, long-form narratives with multi-agent collaboration, dynamic plot structuring, and persistent world-building memory.

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages