Browse by type
面向长篇创作的 AI 小说生成、续写、润色与故事连贯性管理平台。
MirrorNovel 将小说类型、写作人格、大纲、故事蓝图、章节计划和持续上下文结合到同一创作流程中。它包含用户端 Web、管理端 Web、uni-app 移动端和 Express 服务端。
| 能力 | 说明 |
|---|---|
| 小说生成 | 支持普通小说、轻小说、单章和整本两种创作模式 |
| 大纲与蓝图 | 先生成大纲,再让用户确认故事蓝图、阶段、支线和反转 |
| 连续性管理 | 持久化章节摘要、伏笔、角色状态、情绪曲线、事实和未决问题 |
| 写作人格 | 使用系统预设、手动模板或 AI 生成模板控制叙述声线和节奏 |
| 导入续写 | 导入 TXT 后保持已有剧情、人物和设定继续写作 |
| 润色与编辑 | 提供文本润色、去 AI 化、章节优化和编辑引擎工作流 |
| 模型线路 | 支持默认线路以及 outline、writing、reasoning、polish 的任务级线路 |
| 管理端 | 提供用户状态管理、基础概览和模型线路配置 |
| 多端 | 提供 Vue Web 用户端、管理端及 uni-app 移动端页面 |
.txt 小说文本后继续创作。写作人格由以下内容构成:
每本新作品保存已选人格快照,因此后来修改模板不会影响已经创建的小说。
用户端登录页提供“忘记密码”入口:
MirrorNovel/
├── server/ # Express + Mongoose 服务端
│ ├── config/ # 数据库、模型目录、题材、模板和编辑规则
│ ├── middleware/ # JWT 鉴权
│ ├── models/ # User、Novel、WritingPersona、SysConfig、VerificationCode
│ ├── routes/ # auth、novel、persona、admin
│ ├── services/ # AI、上下文、故事状态、编辑、采集辅助
│ └── tests/ # Node 内置测试
├── client/ # Vue 用户端 Web
│ └── src/
│ ├── views/ # 生成、续写、书架、润色、资料和认证页面
│ ├── stores/ # Pinia 状态
│ ├── router/ # 用户端路由
│ └── locales/ # 中英文文案
├── admin/ # Vue 管理端 Web
├── app/ # uni-app 移动端
├── docs/ # 补充文档
├── PROJECT_ARCHITECTURE.md # 当前代码的详细架构与 API 文档
└── LICENSE
git clone https://github.com/Aerdelan/MirrorNovel.git
cd MirrorNovel
cd server
npm install
cd ../client
npm install
cd ../admin
npm install
cd ../app
npm install
复制示例文件:
cd server
copy .env.example .env
在 macOS 或 Linux 中使用:
cp .env.example .env
然后编辑 server/.env。至少需要 MongoDB、JWT 和一个可用模型线路。
确保 MONGODB_URI 对应的 MongoDB 实例正在运行。例如:
mongod --dbpath /path/to/mongodb-data
Windows 使用服务安装时,可在“服务”中启动 MongoDB Server,或按本机 MongoDB 安装方式启动。
分别打开终端运行:
# 终端 1:服务端,默认 http://localhost:3000
cd server
npm run dev
# 终端 2:用户端,默认 http://localhost:5173
cd client
npm run dev
# 终端 3:管理端,默认 http://localhost:5174
cd admin
npm run dev
用户端和管理端通过 Vite 代理把 /api 请求转发到 http://localhost:3000。
如需使用依赖浏览器的内容导入辅助功能:
cd server
npx playwright install chromium
以下为安全的最小示例。请不要把真实密钥提交到仓库。
# server/.env
MONGODB_URI=mongodb://127.0.0.1:27017/mirrornovel
PORT=3000
JWT_SECRET=replace_with_a_long_random_secret
JWT_EXPIRES_IN=7d
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=replace_with_a_strong_password
ADMIN_NICKNAME=管理员
# 默认模型线路的 OpenAI-compatible 配置
AI_API_BASE=https://api.example.com/v1
AI_API_KEY=replace_with_your_api_key
AI_MODEL=your-model-name
# 邮箱验证码,可选;未配置时开发环境会在服务端日志中打印验证码
EMAIL_HOST=smtp.example.com
EMAIL_PORT=465
EMAIL_USERNAME=noreply@example.com
EMAIL_PASSWORD=replace_with_smtp_password
EMAIL_SECURE=true
启动时若管理员账号不存在,服务端会根据
ADMIN_EMAIL、ADMIN_PASSWORD和ADMIN_NICKNAME自动创建管理员。
默认线路使用 AI_API_BASE、AI_API_KEY 和 AI_MODEL。若使用不同模型提供商,请确认其接口兼容 Chat Completions 请求格式。
服务端预置以下线路 ID:
| ID | 环境变量前缀 |
|---|---|
normal_1 |
MODEL_NORMAL_1 |
normal_2 |
MODEL_NORMAL_2 |
advanced_1 |
MODEL_ADVANCED_1 |
vip |
MODEL_VIP |
svip |
MODEL_SVIP |
每条线路可设置:
MODEL_NORMAL_1_BASE_URL=https://api.example.com/v1
MODEL_NORMAL_1_API_KEY=replace_with_your_api_key
MODEL_NORMAL_1_MODEL=your-model-name
用户可在个人资料中选择默认线路,并针对 outline、writing、reasoning、polish 分别指定线路。管理员可在管理端统一维护线路地址、模型名和 API Key。
用户端可配置 Ollama 地址并查询可用模型。常见本机地址为:
http://localhost:11434
当 Web 前端与 Ollama 不在同一个设备时,需按 Ollama 文档配置监听地址和 CORS,并限制仅可信网络可访问。
.txt 文件,或粘贴已有正文。完整接口表、数据模型和数据流请阅读 PROJECT_ARCHITECTURE.md。
| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /api/auth/register |
注册 |
| POST | /api/auth/login |
登录 |
| POST | /api/auth/send-code |
注册验证码 |
| POST | /api/auth/send-reset-code |
密码重置验证码 |
| POST | /api/auth/reset-password |
重置密码 |
| GET/PUT | /api/auth/model-config |
获取/保存用户模型配置 |
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/novel/types |
基础类型列表 |
| GET | /api/novel/types/full |
完整分类数据 |
| POST | /api/novel/generate-outline |
生成大纲 |
| POST | /api/novel/generate-blueprint |
生成故事蓝图 |
| POST | /api/novel/generate |
SSE 小说生成 |
| POST | /api/novel/continue/:novelId |
SSE 续写 |
| POST | /api/novel/continue-import |
导入续写 |
| GET | /api/novel/bookshelf |
获取书架 |
| POST | /api/novel/polish |
SSE 文本润色 |
| 前缀 | 说明 |
|---|---|
/api/persona |
写作人格的列表、新建、编辑、克隆和 AI 生成 |
/api/admin/users |
管理用户 |
/api/admin/models |
管理模型线路 |
/api/admin/dashboard |
管理概览 |
# 服务端测试
cd server
npm test
# 用户端生产构建
cd ../client
npm run build
# 管理端生产构建
cd ../admin
npm run build
# uni-app H5 构建
cd ../app
npm run build:h5
服务端测试覆盖提示词与模型路由、故事状态、上下文记忆、生成 SSE、续写、暂停和章节重复保护等核心行为。
浏览器 / 移动端
│
├── 用户端静态资源
├── 管理端静态资源
│
▼
Express API 服务
│
├── OpenAI-compatible 模型服务 / Ollama
├── SMTP 邮箱服务
└── MongoDB
生产环境建议:
npm run build 生成的静态资源,并通过 Nginx、Caddy 或同类服务托管。.env、数据库文件、模型密钥、邮箱密码或任何生产凭据。本项目采用仓库中的 LICENSE 所声明的协议。使用、修改或分发前请阅读协议全文,并遵守所使用模型服务、第三方库和内容来源的相应条款。
An AI-assisted platform for long-form novel generation, continuation, polishing, and story continuity management.
MirrorNovel combines genre selection, writing personas, outlines, story blueprints, chapter plans, and persistent context in one workflow. It includes a Vue user web app, a Vue admin web app, a uni-app client, and an Express API.
git clone https://github.com/Aerdelan/MirrorNovel.git
cd MirrorNovel
cd server && npm install
cd ../client && npm install
cd ../admin && npm install
cd ../app && npm install
Create server/.env from the example, configure MongoDB, JWT, and at least one model route, then run:
# API: http://localhost:3000
cd server && npm run dev
# User web: http://localhost:5173
cd client && npm run dev
# Admin web: http://localhost:5174
cd admin && npm run dev
The Vite apps proxy /api requests to http://localhost:3000. MongoDB must be running before the API can start.
MONGODB_URI=mongodb://127.0.0.1:27017/mirrornovel
PORT=3000
JWT_SECRET=replace_with_a_long_random_secret
JWT_EXPIRES_IN=7d
AI_API_BASE=https://api.example.com/v1
AI_API_KEY=replace_with_your_api_key
AI_MODEL=your-model-name
Use the MODEL_<ROUTE>_BASE_URL, MODEL_<ROUTE>_API_KEY, and MODEL_<ROUTE>_MODEL variables for route-specific overrides. The available route IDs are normal_1, normal_2, advanced_1, vip, and svip.
cd server && npm test
cd ../client && npm run build
cd ../admin && npm run build
cd ../app && npm run build:h5
For the full architecture, route inventory, data models, and workflow diagrams, see PROJECT_ARCHITECTURE.md.
Keep .env, database files, API keys, SMTP credentials, and production passwords out of source control. Use HTTPS, restrict MongoDB network access, and add request rate limiting before production use.
See LICENSE.
browse all types & interfaces →
$ claude mcp add MirrorNovel \
-- python -m otcore.mcp_server <graph>