# next-novel **Repository Path**: snail_tech/next-novel ## Basic Information - **Project Name**: next-novel - **Description**: 1111111111111111111 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-12 - **Last Updated**: 2026-07-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Next-Novel · 全自动化 AI 小说创作平台 > **当前进度**:后端 14 模块全部完成 + 前端 7 页面 + Docker 部署 + LLM 联调脚本 > 190/192 单元测试通过 + 前端构建通过 + 端到端 smoke 验证通过 ## 项目结构 ``` next-noval/ ├── backend/ # FastAPI 后端(14 模块) ├── frontend/ # Next.js 14 前端(7 页面) ├── docker-compose.yml # 生产部署配置 └── docs/ # 53+ 篇文档 ``` ## 后端(14 模块) ### L1 基础 - **llm** — 多 Provider + 自动降级 + 调用日志 + 成本估算 ### L2 资源 - **novel** — CRUD + 设置 + 阶段风格 + Adapter 跨模块 - **chapter** — CRUD + 7 状态机 + 草稿/发布 + 摘要 - **character** — CRUD + 关系 + 默认角色模板 - **world** — CRUD + 硬规则 + 违规检查 ### L3 能力 - **review** — 三层评审(Layer 1 规则 / Layer 2 LLM / Layer 3 多 Agent) - **pipeline** — 自动流转状态机(Outline → Chapter → Review → Rewrite loop) - **consistency** — 角色一致性 + 世界观一致性 + 上下文检索 - **auto_creation** — 全自动创作编排 + 暂停策略 + 伏笔追踪 - **style** — 风格字典 + 风格提取 + 阶段风格调度 ### 测试 ```bash cd backend .\venv\Scripts\python -m pytest tests/unit/ -v # 190 passed, 2 xfailed ``` ## 前端(7 页面) | 页面 | 路径 | 功能 | |------|------|------| | 工作台 | `/` | 小说项目列表 + 统计仪表盘 | | 新建小说 | `/novels/new` | 创建小说项目 | | 小说详情 | `/novels/[id]` | 章节列表 + 一键生成 + Pipeline 结果 | | 章节详情 | `/novels/[id]/chapters/[chapterId]` | 正文/大纲/评审历史 + 评审触发 | | 任务监控 | `/pipeline` | 实时任务状态(5s 自动刷新) | | 模型配置 | `/models` | LLM Provider + Model 列表 | | 系统设置 | `/settings` | 系统信息 + 模块清单 | ### 启动 ```bash cd frontend npm run dev # 开发模式 http://localhost:3000 npm run build # 生产构建 ``` ### 核心组件 - `StatusBadge` — 7 种状态 + 脉冲动画 - `ScoreCard` — 评分卡(4 种尺寸 + 颜色规则) - `ScoreRadar` — 5 维度雷达图(recharts) - `Sidebar` — 导航侧边栏(暗色主题) ## Docker 部署 ```bash # 一键启动(PostgreSQL + Redis + API + Web) docker-compose up -d # 服务端口: # PostgreSQL : 5432 # Redis : 6379 # Backend API : 8000 # Frontend : 3000 ``` ## LLM 联调 ```bash cd backend # 本地模式(直接调 service,用 SQLite) .\venv\Scripts\python scripts\e2e_llm_test.py # 远程模式(调 HTTP API,需先启动后端服务) .\venv\Scripts\python scripts\e2e_llm_test.py --remote http://localhost:8000 ``` ### 已配置 Provider ```yaml Provider: cloud-studio Base URL: https://aad1853bf32a40c9958de44251c5ef78--8081.ap-shanghai2.cloudstudio.club/v1 API Key: api-key-token-000000001 (Fernet 加密存储) Models: primary: st-glm-5.2 fallback: st-minimax-m3 Routing Rules (5 task types): outline_generation / chapter_generation / chapter_rewrite / review_layer2 / review_layer3 ``` ## 架构亮点 - **跨方言主键**:`BigInteger().with_variant(Integer, "sqlite")` — 测试用 SQLite,生产用 PG - **客户端生成 UUID**:避免 server_default 的 commit 后 lazy load - **Adapter 跨模块**:所有跨模块调用通过 Adapter(不直接 import 内部类) - **状态机工作流**:纯 Python 实现(无 LangGraph 外部依赖) - **三层评审**:规则引擎 + LLM 评分 + 多 Agent(条件触发) - **自动流转**:Outline → Chapter → Review → [Rewrite loop] → END/FAILED - **智能暂停**:里程碑/预算/失败/用户主动 ## API 端点 | 模块 | 端点数 | 路径前缀 | |------|--------|----------| | LLM | 15 | `/api/v1/llm` | | 小说 | 10+ | `/api/v1/novels` | | 章节 | 10+ | `/api/v1/novels/{id}/chapters` | | 角色 | 8+ | `/api/v1/characters` | | 世界 | 8+ | `/api/v1/worlds` | | 评审 | 5 | `/api/v1/reviews` | | 流水线 | 5 | `/api/v1/pipeline` | | 一致性 | 4 | `/api/v1/consistency` | | 全自动创作 | 10 | `/api/v1/auto-creation` + `/api/v1/foreshadowing` | | 风格 | 4 | `/api/v1/styles` |