# AiVideo POC

## What it does
- Input: a user creative prompt
- Output: a 3-scene narrated video `final_poc.mp4` (mock mode supported)

## Quick start (Docker)
`docker compose up` includes a **ComfyUI** service (default image `jamesbrink/comfyui:latest` from Docker Hub). If you use another registry image, set `COMFYUI_IMAGE` in the environment.

Build:

```bash
docker compose build
```

Run **mock pipeline** (no ComfyUI required):

```bash
docker compose run --rm aivideo python main.py --prompt "写一个温暖的城市夜景故事" --mock
```

Run with ComfyUI on host:
- Set `app.comfy_base_url` in `configs/config.yaml` to `http://host.docker.internal:8188`
- Ensure `workflow_api.json` exists in repo root

Then:

```bash
docker compose run --rm aivideo python main.py --prompt "写一个科幻追逐镜头短片"
```

## ComfyUI connectivity check

```bash
docker compose run --rm aivideo python scripts/check_comfy.py --base-url http://host.docker.internal:8188 --pretty
```

## Node.js bridge (stream scenes to browser)

Everything now runs **inside one container** (Node + Python).

```bash
docker compose up --build
```

Open `http://127.0.0.1:3000` and click “运行” to see `main.py --script-only` streaming scenes in real time.

## China mirrors
- **apt**: TUNA Debian mirrors (baked into `Dockerfile`)
- **pip**: `PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple`
- **npm**: `NPM_CONFIG_REGISTRY=https://registry.npmmirror.com`
