ai-novel-studio README

The project's README from github.com/weike-zhang/ai-novel-studio. As one markdown file: README.md.

AI Novel Studio · AI 小说创作台

An AI novel generation platform with world building, interactive choices, and persistent character state.

简体中文 · Architecture · Run the web app

AI Novel Studio is an AI interactive fiction application built with Next.js and Go. Create a world, start a private journey, and choose what happens next. The server checks a model's proposed changes before committing them to the story.

For developers building narrative games or stateful AI applications, the useful part is the boundary between generated prose and stored facts: a model can propose an action, but it cannot rename an established character through a state patch.

See a valid turn commit and an invalid change fail

With Go 1.26 or newer, from the repository root:

cd services/server
go run ./cmd/demo

The demo uses the actual story engine with an in-memory repository and a deterministic fake provider. It needs no API key, database or Docker. Go may download module metadata on first use.

It commits a harbor scene, attempts to change a character's name, then checks that the rejected proposal leaves the committed version intact. This demonstrates validation behavior; it does not measure a real model's storytelling quality.

What is included

Part What you can inspect
Web application World discovery, authoring, private journeys, account flows and task progress
Story engine Frozen world snapshots, committed context, character and scene validation
Go API and worker Queued generation, model proposals, validation and transactional persistence
Data and contracts MySQL migrations, synthetic development data and an OpenAPI client
Model integration OpenAI-compatible requests, configurable endpoints and fallback handling

The public edition includes synthetic development content. It excludes the hosted site's catalog, original cover artwork, user data and production configuration. Payment-related code does not establish a live payment integration.

How a turn reaches the story

flowchart LR
  A[Player action] --> B[API and task reservation]
  B --> C[Outbox and RabbitMQ]
  C --> D[Go worker]
  S[Frozen world and committed state] --> D
  D --> E[Model proposal]
  E --> V[Validation]
  V --> T[MySQL transaction]
  T --> U[Web task progress]

The architecture guide connects each decision to its implementation and tests. The standalone demo uses an in-memory commit path; the full application uses the worker and database path.

Development

Node.js 22+ is required for the web application. From the repository root:

npm ci
npm run build:api-client
npm run test:web
npm run test:api-client
npm run tokens:check

For the Go packages:

cd services/server
go test ./...

Database, Redis, RabbitMQ and live-model integration tests require their explicit test environment variables. A default go test run does not prove those integrations work. Read development setup and the verification record before starting the full application.

Contribute

Useful contributions include a reproducible continuity failure, a focused validator regression test, or a clearer first-run instruction. Include the action, expected state and actual result; use synthetic data and remove credentials. See contributing and security reporting.

If you use these patterns in a story project, a star helps other developers find the implementation.

License

MIT. Dependency licenses remain applicable; see third-party notices.

ai-novel-studio (weike-zhang/ai-novel-studio)

Searching Database…

这是什么?AI Novel Studio 是一个用 Next.js 和 Go 构建的 AI 互动小说平台,你可以构建世界、开启一段私人旅程并选择接下来的发展,而服务器会在每项 AI 提议的更改保存之前进行验证。
它是开箱即用的应用,还是用来构建自己应用的框架?它是一个完整的 Web 应用——Next.js 前端加上 Go API 和 worker——而不是一个库,并且它自带一个独立演示,无需你自己接入任何外部服务即可运行。
我怎么试用它?在 Go 1.26+ 环境下从仓库根目录运行自带演示;它不需要 API 密钥、数据库或 Docker,会提交一个场景,然后展示一个无效的角色重命名提议如何被拒绝。运行完整 Web 应用还需要为 Next.js 前端安装 Node.js 22+。
运行完整应用(不只是演示)需要什么?除了前端所需的 Node.js 22+ 之外,完整应用还需要 MySQL、Redis 和 RabbitMQ,相关测试需要各自的显式测试环境变量;接入真实模型也需要自己的凭据。
演示能证明 AI 真的能写出好故事吗?不能——它只演示了无效的状态更改(例如给已定型的角色改名)会被拒绝,而有效的回合正常提交;它并不衡量真实模型的叙事质量。
它是为谁打造的?它面向构建叙事游戏或有状态 AI 应用的开发者,他们想要一个可运行的示例,展示如何把生成的文本与经验证、已持久化的故事事实分离开来。
它如何让角色在整个故事中保持一致?服务器在持久化之前会对照已提交的世界状态检查每项模型提议的更改,因此试图重命名或改动已定型角色的提议会被拒绝,而已提交的版本保持不变。
公开仓库包含真实支付功能或托管站点的内容吗?不包含——公开版本只附带合成的开发数据,不含托管站点的真实目录、封面插画、用户数据、生产配置以及任何可用的支付集成。
技术栈的两部分各自实际负责什么?Next.js 负责世界探索、创作、私人旅程和账号,Go 则运行 API 和 worker,负责排队生成任务、验证模型提议,并以事务方式把已提交的回合持久化到 MySQL。
我可以搭配任何 LLM 提供商使用吗?模型集成通过 OpenAI 兼容的请求进行,端点可配置并支持回退处理,因此你可以把它指向任何兼容的提供商,而不是硬编码的单一提供商。
Size
0.4 MB
Stars
234
Updated
CommitOct 03
Age
17d
Commits · 90 Days