[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72124":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},72124,"AI_NovelGenerator","YILING0013\u002FAI_NovelGenerator","YILING0013","使用ai生成多章节的长篇小说，自动衔接上下文、伏笔","",null,"Python",5266,948,27,69,0,37,98,388,111,114.93,"GNU Affero General Public License v3.0",false,"main",true,[],"2026-06-12 04:01:03","# 📖 Automatic Novel Generation Tool\n\n[中文文档](.\u002FREADME_zh-CN.md) | English\n\n> ~~Currently I don't have much energy to maintain this project. The project brings no revenue, and with graduation approaching I have many other priorities. If time permits in the future I may consider a refactor using newer technologies. — 2025\u002F09\u002F24~~\n>\n>- ~~**(2026\u002F03\u002F09):** This project will be refactored soon, featuring modern implementations and fresh creative concepts.~~\n>\n> **Update (2026\u002F03\u002F25):** The refactored version has completed initial development (only the main framework is done, features are not yet available) and will be uploaded to the dev branch within a week. Subsequent development will also be synchronized on the branch.\n\n\u003Cdiv align=\"center\">\n  \n✨ **Core Features** ✨\n\n| Module                | Key Capabilities                        |\n|-----------------------|-----------------------------------------|\n| 🎨 Novel Setting Workshop | Worldbuilding \u002F Character Design \u002F Plot Blueprint |\n| 📖 Intelligent Chapter Generation | Multi-stage generation to ensure plot coherence |\n| 🧠 State Tracking System | Character development trajectory \u002F Foreshadowing management |\n| 🔍 Semantic Search Engine | Vector-based long-term context consistency |\n| 📚 Knowledge Base Integration | Supports local document references |\n| ✅ Automatic Proofreading | Detects plot contradictions and logical conflicts |\n| 🖥 Visual Workbench | Full-process GUI for configuration \u002F generation \u002F proofreading |\n\n\u003C\u002Fdiv>\n\n> A multifunctional novel generator built on large language models. Helps you efficiently create long-form stories with consistent settings and rigorous logic.\n\n---\n\n## 📑 Table of Contents\n1. [Environment Preparation](#-environment-preparation)  \n2. [Project Structure](#-project-structure)  \n3. [Configuration Guide](#⚙️-configuration-guide)  \n4. [Run Instructions](#🚀-run-instructions)  \n5. [User Guide](#📘-user-guide)  \n6. [FAQ](#❓-faq)  \n\n---\n\n## 🛠 Environment Preparation\nEnsure the environment meets the following requirements:\n- **Python 3.9+** (recommended 3.10–3.12)\n- **pip** package manager\n- Valid API keys:\n   - Cloud services: OpenAI \u002F DeepSeek, etc.\n   - Local services: Ollama or other OpenAI-compatible interfaces\n\n---\n\n## 📥 Installation\n1. **Download the project**  \n    - Download the project ZIP from [GitHub](https:\u002F\u002Fgithub.com) or clone the repository:\n       ```bash\n       git clone https:\u002F\u002Fgithub.com\u002FYILING0013\u002FAI_NovelGenerator\n       ```\n\n\n2. **Install build tools (optional)**  \n    - If some packages fail to install, visit [Visual Studio Build Tools](https:\u002F\u002Fvisualstudio.microsoft.com\u002Fzh-hans\u002Fvisual-cpp-build-tools\u002F) to download and install C++ build tools required by some modules.\n    - By default the installer includes MSBuild only; make sure to select **C++ Desktop Development** from the workload list.\n\n3. **Install dependencies and run**  \n    - Open a terminal and change to the project directory:\n       ```bash\n       cd AI_NovelGenerator\n       ```\n    - (Optional) Create and activate virtual environment:\n       ```bash\n       python -m venv .venv\n       # if that doesn't work, try:\n       # python3 -m venv .venv\n       ```\n       ```\n       # On Windows:\n       .venv\u002FScripts\u002Factivate\n       ```\n       ```\n       # On Linux\u002FMac:\n       source .venv\u002Fbin\u002Factivate\n       ```\n    - Install project dependencies:\n       ```bash\n       pip install -r requirements.txt\n       ```\n    - After installation run the main program:\n       ```bash\n       python main.py\n       ```\n\nIf some dependencies are still missing, manually run:\n```bash\npip install \u003Cpackage-name>\n```\nto install them.\n\n\n## 🗂 Project Structure\n```\nnovel-generator\u002F\n├── main.py                      # Entry file, runs the GUI\n├── consistency_checker.py       # Consistency checks to prevent plot conflicts\n|—— chapter_directory_parser.py  # Directory parsing\n|—— embedding_adapters.py        # Embedding interface wrappers\n|—— llm_adapters.py              # LLM interface wrappers\n├── prompt_definitions.py        # AI prompt templates\n├── utils.py                     # Utility functions and file operations\n├── config_manager.py            # Configuration manager (API keys, base URL)\n├── config.json                  # User configuration (optional)\n├── novel_generator\u002F             # Core chapter generation logic\n├── ui\u002F                          # Graphical user interface\n└── vectorstore\u002F                 # (Optional) Local vector DB storage\n```\n\n---\n\n## ⚙️ Configuration Guide\n### 📌 Basic configuration (`config.json`)\n```json\n{\n   \"api_key\": \"sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\n   \"base_url\": \"https:\u002F\u002Fapi.openai.com\u002Fv1\",\n   \"interface_format\": \"OpenAI\",\n   \"model_name\": \"gpt-4o-mini\",\n   \"temperature\": 0.7,\n   \"max_tokens\": 4096,\n   \"embedding_api_key\": \"sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\n   \"embedding_interface_format\": \"OpenAI\",\n   \"embedding_url\": \"https:\u002F\u002Fapi.openai.com\u002Fv1\",\n   \"embedding_model_name\": \"text-embedding-ada-002\",\n   \"embedding_retrieval_k\": 4,\n   \"topic\": \"The protagonist of Star Rail travels to Genshin Impact's Teyvat continent, saves it, and develops complex relationships with its characters.\",\n   \"genre\": \"Fantasy\",\n   \"num_chapters\": 120,\n   \"word_number\": 4000,\n   \"filepath\": \"D:\u002FAI_NovelGenerator\u002Ffilepath\"\n}\n```\n\n### 🔧 Explanation\n1. **Generation model configuration**\n   - `api_key`: API key for the LLM service\n   - `base_url`: API endpoint (for local services use the Ollama address)\n   - `interface_format`: Interface mode\n   - `model_name`: Main generation model (e.g., gpt-4, claude-3)\n   - `temperature`: Creativity parameter (0–1, higher is more creative)\n   - `max_tokens`: Maximum model response length\n\n2. **Embedding model configuration**\n   - `embedding_model_name`: Embedding model name (e.g., Ollama's nomic-embed-text)\n   - `embedding_url`: Service endpoint\n   - `embedding_retrieval_k`: Number of nearest neighbors to retrieve\n\n3. **Novel parameters**\n   - `topic`: Core story theme\n   - `genre`: Genre\n   - `num_chapters`: Total number of chapters\n   - `word_number`: Target words per chapter\n   - `filepath`: Path to save generated files\n\n---\n\n## 🚀 Run Instructions\n### Method 1 — Run with Python\n```bash\npython main.py\n```\nThis launches the GUI for interactive use.\n\n### Method 2 — Build an executable\nIf you want to run the tool on machines without Python, package it with **PyInstaller**:\n```bash\npip install pyinstaller\npyinstaller main.spec\n```\nAfter packaging an executable (e.g., `main.exe` on Windows) will appear in the `dist\u002F` folder.\n\n---\n\n## 📘 User Guide\n1. **After launching the app, fill in the basic parameters:**  \n   - **API Key & Base URL** (e.g., `https:\u002F\u002Fapi.openai.com\u002Fv1`)  \n   - **Model name** (e.g., `gpt-3.5-turbo`, `gpt-4o`)  \n   - **Temperature** (0–1, controls creative variance)  \n   - **Topic** (e.g., \"AI uprising in a post-apocalyptic world\")  \n   - **Genre** (e.g., \"Sci-fi\" \u002F \"Fantasy\" \u002F \"Urban Fantasy\")  \n   - **Number of chapters** and **words per chapter** (e.g., 10 chapters × ~3000 words)  \n   - **Save path** (create a new output folder for results)\n\n2. **Click \"Step1. Generate Settings\"**  \n   - The system will generate, based on topic\u002Fgenre\u002Fchapter count:  \n     - `Novel_setting.txt`: Worldbuilding, characters, trigger points and foreshadowing.  \n   - You can view or edit these settings after generation.\n\n3. **Click \"Step2. Generate Directory\"**  \n   - The system will use `Novel_setting.txt` to produce:  \n     - `Novel_directory.txt`: Chapter titles and short prompts.  \n   - You can review and modify chapter titles and descriptions.\n\n4. **Click \"Step3. Generate Chapter Draft\"**  \n   - Before generating a chapter you can:  \n     - Set the chapter number (e.g., `1`)  \n     - Provide chapter-specific guidance in the \"This chapter guidance\" box  \n   - When you generate a chapter the system will:  \n     - Read prior settings, `Novel_directory.txt`, and finalized chapters  \n     - Use vector retrieval to recall relevant context for coherence  \n     - Produce an outline (`outline_X.txt`) and chapter text (`chapter_X.txt`)  \n   - You can view and edit the draft in the editor pane.\n\n5. **Click \"Step4. Finalize Current Chapter\"**  \n   - The system will:  \n     - Update the global summary (`global_summary.txt`)  \n     - Update character states (`character_state.txt`)  \n     - Update the vector store (so future chapters can use the latest info)  \n     - Update major plot points (e.g., `plot_arcs.txt`)  \n   - After finalizing you will see the finalized text in `chapter_X.txt`.\n\n6. **Consistency check (optional)**  \n   - Click the \"[Optional] Consistency Proofread\" button to scan the latest chapter for conflicts (character logic, plot contradictions, etc.).  \n   - If conflicts are detected, detailed messages will appear in the log area.\n\n7. **Repeat steps 4–6** until all chapters are generated and finalized.\n\n> Vector retrieval tips:\n> 1. Explicitly set the embedding interface and model name.\n> 2. For local Ollama embeddings start the Ollama service first:\n>    ```bash\n>    ollama serve  # Start the service\n>    ollama pull nomic-embed-text  # Download\u002Fenable the model\n>    ```\n> 3. Clear the `vectorstore` directory after switching embedding models.\n> 4. For cloud embeddings ensure the API permissions are enabled.\n\n---\n\n## ❓ FAQ\n### Q1: Expecting value: line 1 column 1 (char 0)\n\nThis error usually indicates the API did not return valid JSON—sometimes an HTML error page or other unexpected content was returned.\n\n### Q2: HTTP\u002F1.1 504 Gateway Timeout?\n\nCheck the stability of the API endpoint and network connectivity.\n\n### Q3: How do I switch Embedding providers?\n\nEnter the new provider settings in the GUI fields for embedding configuration.\n\n---\n\nIf you have further questions or feature requests, please open an issue on the project repository.\n","AI_NovelGenerator 是一个基于大型语言模型的自动长篇小说生成工具，能够自动生成多章节的小说，并确保情节连贯和伏笔合理设置。其核心功能包括世界观构建、角色设计、情节蓝图制定、智能章节生成、状态追踪系统（用于管理角色发展轨迹和伏笔）、基于向量的语义搜索引擎以保持长期上下文一致性、知识库集成支持本地文档引用以及自动校对检测逻辑矛盾等。整个过程通过图形界面实现配置、生成与校对的一体化操作。适用于需要高效创作具有丰富设定和严谨逻辑结构的故事场景，如网络文学创作、剧本编写等领域。",2,"2026-06-11 03:40:29","high_star"]