easychen / book-by-ai

Generate high-quality books with AI
MIT License
228 stars 36 forks source link

Book By AI

Use AI to generate high-quality ebooks

简体中文 | English

AUTOMATIC BOOK GENERATION DEMO

  1. Manually input text: numbers within ten
  2. Total generation time: about 2 hours
  3. Cost: Around $0.6 (cost for generating 30 images)
  4. Online reading: English Book | 中文样书

Video Tutorial

in Chinese

Youtube | Bilibili

Prerequisites

  1. git
  2. nodejs
  3. terminal
  4. mdbook installed

How to Use

  1. Get OpenAI API key or deploy your own AiAPI
  2. git clone https://github.com/easychen/book-by-ai.git BBA
  3. cd BBA
  4. npm install
  5. cp .env.example .env
  6. Configure .env according to comments
  7. node bba.js book // Run full process from scratch
  8. Follow prompts to input content
  9. cd output// && mdbook serve // Preview locally
  10. cd output// && mdbook build // Generate html

Command Description

  1. node bba.js book@help // Show help
  2. node bba.js book@title // Generate title
  3. node bba.js book@index // Generate table of contents (chapters)
  4. node bba.js book@sections // Generate table of contents (sections)
  5. node bba.js book@write // Write section content
  6. node bba.js book@make // Generate mdbook project
  7. node bba.js book@addImage // Generate cover and section images
  8. node bba.js book@update // Rewrite a section
  9. node bba.js book@translate // Translate sections