AI-Comic:基于 AI 技术的漫画生成与编辑项目

用户可通过该项目生成和编辑连载漫画剧集,将故事前提转化为可编辑的角色、故事节奏、分镜面板、对话气泡并导出 JSON。核心功能包括项目设置、角色卡片编辑、一键草稿生成、逐面板编辑及本地存储与导出。【此简介由AI生成】

Branch1Tags0

AI-Comic

AI-Comic is a local-first prototype for generating and editing serialized comic episodes. The first milestone is a web workspace that turns a project premise into editable characters, story beats, storyboard panels, dialogue bubbles, and exportable JSON.

Current MVP

  • Project setup for title, format, genre, audience, and visual style.
  • Character card editor with reusable appearance, personality, speech style, and reference notes.
  • One-click draft generation for episode outline and storyboard panels.
  • Per-panel editing for shot, camera, action, background, mood, dialogue, and image prompt.
  • Candidate image placeholders for later ComfyUI or image API integration.
  • Simple page/webtoon preview with dialogue bubbles rendered separately from artwork.
  • Local storage persistence and JSON export.
  • Optional dependency-free Python API for outline, storyboard, and candidate generation.

Run Without Backend

Open apps/web/index.html in a browser.

No package install is required. If the API is not running, the frontend automatically uses local deterministic draft logic.

Run With Local API

python services/api/server.py --port 8787

Then open:

http://127.0.0.1:8787/

The frontend will call:

  • POST /api/episodes/generate-outline
  • POST /api/episodes/generate-storyboard
  • POST /api/panels/generate-images

The current API returns deterministic draft data. It is designed as a stable contract for later LLM and ComfyUI integration.

For the current full local setup with ComfyUI image generation, see:

docs/runbook.md

Test

Run unit tests:

python -m unittest discover -s tests -v

Run the end-to-end API smoke test with mock text generation and SVG image generation:

python tests/smoke_api.py

Run a real six-frame character continuity test after ComfyUI is running:

.\scripts\continuity-self-test.ps1 -BoyRef D:\path\boy.png -GirlRef D:\path\girl.png

The script generates frames in this order: boy, boy, boy, boy, girl, boy. It writes an HTML contact sheet under outputs\continuity-test\... so identity, clothes, pose variety, and cross-character contamination can be checked without using the web UI.

Optional LLM Provider

By default, the API uses the deterministic mock provider. To use a real provider, copy the template and edit .env:

Copy-Item .env.example .env
notepad .env
python services/api/server.py --port 8787

For Kimi Code, .env should look like this:

AI_COMIC_LLM_PROVIDER=kimi-code
KIMI_API_KEY=your_kimi_code_key_here
KIMI_BASE_URL=https://api.kimi.com/coding/v1
KIMI_MODEL_NAME=kimi-for-coding
KIMI_REQUEST_TIMEOUT=90

The server also reads services/api/.env if you prefer keeping API settings next to the service. Real .env files are ignored by git; .env.example is committed as documentation.

Optional ComfyUI Images

The default image provider is svg, which creates instant local comic placeholders. To try real image generation through ComfyUI:

  1. Start ComfyUI with its API server enabled:
.\scripts\start-comfyui.ps1
  1. Open http://127.0.0.1:8188 and confirm ComfyUI loads.
  2. Put at least one checkpoint model in D:\AI\codex\ComfyUI\models\checkpoints.
  3. Confirm the checkpoint filename in ComfyUI.
  4. Edit .env:
AI_COMIC_IMAGE_PROVIDER=comfyui
AI_COMIC_IMAGE_FALLBACK=off
COMFYUI_BASE_URL=http://127.0.0.1:8188
COMFYUI_WORKFLOW_PATH=workflows/comfyui/text-to-image-api.json
COMFYUI_CHECKPOINT=your_checkpoint_name.safetensors
COMFYUI_WIDTH=832
COMFYUI_HEIGHT=1216
COMFYUI_STEPS=20
COMFYUI_CFG=7
COMFYUI_TIMEOUT=180
COMFYUI_MAX_CANDIDATES=1

If ComfyUI is unavailable or the workflow fails, the API falls back to SVG placeholders so the UI workflow remains usable.

Planned Backend Integration

Recommended future stack:

  • Web: Next.js or the existing static prototype promoted into React.
  • API: Python FastAPI.
  • Workers: Redis + Celery/RQ/Dramatiq.
  • Storage: PostgreSQL + S3/MinIO.
  • Image backend: ComfyUI first, Diffusers later if deeper control is needed.

Repository Layout

apps/web/          Static MVP workspace
services/api/      Dependency-free API prototype
docs/              Product and technical design docs
packages/schemas/  Shared JSON schema drafts

Introduction

用户可通过该项目生成和编辑连载漫画剧集,将故事前提转化为可编辑的角色、故事节奏、分镜面板、对话气泡并导出 JSON。核心功能包括项目设置、角色卡片编辑、一键草稿生成、逐面板编辑及本地存储与导出。【此简介由AI生成】

Customize your domain