Xinfan Chen
2026-05-12 5e6ffbc583163f0be7fb3207baf2964ae89f8b1d
merge branch main of github repo
2 files deleted
3 files added
58 files modified
2327 ■■■■■ changed files
.DS_Store patch | view | raw | blame | history
README.md 106 ●●●●● patch | view | raw | blame | history
README_EN.md 361 ●●●●● patch | view | raw | blame | history
aigc-director/.gitignore 3 ●●●●● patch | view | raw | blame | history
aigc-director/SKILL.md 36 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/.env.example 74 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/app.py 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/logging_config.py 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/routers/__init__.py 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/routers/configuration.py 28 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/routers/sessions.py 5 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/routers/workflow.py 82 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/schemas/pipelines.py 12 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api/schemas/project.py 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/config.py 340 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/config.yaml.example 42 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/agents/base_agent.py 6 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/agents/character_agent.py 10 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/agents/reference_agent.py 14 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/agents/script_agent.py 14 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/agents/storyboard_agent.py 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/agents/video_agent.py 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/orchestrator.py 64 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/docs/api.md 51 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/docs/session_format.md 77 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/image_client.py 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/image_dashscope.py 11 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/image_gpt.py 18 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/image_processor.py 28 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/image_seedream.py 28 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/llm_client.py 17 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/llm_dashscope.py 8 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/llm_deepseek.py 20 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/llm_gemini.py 12 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/llm_gpt.py 15 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/video_client.py 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/video_dashscope.py 14 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/video_kling.py 15 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/video_seedance.py 24 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/vlm_client.py 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/vlm_dashscope.py 5 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/vlm_gemini.py 12 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/models/vlm_gpt.py 23 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/pipelines/action_transfer.py 12 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/pipelines/digital_human.py 15 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/pipelines/standard.py 18 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/pyproject.toml 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/requirements.txt 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/uv.lock 103 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/app/settings/page.tsx 335 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/components/AppShell.tsx 26 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/components/HomePage.tsx 65 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/components/WorkflowPanel.tsx 3 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/components/pipelines/PipelinePage.tsx 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/lib/workflowApi.ts 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/next.config.ts 4 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/install.bat 8 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/install.sh 8 ●●●●● patch | view | raw | blame | history
aigc-director/references/init_project/init_all.md 10 ●●●●● patch | view | raw | blame | history
aigc-director/references/init_project/init_backend.md 22 ●●●●● patch | view | raw | blame | history
aigc-director/references/init_project/init_frontend.md 9 ●●●●● patch | view | raw | blame | history
aigc-director/references/pipelines/overview.md 9 ●●●●● patch | view | raw | blame | history
aigc-director/references/pipelines/static_short_video.md 65 ●●●●● patch | view | raw | blame | history
.DS_Store
Binary files differ
README.md
@@ -41,7 +41,8 @@
- `2026/3/27`: 🎬 AIGC-Claw 正式发布,支持从想法到视频生成全流程自动化,用户可随时介入调整。  
- `2026/4/6`: 🎭 AIGC-Claw 推出第二版,针对短剧进行优化。  
- `2026/4/9`: ♾️ AIGC-Claw 推出第三版,新增无限续写,剧情可自定义。
- `2026/4/29`: 🧩 新增静态短视频、动作迁移、数字人口播三个 Pipeline,并支持一键安装。
- `2026/4/29`: 🧩 新增文艺短视频、动作迁移、数字人口播三个 Pipeline,并支持一键安装。
- `2026/5/8`: ⚙️ 支持通过 WebUI 配置 API 与默认模型,支持一键安装。
## 📖 项目介绍
@@ -54,13 +55,13 @@
它不是单点式的文生视频工具,而是一条覆盖 **剧本策划 → 角色/场景设计 → 分镜规划 → 参考图生成 → 视频生成 → 后期剪辑** 的全流程生产线。相比只给你一个黑盒结果的闭源视频生成框架,AIGC-Claw是一个真正可协作的 AI 导演团队:前一阶段决定后一阶段,所有关键节点都能可视化、可编辑、可继续生成。
除主流程外,AIGC-Claw 也提供三个一次性 Pipeline,用于更轻量、更直接的视频生成任务:静态短视频、动作迁移和数字人口播。Pipeline 任务会实时推送进度与产物,生成结果和历史记录会在本地保留,便于继续查看、删除和复用。
除主流程外,AIGC-Claw 也提供三个一次性 Pipeline,用于更轻量、更直接的视频生成任务:文艺短视频、动作迁移和数字人口播。Pipeline 任务会实时推送进度与产物,生成结果和历史记录会在本地保留,便于继续查看、删除和复用。
## 🧩 新增 Pipeline
| Pipeline | 前端入口 | 说明 |
|---|---|---|
| **静态短视频** | 侧边栏「静态短视频」 | 支持「创作灵感 / 完整文案」两种输入。系统按句号切分旁白,为每个片段生成配图与语音,再合成为静态图文短视频;可选添加标题和字幕。 |
| **文艺短视频** | 侧边栏「文艺短视频」 | 支持「图片拼接 / 动态视频」和「创作灵感 / 完整文案」两组模式。系统按句号切分旁白,为每个片段生成配图与语音;图片拼接模式合成图文短视频,动态视频模式继续调用图生视频模型生成片段;可选添加标题和字幕。 |
| **动作迁移** | 侧边栏「动作迁移」 | 输入参考图片、动作视频和提示词,调用支持动作迁移能力的视频模型生成结果视频。 |
| **数字人口播** | 侧边栏「数字人口播」 | 输入人物图和口播文案,生成分句语音与数字人视频片段;多片段生成时会使用上一段尾帧衔接下一段,并用生成语音替换最终视频音轨。 |
@@ -269,7 +270,7 @@
| 🎬 **从创意到成片的全流程生成** | 一条链路打通剧本、角色、分镜、参考图、视频片段与后期剪辑,把零散生成能力升级为完整视频生产工作流。 |
| 🖼️ **分镜驱动的可控创作** | 通过结构化剧本、分镜规划与参考图生成,让角色一致性、镜头表达和画面风格更稳定、更可控。 |
| ✍️ **可修改、可续写、可继续生成** | 支持剧情 / 分镜智能续写,也支持角色、参考图、视频阶段修改后重新生成,避免每次都从头开始。 |
| 🧩 **轻量 Pipeline 任务** | 支持静态短视频、动作迁移、数字人口播三类一次性任务,适合快速生成图文短视频、动作迁移视频和口播视频。 |
| 🧩 **轻量 Pipeline 任务** | 支持文艺短视频、动作迁移、数字人口播三类一次性任务,适合快速生成图文/动态短视频、动作迁移视频和口播视频。 |
| 🏷️ **模型能力标签筛选** | 后端统一在 `models/config_model.py` 登记模型信息,并按文本、图像、视频、TTS、动作迁移等能力标签筛选可用模型。 |
| 📡 **实时任务状态和产物管理** | Pipeline 前端通过事件订阅获取进度和产物,历史记录按功能分区展示,并支持同步删除任务元数据和产物文件夹。 |
| 📲 **本地部署、多端协作、产物留存** | 支持 Web 界面、微信 / 飞书协作、OpenClaw Skill 集成,并对剧本、图片、视频片段和最终成片进行全链路留存。 |
@@ -298,7 +299,7 @@
install.bat
```
安装脚本会检查 Python、Node.js、npm 和 ffmpeg,安装后端与前端依赖,复制 `backend/.env.example` 为 `backend/.env`,并执行前端构建。安装完成后,先在 `backend/.env` 中填入模型服务 API Key,然后启动服务:
安装脚本会检查 Python、Node.js、npm 和 ffmpeg,安装后端与前端依赖,复制 `backend/config.yaml.example` 为 `backend/config.yaml`,并执行前端构建。安装完成后,先在 `backend/config.yaml` 中填入模型服务 API Key,并确认 `models` 中的主流程默认模型;也可以启动前端后通过侧边栏底部「设置」页面修改这些配置。配置完成后启动服务:
```bash
# 启动后端
@@ -331,9 +332,10 @@
# 安装后端依赖
uv sync
# 配置环境变量
cp .env.example .env
# 编辑 .env 填入 API Key
# 配置后端 YAML
cp config.yaml.example config.yaml
# 编辑 config.yaml 填入 API Key,并确认主流程默认模型
# 也可以启动前端后在「设置」页面修改
# 启动后端
uv run python api_server.py
@@ -396,29 +398,85 @@
- **Node.js**: 18+
- **npm**: 9+
### 后端环境变量
### 后端配置
在 `aigc-claw/backend/.env` 中配置:
后端配置统一保存在 `aigc-claw/backend/config.yaml`,采用小写、层级化 YAML 结构。可直接编辑该文件,也可以在前端侧边栏底部进入「设置」页面修改。
```bash
# LLM 配置
LLM_MODEL=deepseek-v3.2
VLM_MODEL=qwen3.6-plus
- `api_providers` 保存各模型服务平台的密钥、接口地址和代理开关。
- `models` 保存**主流程**首页使用的默认模型。前端创建项目时会先读取这些默认值,再把具体模型参数传给后端;后端不会再为主流程自动兜底选择模型,缺少模型参数会直接报错。
- Pipeline(文艺短视频、动作迁移、数字人口播)不使用这里的主流程默认模型,需要在对应 Pipeline 页面单独选择模型。
# 图像生成
IMAGE_T2I_MODEL=wan2.7-image
IMAGE_IT2I_MODEL=wan2.7-image
### 前端设置页面
# 视频生成
VIDEO_MODEL=wan2.7-i2v
VIDEO_RATIO=16:9
启动前后端后,可以在 Web 前端左侧边栏底部进入「设置」页面,无需手动编辑 YAML,也可以完成常用配置:
# API Keys
DASHSCOPE_API_KEY=your_key
ARK_API_KEY=your_key
DEEPSEEK_API_KEY=your_key
- 填写或更新 OpenAI、Gemini、DeepSeek、DashScope、火山方舟 ARK、Kling 等平台的 API Key / Access Key / Secret Key。
- 修改各 provider 的 `base_url`、`enable_proxy`,以及公共代理地址 `api_providers.common.proxy`。
- 选择主流程默认模型,包括 `llm`、`vlm`、`image_t2i`、`image_it2i`、`video`、`video_ratio` 和 `eval`。
- 保存后会写回 `backend/config.yaml`。API Key、代理和默认模型会被后续新建项目读取;`server.host`、`server.port` 等服务启动参数需要重启后端后完全生效。
```yaml
project_name: AIGC-Claw
server:
  host: 127.0.0.1
  port: 8000
  debug: false
api_providers:
  common:
    print_model_input: false
    proxy: ''
  openai:
    api_key: your_openai_key
    base_url: https://api.openai.com/v1
    enable_proxy: false
  gemini:
    api_key: your_gemini_key
    base_url: https://generativelanguage.googleapis.com/v1beta
    enable_proxy: false
  deepseek:
    api_key: your_deepseek_key
    base_url: https://api.deepseek.com/v1
    enable_proxy: false
  dashscope:
    api_key: your_dashscope_key
    base_url: https://dashscope.aliyuncs.com/api/v1
    enable_proxy: false
  ark:
    api_key: your_ark_key
    base_url: https://ark.cn-beijing.volces.com/api/v3
    enable_proxy: false
  kling:
    access_key: your_kling_access_key
    secret_key: your_kling_secret_key
    enable_proxy: false
models:
  llm: qwen3.5-plus
  vlm: qwen3.5-plus
  image_t2i: doubao-seedream-5-0-260128
  image_it2i: doubao-seedream-5-0-260128
  video: wan2.7-i2v
  video_ratio: '16:9'
  eval: qwen3.5-plus
```
`api_providers.common.proxy` 是唯一的代理地址。每个 provider 通过 `enable_proxy` 决定是否启用该代理,默认关闭,避免同一进程内不同模型调用互相污染。`server.host` / `server.port` 等服务启动参数保存后需要重启后端才会完全生效;API Key、代理配置和 `models` 中的主流程默认模型会被新的项目创建和模型调用读取。
### 密钥与模型对应关系
| 平台 | 配置字段 | 常用用途 |
|:---:|:---|:---|
| **OpenAI** | `api_providers.openai.api_key` / `base_url` | GPT 文本、视觉模型和 OpenAI 图像模型 |
| **Gemini** | `api_providers.gemini.api_key` / `base_url` | Gemini 文本、视觉模型 |
| **DeepSeek** | `api_providers.deepseek.api_key` / `base_url` | DeepSeek 文本模型 |
| **DashScope** | `api_providers.dashscope.api_key` / `base_url` | 通义千问、通义万相、Wan 图像/视频等 |
| **火山方舟 ARK** | `api_providers.ark.api_key` / `base_url` | Seedream 图像、Seedance 视频等 |
| **Kling** | `api_providers.kling.access_key` / `secret_key` / `base_url` | 可灵视频生成 |
只需要填写你实际选择模型所需的平台密钥。例如主流程默认图像模型是 `doubao-seedream-*` 时,需要配置 `ark.api_key`;默认视频模型是 `wan*` 时,需要配置 `dashscope.api_key`。如果在 Pipeline 页面选择了不同模型,也要确保对应平台的密钥已经填写。
### 可用模型
| 类型 | 模型 |
README_EN.md
@@ -18,18 +18,18 @@
    <img src="https://img.shields.io/github/forks/HITsz-TMG/AIGC-Claw?style=flat-square&logo=github" alt="Forks">
  </a>
  <img src="https://img.shields.io/badge/Python-3.9+-purple.svg" alt="Python">
  <a href="#method-2-openclaw-auto-setup">
  <a href="#method-3-openclaw-auto-setup">
    <img src="https://img.shields.io/badge/OpenClaw-Compatible-ff4444?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6IiBmaWxsPSJ3aGl0ZSIvPjwvc3ZnPg==" alt="OpenClaw Compatible">
  </a>
</h4>
<p align="center">
  <b><i><font size="5">Talk to <a href="https://github.com/openclaw/openclaw">OpenClaw</a> directly: "Generate a video of X" -> done.</font></i></b>
  <b><i><font size="5">Talk to <a href="https://github.com/openclaw/openclaw">OpenClaw</a> directly: "Generate a video about X" -> done.</font></i></b>
</p>
<div align="center">
📺 [**Bilibili**](https://space.bilibili.com/2031891503?spm_id_from=333.1007.0.0)  ▶️ [**YouTube**](https://www.youtube.com/@imryanxu)  📖 [**Integration Guide**](https://github.com/HITsz-TMG/AIGC-Claw/blob/main/README_EN.md#method-2-openclaw-auto-setup)  🌐 [**中文 README**](./README.md)  🦀 [**ClawHub**](https://clawhub.ai/hit-cxf/aigc-director)
🌐 [**中文 README**](./README.md)  📺 [**Bilibili**](https://space.bilibili.com/2031891503?spm_id_from=333.1007.0.0)  ▶️ [**YouTube**](https://www.youtube.com/@imryanxu)  📖 [**Integration Guide**](#method-3-openclaw-auto-setup)  🦀 [**ClawHub**](https://clawhub.ai/hit-cxf/aigc-director)
<a href="https://trendshift.io/repositories/24295" target="_blank"><img src="https://trendshift.io/api/badge/repositories/24295" alt="HITsz-TMG%2FAIGC-Claw | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
@@ -38,33 +38,169 @@
## 💥 News
- `2026/3/27`: 🎬 AIGC-Claw is officially released, supporting the full workflow from idea to finished video.
- `2026/4/6`: 🎭 AIGC-Claw v2 is launched, optimized for short dramas.
- `2026/4/9`: ♾️ AIGC-Claw v3 is launched, featuring infinite script continuation and customizable plots.
- `2026/3/27`: 🎬 AIGC-Claw was officially released, supporting an automated workflow from idea to finished video.
- `2026/4/6`: 🎭 AIGC-Claw v2 was released, optimized for short drama generation.
- `2026/4/9`: ♾️ AIGC-Claw v3 was released, adding infinite continuation and customizable plot development.
- `2026/4/29`: 🧩 Added three one-shot Pipelines: Artistic Short Video, Action Transfer, and Digital Human Talking Video, together with one-click installation.
- `2026/5/8`: ⚙️ Added WebUI configuration for API keys and default models, with one-click installation support.
## 📖 Overview
AIGC-Claw is an AI director system designed for creative video production. You only need to provide a single idea, a story outline, or even a vague concept, and the system will decompose it into an executable filmmaking workflow, continuously producing intermediate assets that can be reviewed, confirmed, revised, and delivered, until a complete final video is generated.
<p align="center">
  <img src="aigc-director-pics/workflow.png" width="100%" />
</p>
It is not just a one-shot "text-to-video" tool. Instead, it is a full production pipeline covering **script planning -> character and scene design -> storyboard planning -> reference image generation -> video generation -> post-production editing**. Rather than returning a black-box result, AIGC-Claw works more like a real collaborative AI director team: each stage informs the next, and every key node is visible, editable, and extensible.
AIGC-Claw is an AI director system for creative video production. **You only need to provide an idea, a story outline, or even a vague concept. The system will break it down into an executable filmmaking workflow, continuously producing intermediate assets that can be reviewed, confirmed, revised, and delivered, until a complete final video is generated.**
It is not a one-shot text-to-video tool. It is a full production line covering **script planning -> character and scene design -> storyboard planning -> reference image generation -> video generation -> post-production editing**. Instead of giving you a black-box result, AIGC-Claw behaves like a collaborative AI directing team: each stage informs the next, and every key node is visible, editable, and extensible.
In addition to the main workflow, AIGC-Claw provides three one-shot Pipelines for lighter and more direct generation tasks: Artistic Short Video, Action Transfer, and Digital Human Talking Video. Pipeline tasks push progress and artifacts in real time, and generated results plus history records are kept locally for review, deletion, and reuse.
## 🧩 New Pipelines
| Pipeline | Frontend Entry | Description |
|---|---|---|
| **Artistic Short Video** | Sidebar: "Artistic Short Video" | Supports both "Image Montage / Dynamic Video" and "Creative Inspiration / Full Script" modes. The system splits narration by periods, generates an image and voiceover for each segment, then either composes image-based clips or calls an image-to-video model for dynamic segments. Optional title and subtitles are supported. |
| **Action Transfer** | Sidebar: "Action Transfer" | Takes a reference image, an action video, and a prompt, then calls a video model with action-transfer capability to generate the result video. |
| **Digital Human Talking Video** | Sidebar: "Digital Human Talking Video" | Takes a character image and talking script, generates sentence-level speech and digital human video clips, uses the previous clip's tail frame to continue multi-clip generation, and replaces the final video audio with the generated speech. |
Pipeline metadata is saved under `aigc-director/aigc-claw/backend/code/data/tasks/<task_id>.json`. Images, audio, videos, and text outputs are saved under `aigc-director/aigc-claw/backend/code/result/task/<task_id>/`.
## 📺 AIGC-Claw Examples
## 🎬 Demo Gallery
### 📱 Series 1: A Programmer Uses OpenClaw to Acquire His Former Company After Being Laid Off (Realistic Short Drama)
> 8 episodes in total, an underdog story with twists and reversal. The first 6 episodes were generated initially, followed by 2 continued episodes.
<table>
<tr>
<td align="center" width="33%">
  <video src="https://github.com/user-attachments/assets/63c2f33c-da50-44f0-8c26-a65611479d6a" controls width="100%"></video>
    <td align="center" valign="top" width="25%">
      <a href="https://github.com/user-attachments/assets/1d095b82-3a72-4acc-9ca1-3ff4a6189232">
        <img src="https://github.com/user-attachments/assets/8d25f5a5-05dd-4253-8c47-712c949878d0" width="100%" alt="Play Episode 1">
      </a>
      <br><b>▶️ Episode 1</b><br>Laid Off
</td>
<td align="center" width="33%">
  <video src="https://github.com/user-attachments/assets/d7c65cad-05b9-46c8-ab0e-96e39909f978" controls width="100%"></video>
    <td align="center" valign="top" width="25%">
      <a href="https://github.com/user-attachments/assets/489c5343-6345-4bce-81dc-bf6012b9c1cf">
        <img src="https://github.com/user-attachments/assets/24f783f5-7a76-4ffc-ab3e-264e2ce2a198" width="100%" alt="Play Episode 2">
      </a>
      <br><b>▶️ Episode 2</b><br>Late-Night Departure, First Breakthrough
</td>
<td align="center" width="33%">
  <video src="https://github.com/user-attachments/assets/ec67546e-2d3d-4b34-b1ad-7d860a9bc1aa" controls width="100%"></video>
    <td align="center" valign="top" width="25%">
      <a href="https://github.com/user-attachments/assets/359809cf-678b-429c-bafa-55ff50fd3277">
        <img src="https://github.com/user-attachments/assets/7a21ad67-9e70-4ace-936a-593f55e3e576" width="100%" alt="Play Episode 3">
      </a>
      <br><b>▶️ Episode 3</b><br>AI Funding, Old Employer in Crisis
    </td>
    <td align="center" valign="top" width="25%">
      <a href="https://github.com/user-attachments/assets/5561a04a-5ab3-4099-bc63-2fdbcc48f8e9">
        <img src="https://github.com/user-attachments/assets/393fe76e-134b-461b-82e9-8956ce65321f" width="100%" alt="Play Episode 4">
      </a>
      <br><b>▶️ Episode 4</b><br>Acquiring Xingyao
    </td>
  </tr>
  <tr>
    <td align="center" valign="top">
      <a href="https://github.com/user-attachments/assets/ae4c3618-1990-4ff5-ad85-e09f23b08f7d">
        <img src="https://github.com/user-attachments/assets/405cf7ba-2cee-46c8-9579-a312cf634c02" width="100%" alt="Play Episode 5">
      </a>
      <br><b>▶️ Episode 5</b><br>Acquisition, Liquidation, New Life
    </td>
    <td align="center" valign="top">
      <a href="https://github.com/user-attachments/assets/4ddbb725-34d8-478b-97bc-5d7143f73101">
        <img src="https://github.com/user-attachments/assets/de9210e4-6f07-487b-9f09-77dc9078cce4" width="100%" alt="Play Episode 6">
      </a>
      <br><b>▶️ Episode 6</b><br>New Life, Looking Back
    </td>
    <td align="center" valign="top">
      <a href="https://github.com/user-attachments/assets/1c1e5970-aaea-44ba-b041-5d551905bfde">
        <img src="https://github.com/user-attachments/assets/a3ff09bc-b2cb-4f73-8905-ca08ab6c8de1" width="100%" alt="Play Episode 7">
      </a>
      <br><b>▶️ Episode 7</b><br>Technology Backfires
    </td>
    <td align="center" valign="top">
      <a href="https://github.com/user-attachments/assets/e56e6784-6e49-4891-b0bc-a32308dd2145">
        <img src="https://github.com/user-attachments/assets/fd3ad96f-5cab-4d6e-8af8-5b3fb0ba32af" width="100%" alt="Play Episode 8">
      </a>
      <br><b>▶️ Episode 8</b><br>Upholding Ethics, Getting Through Together
</td>
</tr>
</table>
<br>
### 🖥️ Series 2: The Village Teacher (Sci-Fi Comic Drama)
> 5 episodes in total, a tribute to the inheritance of civilization.
<table>
  <tr>
    <td align="center" valign="top" width="50%">
      <a href="https://github.com/user-attachments/assets/1ffe7b06-73e9-44cd-ad3f-afced5239f97">
        <img src="https://github.com/user-attachments/assets/23bd1ad9-800d-4b17-92be-a59f4f0f110f" width="100%" alt="Play Episode 1">
      </a>
      <br><b>▶️ Episode 1</b><br>The Last Lesson
    </td>
    <td align="center" valign="top" width="50%">
      <a href="https://github.com/user-attachments/assets/7547e5d3-872c-4344-8727-ee2be109797d">
        <img src="https://github.com/user-attachments/assets/f82f318d-75a0-4bfa-ae7c-a701d8e7726d" width="100%" alt="Play Episode 2">
      </a>
      <br><b>▶️ Episode 2</b><br>The Cleansing Plan
    </td>
  </tr>
  <tr>
    <td align="center" valign="top">
      <a href="https://github.com/user-attachments/assets/affed408-4df7-4ce7-9681-8f4ed45a6fcf">
        <img src="https://github.com/user-attachments/assets/0cb75e05-790e-4275-bcc0-50024dd97114" width="100%" alt="Play Episode 3">
      </a>
      <br><b>▶️ Episode 3</b><br>A Dying Entrustment
    </td>
    <td align="center" valign="top">
      <a href="https://github.com/user-attachments/assets/dc7a85a8-6912-4443-a995-3d8f3ca30bc8">
        <img src="https://github.com/user-attachments/assets/56ecb510-3515-4a0c-ba51-364dd6b070b9" width="100%" alt="Play Episode 4">
      </a>
      <br><b>▶️ Episode 4</b><br>Questions of Life and Death
    </td>
  </tr>
  <tr>
    <td align="center" valign="top">
      <a href="https://github.com/user-attachments/assets/1fb889c5-0e2b-40fa-a438-7399322ada47">
        <img src="https://github.com/user-attachments/assets/0511bc7f-a380-4f31-8a77-e1d384787e40" width="100%" alt="Play Episode 5">
      </a>
      <br><b>▶️ Episode 5</b><br>Light of Civilization
    </td>
    <td align="center" valign="top">
      <!-- Empty cell to keep table layout aligned -->
    </td>
  </tr>
</table>
<br>
### 🎞️ More Demos
<details>
<summary>Standalone Micro-Drama Clips</summary>
<table>
  <tr>
    <td align="center" valign="top" width="33%">
      <video src="https://github.com/user-attachments/assets/63c2f33c-da50-44f0-8c26-a65611479d6a" controls width="100%" preload="none"></video>
      <br><b>London Mystery</b>
    </td>
    <td align="center" valign="top" width="33%">
      <video src="https://github.com/user-attachments/assets/d7c65cad-05b9-46c8-ab0e-96e39909f978" controls width="100%" preload="none"></video>
      <br><b>A Dog's Purpose</b>
    </td>
    <td align="center" valign="top" width="33%">
      <video src="https://github.com/user-attachments/assets/ec67546e-2d3d-4b34-b1ad-7d860a9bc1aa" controls width="100%" preload="none"></video>
      <br><b>Drone Delivers Lychees</b>
    </td>
  </tr>
</table>
</details>
<br>
<details>
<summary><b>Web Frontend</b></summary>
@@ -79,8 +215,10 @@
</div>
</details>
<br>
<details>
<summary><b>WeChat Integration</b></summary>
<summary><b>WeChat Interaction</b></summary>
<div align="center">
| | | | |
@@ -90,8 +228,10 @@
</div>
</details>
<br>
<details>
<summary><b>Feishu Integration</b></summary>
<summary><b>Feishu Interaction</b></summary>
<div align="center">
| | | | |
@@ -105,16 +245,59 @@
| Capability | Description |
|---|---|
| 🎬 **End-to-end generation from idea to final cut** | Connects scripts, characters, storyboards, reference images, video clips, and post-production into one complete workflow, upgrading scattered generation tools into a full video production pipeline. |
| 🖼️ **Storyboard-driven controllable creation** | Uses structured scripts, storyboard planning, and reference-image generation to improve character consistency, shot expression, and visual style control. |
| ✍️ **Editable, extensible, and regenerable** | Supports intelligent continuation of stories and storyboards, while also allowing edits and regeneration at the character, reference-image, and video stages, so you do not need to restart from scratch every time. |
| 📲 **Local deployment, multi-platform collaboration, and asset retention** | Supports a Web UI, WeChat and Feishu collaboration, OpenClaw Skill integration, and full-chain retention of scripts, images, video clips, and final outputs. |
| 🎬 **End-to-end generation from idea to final cut** | Connects scripts, characters, storyboards, reference images, video clips, and post-production into one complete workflow, upgrading scattered generation abilities into a full video production pipeline. |
| 🖼️ **Storyboard-driven controllable creation** | Uses structured scripts, storyboard planning, and reference image generation to make character consistency, shot expression, and visual style more stable and controllable. |
| ✍️ **Editable, continuable, and regenerable** | Supports intelligent continuation of plots and storyboards, while also allowing character, reference image, and video stages to be edited and regenerated without starting from scratch. |
| 🧩 **Lightweight Pipeline tasks** | Supports Artistic Short Video, Action Transfer, and Digital Human Talking Video as one-shot tasks for fast image/video shorts, action-transfer videos, and talking-head videos. |
| 🏷️ **Model capability tag filtering** | Backend model metadata is registered in `models/config_model.py`, and available models are filtered by capability tags such as text, image, video, TTS, and action transfer. |
| 📡 **Real-time task status and artifact management** | Pipeline pages subscribe to task events for progress and artifacts. History records are grouped by feature and support deleting both task metadata and output folders. |
| 📲 **Local deployment, multi-platform collaboration, and asset retention** | Supports Web UI, WeChat / Feishu collaboration, OpenClaw Skill integration, and full-chain retention of scripts, images, video clips, and final outputs. |
---
## 🚀 Quick Start
### Method 1: Manual Installation
### Method 1: One-Click Installation (Recommended)
```bash
# 1. Clone the repository
git clone https://github.com/HITsz-TMG/AIGC-Claw.git
cd AIGC-Claw
# 2. Enter the app directory and run the installer
cd aigc-director/aigc-claw
chmod +x install.sh
./install.sh
```
Windows users can run the following in PowerShell or CMD:
```bat
cd AIGC-Claw\aigc-director\aigc-claw
install.bat
```
The installer checks Python, Node.js, npm, and ffmpeg, installs backend and frontend dependencies, copies `backend/config.yaml.example` to `backend/config.yaml`, and builds the frontend. After installation, fill in model service API keys in `backend/config.yaml` and confirm the main-workflow default models under `models`. You can also start the frontend and edit these settings from the "Settings" page at the bottom of the sidebar. Then start the services:
```bash
# Start backend
cd aigc-director/aigc-claw/backend
uv run python api_server.py
# Start frontend in a new terminal
cd aigc-director/aigc-claw/frontend
npm start
```
By default, the backend runs at `http://localhost:8000`, and the frontend runs at `http://localhost:3000`.
If you only want to install dependencies and skip the frontend build temporarily, run:
```bash
AIGC_DIRECTOR_SKIP_FRONTEND_BUILD=1 ./install.sh
```
### Method 2: Manual Installation
```bash
# 1. Clone the repository
@@ -124,22 +307,21 @@
# 2. Configure and start the backend
cd aigc-director/aigc-claw/backend
# Create a virtual environment and install dependencies
python -m venv venv
source venv/bin/activate  # Linux/Mac
pip install -r requirements.txt
# Install backend dependencies
uv sync
# Configure environment variables
cp .env.example .env
# Edit .env and fill in your API keys
# Configure backend YAML
cp config.yaml.example config.yaml
# Edit config.yaml, fill in API keys, and confirm main-workflow default models
# You can also use the frontend Settings page after startup
# Start the backend
python api_server.py
# Start backend
uv run python api_server.py
# Service runs at http://localhost:8000
```
```bash
# 3. Configure and start the frontend (new terminal)
# 3. Configure and start the frontend in a new terminal
cd aigc-director/aigc-claw/frontend
npm install
npm run build
@@ -147,7 +329,9 @@
# Visit http://localhost:3000
```
### Method 2: OpenClaw Auto Setup
If `uv` is not installed, you can also create a Python virtual environment manually and install backend dependencies with `pip install -r requirements.txt`.
### Method 3: OpenClaw Auto Setup
Send this message to OpenClaw:
@@ -162,7 +346,7 @@
Use aigc-director to generate a video with the content "A Dog's Purpose".
```
### Method 3: Install via ClawHub
### Method 4: Install via ClawHub
Make sure `clawhub-cli` is installed locally.
@@ -172,19 +356,18 @@
clawhub install aigc-director
```
After installation, ClawHub will copy `aigc-director` into `workspace/skills` (or your specified skills directory).
After installation, ClawHub will copy `aigc-director` into `workspace/skills` or your specified skills directory.
After that, you can either follow Method 1 to build and run the project manually, or let OpenClaw handle the rest of the project setup.
Then you can follow Method 1 for one-click installation or Method 2 for manual setup, or let OpenClaw build and run the project for you.
The first time you use `aigc-director`, if you have not built the project manually, OpenClaw will automatically build and start both the backend and frontend, so no manual initialization is required. Please be patient, because project setup involves environment configuration and compilation.
The first time you use `aigc-director`, if the project has not been built manually, OpenClaw will automatically build and start both the backend and frontend. This may take some time because setup involves dependency installation and compilation.
---
## 🔧 Configuration
<details>
<summary><b>Click to expand full environment requirements and variables</b></summary>
<summary><b>Click to expand full requirements and configuration</b></summary>
### Requirements
@@ -192,38 +375,96 @@
- **Node.js**: 18+
- **npm**: 9+
### Backend Environment Variables
### Backend Configuration
Configure the following in `aigc-claw/backend/.env`:
Backend configuration is stored in `aigc-claw/backend/config.yaml` using a lowercase hierarchical YAML structure. You can edit this file directly, or open the frontend "Settings" page from the bottom of the sidebar.
```bash
# LLM configuration
LLM_MODEL=deepseek-v3.2
VLM_MODEL=qwen3.6-plus
- `api_providers` stores API keys, base URLs, and proxy toggles for each model provider.
- `models` stores default models for the **main workflow** home page. When creating a project, the frontend reads these defaults first and sends the concrete model parameters to the backend. The backend no longer silently chooses fallback models for the main workflow; missing model parameters will return an error.
- Pipelines (Artistic Short Video, Action Transfer, and Digital Human Talking Video) do not use these main-workflow defaults. Choose their models separately on each Pipeline page.
# Image generation
IMAGE_T2I_MODEL=wan2.7-image
IMAGE_IT2I_MODEL=wan2.7-image
### Frontend Settings Page
# Video generation
VIDEO_MODEL=wan2.7-i2v
VIDEO_RATIO=16:9
After starting both the backend and frontend, open the "Settings" page from the bottom of the left sidebar. You do not have to edit YAML manually for common configuration:
# API keys
DASHSCOPE_API_KEY=your_key
ARK_API_KEY=your_key
DEEPSEEK_API_KEY=your_key
- Fill in or update API Key / Access Key / Secret Key values for OpenAI, Gemini, DeepSeek, DashScope, Volcengine ARK, Kling, and other configured providers.
- Edit each provider's `base_url`, `enable_proxy`, and the shared proxy address `api_providers.common.proxy`.
- Select main-workflow default models, including `llm`, `vlm`, `image_t2i`, `image_it2i`, `video`, `video_ratio`, and `eval`.
- Saving writes the values back to `backend/config.yaml`. API keys, proxy settings, and default models are read by newly created projects; service startup fields such as `server.host` and `server.port` require restarting the backend to fully take effect.
```yaml
project_name: AIGC-Claw
server:
  host: 127.0.0.1
  port: 8000
  debug: false
api_providers:
  common:
    print_model_input: false
    proxy: ''
  openai:
    api_key: your_openai_key
    base_url: https://api.openai.com/v1
    enable_proxy: false
  gemini:
    api_key: your_gemini_key
    base_url: https://generativelanguage.googleapis.com/v1beta
    enable_proxy: false
  deepseek:
    api_key: your_deepseek_key
    base_url: https://api.deepseek.com/v1
    enable_proxy: false
  dashscope:
    api_key: your_dashscope_key
    base_url: https://dashscope.aliyuncs.com/api/v1
    enable_proxy: false
  ark:
    api_key: your_ark_key
    base_url: https://ark.cn-beijing.volces.com/api/v3
    enable_proxy: false
  kling:
    access_key: your_kling_access_key
    secret_key: your_kling_secret_key
    enable_proxy: false
models:
  llm: qwen3.5-plus
  vlm: qwen3.5-plus
  image_t2i: doubao-seedream-5-0-260128
  image_it2i: doubao-seedream-5-0-260128
  video: wan2.7-i2v
  video_ratio: '16:9'
  eval: qwen3.5-plus
```
`api_providers.common.proxy` is the only proxy address. Each provider decides whether to use it via `enable_proxy`, which is disabled by default, so different model calls in the same process do not pollute each other. Changes to service startup fields such as `server.host` and `server.port` require restarting the backend to fully take effect. API keys, proxy settings, and main-workflow defaults under `models` are read by new project creation and model calls.
### API Keys and Model Providers
| Provider | Config fields | Common use |
|:---:|:---|:---|
| **OpenAI** | `api_providers.openai.api_key` / `base_url` | GPT text/vision models and OpenAI image models |
| **Gemini** | `api_providers.gemini.api_key` / `base_url` | Gemini text and vision models |
| **DeepSeek** | `api_providers.deepseek.api_key` / `base_url` | DeepSeek text models |
| **DashScope** | `api_providers.dashscope.api_key` / `base_url` | Qwen, Wan image/video models, and related Alibaba Cloud services |
| **Volcengine ARK** | `api_providers.ark.api_key` / `base_url` | Seedream image models and Seedance video models |
| **Kling** | `api_providers.kling.access_key` / `secret_key` / `base_url` | Kling video generation |
You only need to fill in the provider keys required by the models you choose. For example, if the main workflow uses a `doubao-seedream-*` image model, configure `ark.api_key`; if it uses a `wan*` video model, configure `dashscope.api_key`. If you choose different models on a Pipeline page, make sure the corresponding provider key is also configured.
### Available Models
| Type | Models |
|:---:|:---|
| **LLM** | qwen3.5-plus, deepseek-chat, gpt-4o, gemini-2.5-flash |
| **VLM** | qwen-vl-plus, gemini-2.5-flash-image |
| **Text-to-Image** | doubao-seedream-5-0, jimeng_t2i_v40, wan2.6-t2i |
| **Image-to-Image** | doubao-seedream-5-0, jimeng_t2i_v40, wan2.6-image |
| **Video Generation** | wan2.6-i2v-flash, kling-v3, jimeng_ti2v_v30_pro |
| **LLM** | qwen3.6-max-preview, qwen3-max, deepseek-chat, deepseek-reasoner, deepseek-v4-flash, deepseek-v4-pro, gpt-4o, gpt-5, gpt-5.4, gemini-2.5-flash, gemini-2.0-flash, kimi-k2.6 |
| **VLM** | qwen3.6-plus, qwen3.6-flash, kimi-k2.6, gpt-5.4, gemini-2.5-flash-image, gemini-2.0-flash |
| **Text-to-Image** | wan2.7-image, wan2.7-image-pro, wan2.6-t2i, doubao-seedream-5.0/4.5/4.0, gpt-image-2 |
| **Image-to-Image** | wan2.7-image, wan2.7-image-pro, doubao-seedream-5.0/4.5/4.0, gpt-image-2 |
| **Video Generation** | wan2.7-i2v, wan2.6-i2v-flash, doubao-seedance-2.0 (Normal/Fast), kling-v3/v2.6/v2.5 |
Model information is defined in `aigc-director/aigc-claw/backend/models/config_model.py`. The frontend and Pipeline APIs filter models by capability tags, such as text generation, image generation, image-to-video, action transfer, and TTS.
</details>
@@ -243,5 +484,5 @@
<p align="center">
  <sub>Built with 🦞 by the HITsz-TMG team</sub>
  <sub>Built with 🦞 by the Lychee Agent team</sub>
</p>
aigc-director/.gitignore
@@ -12,3 +12,6 @@
*.pyc
# 忽略zip文件
*.zip
# 本地后端配置密钥
aigc-claw/backend/config.yaml
aigc-director/SKILL.md
@@ -1,6 +1,6 @@
---
name: aigc-director
description: AI 视频生成全流程:通过 6 个阶段(剧本→角色/场景设计→分镜→参考图→视频生成→后期剪辑)将用户想法转化为完整视频。支持临时工作台(单独调用 LLM、VLM、文生图、图生图、视频生成)和一次性短流程 Pipeline(静态短视频、动作迁移、数字人口播)。触发词:视频生成、AI视频、AIGC、创作视频、制作视频、AI画图、静态短视频、动作迁移、数字人口播。
description: AI 视频生成全流程:通过 6 个阶段(剧本→角色/场景设计→分镜→参考图→视频生成→后期剪辑)将用户想法转化为完整视频。支持临时工作台(单独调用 LLM、VLM、文生图、图生图、视频生成)和一次性短流程 Pipeline(文艺短视频、动作迁移、数字人口播)。触发词:视频生成、AI视频、AIGC、创作视频、制作视频、AI画图、文艺短视频、静态短视频、动作迁移、数字人口播。
license: MIT License
metadata:
  author: Lychee
@@ -53,7 +53,7 @@
> - `script/` - 剧本产物
> - `image/` - 图片产物(角色、场景、参考图)
> - `video/` - 视频产物
> - `task/<task_id>/` - Pipeline 产物(静态短视频、动作迁移、数字人口播)
> - `task/<task_id>/` - Pipeline 产物(文艺短视频、动作迁移、数字人口播)
>
> **Pipeline 元数据目录**:`aigc-claw/backend/code/data/tasks/<task_id>.json`
@@ -95,8 +95,8 @@
| 用户说 | 处理 |
|--------|------|
| "生成图片" | 临时工作台 (sandbox) |
| "生成视频" | 必须先询问:长视频(六阶段工作流)、静态短视频、动作迁移、数字人口播,还是临时工作台视频? |
| "静态短视频" / "图文短视频" / "旁白配图视频" | Pipeline:静态短视频,参考 `references/pipelines/static_short_video.md` |
| "生成视频" | 必须先询问:长视频(六阶段工作流)、文艺短视频、动作迁移、数字人口播,还是临时工作台视频? |
| "文艺短视频" / "静态短视频" / "图文短视频" / "旁白配图视频" | Pipeline:文艺短视频,参考 `references/pipelines/static_short_video.md` |
| "动作迁移" / "把动作迁到人物上" | Pipeline:动作迁移,参考 `references/pipelines/action_transfer.md` |
| "数字人口播" / "口播视频" / "商品口播" | Pipeline:数字人口播,参考 `references/pipelines/digital_human.md` |
| "分析图片" | 临时工作台 (sandbox) |
@@ -108,7 +108,7 @@
```
1. 检查后端运行状态 → 未运行则参考 start_backend.md 启动 → 等待3秒 → 再次检查
2. 检查前端运行状态 → 未运行则参考 start_frontend.md 启动 → 等待5秒 → 再次检查
3. 检查 API Key 配置 → 读取 .env 文件,确认所需 API Key 已配置
3. 检查 API Key 配置 → 读取 `aigc-claw/backend/config.yaml`,确认所需 API Key 已配置
4. 参考 create_project.md,询问用户剧情与集数相关配置(停点0),确认无误后接着确认生成参数选项(停点1)。全部确认完毕后 → 创建项目
5. 参考 create_script.md 执行剧本生成 → 停点2
6. 参考 create_character.md 执行角色设计 → 停点3
@@ -123,7 +123,7 @@
### 4. 执行一次性 Pipeline
当用户明确选择静态短视频、动作迁移或数字人口播时,不走六阶段停点流程,而是创建 Pipeline 任务:
当用户明确选择文艺短视频、动作迁移或数字人口播时,不走六阶段停点流程,而是创建 Pipeline 任务:
```
1. 检查后端运行状态
@@ -144,27 +144,27 @@
在创建项目前,必须检查用户选择的模型对应的 API Key 是否已配置:
```bash
# 读取 .env 文件检查配置
cat aigc-claw/backend/.env | grep -E "API_KEY|KEY"
# 读取 config.yaml 检查配置
sed -n '1,120p' aigc-claw/backend/config.yaml
# 必需的配置(根据选择的模型)
# LLM: DASHSCOPE_API_KEY / DEEPSEEK_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY
# 图片: ARK_API_KEY / DASHSCOPE_API_KEY
# 视频: DASHSCOPE_API_KEY / VOLC_ACCESS_KEY / KLING_ACCESS_KEY
# LLM: models.llm.api_key 或 api_providers.deepseek/openai/gemini/dashscope.api_key
# 图片: api_providers.ark.api_key 或 api_providers.dashscope.api_key
# 视频: api_providers.dashscope.api_key / api_providers.ark.api_key / api_providers.kling.access_key + secret_key
```
如果 API Key 未配置,需要提醒用户:
1. 告知缺少哪个平台的 API Key
2. 提供获取方式
3. 配置位置(`aigc-claw/backend/.env` 文件)
3. 配置位置(`aigc-claw/backend/config.yaml` 文件,或前端侧边栏底部「设置」页面)
4. 等待用户配置完成后才能继续
| 平台 | API Key 变量 | 获取链接 |
| 平台 | config.yaml 字段 | 获取链接 |
|------|--------------|----------|
| DeepSeek | `DEEPSEEK_API_KEY` | https://platform.deepseek.com/api_keys |
| 阿里云 DashScope | `DASHSCOPE_API_KEY` | https://bailian.console.aliyun.com/cn-beijing/?tab=home#/home |
| 字节火山方舟 | `ARK_API_KEY` 或 `VOLC_ACCESS_KEY`/`VOLC_SECRET_KEY` | https://www.volcengine.com/product/ark |
| 快手可灵 Kling | `KLING_ACCESS_KEY`/`KLING_SECRET_KEY` | https://klingai.com/cn/dev |
| DeepSeek | `api_providers.deepseek.api_key` | https://platform.deepseek.com/api_keys |
| 阿里云 DashScope | `api_providers.dashscope.api_key` 或 `models.llm.api_key` | https://bailian.console.aliyun.com/cn-beijing/?tab=home#/home |
| 字节火山方舟 | `api_providers.ark.api_key` | https://www.volcengine.com/product/ark |
| 快手可灵 Kling | `api_providers.kling.access_key` / `api_providers.kling.secret_key` | https://klingai.com/cn/dev |
---
@@ -305,7 +305,7 @@
| [generate_video.md](references/sandbox/generate_video.md) | 短视频生成 API | 用户要求生成15秒内视频时 |
| **pipelines/** | 一次性短流程 Pipeline | |
| [overview.md](references/pipelines/overview.md) | Pipeline 总览、任务状态、模型能力筛选 | 用户选择任一 Pipeline 时先读 |
| [static_short_video.md](references/pipelines/static_short_video.md) | 静态短视频 Pipeline | 用户要求静态短视频/旁白配图短视频时 |
| [static_short_video.md](references/pipelines/static_short_video.md) | 文艺短视频 Pipeline | 用户要求文艺短视频/静态短视频/旁白配图短视频时 |
| [action_transfer.md](references/pipelines/action_transfer.md) | 动作迁移 Pipeline | 用户要求动作迁移时 |
| [digital_human.md](references/pipelines/digital_human.md) | 数字人口播 Pipeline | 用户要求数字人口播/口播视频时 |
| **send_message/** | 消息发送 | |
aigc-director/aigc-claw/backend/.env.example
File was deleted
aigc-director/aigc-claw/backend/api/app.py
@@ -26,6 +26,7 @@
    stages_router,
    workflow_router,
    pipelines_router,
    configuration_router,
)
@@ -58,6 +59,7 @@
app.include_router(stages_router)
app.include_router(sandbox_router)
app.include_router(pipelines_router)
app.include_router(configuration_router)
logger.info("API routers registered")
aigc-director/aigc-claw/backend/api/logging_config.py
@@ -1,8 +1,8 @@
import logging
import os
import queue
import sys
from logging.handlers import QueueHandler, QueueListener
from config import Config
_listener = None
@@ -29,7 +29,7 @@
    if _listener is not None:
        return _listener
    level_name = os.getenv("LOG_LEVEL", "INFO").upper()
    level_name = "DEBUG" if Config.DEBUG else "INFO"
    level = getattr(logging, level_name, logging.INFO)
    log_queue = queue.Queue(-1)
aigc-director/aigc-claw/backend/api/routers/__init__.py
@@ -7,6 +7,7 @@
from .stages import router as stages_router
from .sandbox import router as sandbox_router
from .pipelines import router as pipelines_router
from .configuration import router as configuration_router
__all__ = [
    "health_router",
@@ -16,4 +17,5 @@
    "stages_router",
    "sandbox_router",
    "pipelines_router",
    "configuration_router",
]
aigc-director/aigc-claw/backend/api/routers/configuration.py
New file
@@ -0,0 +1,28 @@
from typing import Any, Dict
from fastapi import APIRouter
from pydantic import BaseModel, Field
from config import Config, CONFIG_PATH
router = APIRouter(tags=["Configuration"])
class ConfigUpdateRequest(BaseModel):
    values: Dict[str, Any] = Field(default_factory=dict)
@router.get("/api/config")
async def get_config():
    return {
        "config": Config.as_dict(),
        "path": str(CONFIG_PATH),
    }
@router.put("/api/config")
async def update_config(req: ConfigUpdateRequest):
    return {
        "config": Config.update_config(req.values),
        "path": str(CONFIG_PATH),
    }
aigc-director/aigc-claw/backend/api/routers/sessions.py
@@ -38,8 +38,8 @@
    # 清理孤立剧本
    script_dir = os.path.join(result_base, 'script')
    for f in os.listdir(script_dir):
        if f.startswith('script_') and f.endswith('.json'):
            sid = f.replace('script_', '').replace('.json', '')
        if f.endswith('.json'):
            sid = f[:-5]
            if sid not in session_ids:
                os.remove(os.path.join(script_dir, f))
                cleaned["scripts"].append(sid)
@@ -61,4 +61,3 @@
            cleaned["videos"].append(d)
    return {"status": "cleaned", "cleaned": cleaned}
aigc-director/aigc-claw/backend/api/routers/workflow.py
@@ -19,10 +19,28 @@
router = APIRouter(tags=["Workflow"])
REQUIRED_MODEL_FIELDS = (
    "llm_model",
    "vlm_model",
    "image_t2i_model",
    "image_it2i_model",
    "video_model",
)
def _require_model_fields(values: dict) -> None:
    missing = [field for field in REQUIRED_MODEL_FIELDS if not values.get(field)]
    if missing:
        raise HTTPException(
            status_code=400,
            detail=f"Missing required model configuration: {', '.join(missing)}",
        )
@router.post("/api/project/start")
async def start_project(req: ProjectStartRequest):
    final_idea = merge_uploaded_file_into_idea(req.idea, req.file_path)
    _require_model_fields(req.model_dump())
    session_id = str(int(time.time() * 1000))
    state = workflow_engine.get_or_create_state(session_id)
@@ -37,11 +55,11 @@
        "style": req.style or "realistic",
        "video_ratio": req.video_ratio or "9:16",
        "expand_idea": req.expand_idea if req.expand_idea is not None else True,
        "llm_model": req.llm_model or settings.LLM_MODEL,
        "vlm_model": req.vlm_model or settings.VLM_MODEL,
        "image_t2i_model": req.image_t2i_model or settings.IMAGE_T2I_MODEL,
        "image_it2i_model": req.image_it2i_model or settings.IMAGE_IT2I_MODEL,
        "video_model": req.video_model or settings.VIDEO_MODEL,
        "llm_model": req.llm_model,
        "vlm_model": req.vlm_model,
        "image_t2i_model": req.image_t2i_model,
        "image_it2i_model": req.image_it2i_model,
        "video_model": req.video_model,
        "enable_concurrency": req.enable_concurrency if req.enable_concurrency is not None else True,
        "web_search": req.web_search if req.web_search is not None else False,
        "episodes": req.episodes if req.episodes is not None else 4,
@@ -56,9 +74,12 @@
            "idea": final_idea,
            "file_path": req.file_path,
            "style": req.style,
            "llm_model": req.llm_model,
            "vlm_model": req.vlm_model,
            "episodes": req.episodes,
            "llm_model": meta["llm_model"],
            "vlm_model": meta["vlm_model"],
            "image_t2i_model": meta["image_t2i_model"],
            "image_it2i_model": meta["image_it2i_model"],
            "video_model": meta["video_model"],
            "episodes": meta["episodes"],
            "video_ratio": req.video_ratio,
        }
    }
@@ -78,6 +99,7 @@
        for k, v in state.meta.items():
            if v is not None and (k not in body or not body[k]):
                body[k] = v
    _require_model_fields(body)
    inject_user_selections(state, stage, body)
    cancellation_check, on_disconnect = make_cancellation(workflow_engine, session_id)
@@ -161,7 +183,7 @@
    按阶段分类处理:
    - 第二阶段(character_design): 修改 characters[]/settings[] 的 description
    - 第三阶段(storyboard): 修改 shots[] 的 duration/plot/visual_prompt
    - 第三阶段(storyboard): 修改 episodes[]/segments[]/shots[] 的分镜数据
    - 第四阶段(reference_generation): 修改 scenes[] 的 description(视觉提示词)
    - 第五阶段(video_generation): 修改 clips[] 的 duration/description
    """
@@ -181,18 +203,25 @@
    # ══════════════════════════════════════════════════════════════
    # 第三阶段:分镜修改
    # 修改 payload.shots[].duration / payload.shots[].plot / payload.shots[].visual_prompt
    # 当前结构为 episodes -> segments -> shots;segments 对应一次视频模型调用
    # 同步到:video_generation.clips[].duration, video_generation.clips[].description
    # ══════════════════════════════════════════════════════════════
    elif stage == "storyboard" and "shots" in body:
        # 清除 is_new 标记(确认新分镜)
        for shot in body['shots']:
            if 'is_new' in shot:
    elif stage == "storyboard" and any(k in body for k in ("episodes", "segments", "shots")):
        # 兼容旧 shots 格式:清除 is_new 标记
        for shot in body.get('shots', []):
            if isinstance(shot, dict) and 'is_new' in shot:
                shot['is_new'] = False
        # 从 body['segments'] 提取同步信息(修改后的逻辑按 segment 同步)
        # 从 episodes/segments 提取同步信息
        input_segments = list(body.get('segments', []))
        for ep in body.get('episodes', []):
            if isinstance(ep, dict):
                for seg in ep.get('segments', []):
                    if isinstance(seg, dict):
                        input_segments.append(seg)
        seg_info_list = []
        for seg in body.get('segments', []):
        for seg in input_segments:
            seg_id = seg.get('segment_id')
            if not seg_id: continue
            
@@ -203,7 +232,8 @@
            seg_info_list.append({
                "segment_id": seg_id,
                "desc": desc_video,
                "duration": total_dur
                "duration": total_dur,
                "visual_prompt": seg.get("visual_prompt", ""),
            })
        # 同步到 video_generation
@@ -217,7 +247,17 @@
                    clip['duration'] = target['duration']
                    clip['description'] = target['desc']
        # 移除 segments,避免覆盖 storyboard artifact
        # 同步到 reference_generation
        ref_art = state.artifacts.get('reference_generation', {})
        if isinstance(ref_art, dict) and 'scenes' in ref_art:
            for scene in ref_art['scenes']:
                s_id = scene.get('id')
                target = next((item for item in seg_info_list if item["segment_id"] == s_id), None)
                if target and target.get("visual_prompt"):
                    scene['description'] = target['visual_prompt']
        # 顶层 segments 是局部 patch 结构,不覆盖完整 storyboard artifact
        if "segments" in body and "episodes" not in body:
        body = {k: v for k, v in body.items() if k != "segments"}
        # 清除 new_shot_ids 标记
@@ -227,7 +267,7 @@
    # ══════════════════════════════════════════════════════════════
    # 第四阶段:参考图提示词修改
    # 修改 scenes[].description(视觉提示词)
    # 同步到:storyboard.shots[].visual_prompt
    # 同步到:storyboard.episodes[].segments[].visual_prompt
    # ══════════════════════════════════════════════════════════════
    elif stage == "reference_generation":
        if "segments" in body:
@@ -279,7 +319,7 @@
    # ══════════════════════════════════════════════════════════════
    # 第五阶段:视频片段修改
    # 修改 clips[].duration / clips[].description
    # 同步到:storyboard.shots[].duration / storyboard.shots[].plot
    # 同步到:storyboard.episodes[].segments[].total_duration
    # ══════════════════════════════════════════════════════════════
    elif stage == "video_generation":
        # 收集 clips 的修改
@@ -409,7 +449,7 @@
@router.get("/api/project/{session_id}/scene/{scene_number}/assets")
async def check_scene_assets(session_id: str, scene_number: int):
    state = workflow_engine.get_state(session_id)
    result_file = os.path.join(settings.RESULT_DIR, 'script', f'script_{session_id}.json')
    result_file = os.path.join(settings.RESULT_DIR, 'script', f'{session_id}.json')
    if not os.path.exists(result_file):
        return {"scene_number": scene_number, "reference_images": 0, "videos": 0}
aigc-director/aigc-claw/backend/api/schemas/pipelines.py
@@ -10,8 +10,8 @@
    segment_count: Optional[int] = Field(None, ge=1, le=20, description="Target narration segment count for inspiration mode")
    n_scenes: int = 5
    split_mode: str = "paragraph"
    llm_model: Optional[str] = None
    image_model: Optional[str] = None
    llm_model: str
    image_model: str
    video_model: Optional[str] = None
    video_mode: str = Field("image_concat", description="image_concat or dynamic_video")
    video_ratio: str = "9:16"
@@ -33,7 +33,7 @@
    prompt_text: str
    image_path: str
    video_path: str
    video_model: str = "wan2.7-videoedit"
    video_model: str
    duration: int = 5
    video_ratio: str = "9:16"
    resolution: Optional[str] = None
@@ -48,10 +48,10 @@
    goods_image_path: Optional[str] = None
    goods_title: Optional[str] = None
    goods_text: Optional[str] = None
    llm_model: Optional[str] = None
    image_model: Optional[str] = None
    llm_model: str
    image_model: str
    image_resolution: str = "1080P"
    video_model: str = "wan2.7-r2v"
    video_model: str
    duration: int = 5
    video_ratio: str = "9:16"
    resolution: Optional[str] = None
aigc-director/aigc-claw/backend/api/schemas/project.py
@@ -16,7 +16,7 @@
    video_model: Optional[str] = None
    enable_concurrency: Optional[bool] = True
    web_search: Optional[bool] = False
    episodes: Optional[int] = 4
    episodes: Optional[int] = None
class InterventionRequest(BaseModel):
aigc-director/aigc-claw/backend/config.py
@@ -1,106 +1,290 @@
import os
import copy
import logging
import os
from pathlib import Path
from typing import Any, Dict, Optional
# 尝试加载 .env 文件 (需要: pip install python-dotenv)
try:
    from dotenv import load_dotenv
    load_dotenv()
except ImportError:
    pass
import yaml
logger = logging.getLogger(__name__)
BASE_DIR = Path(__file__).resolve().parent
CONFIG_PATH = BASE_DIR / "config.yaml"
CONFIG_EXAMPLE_PATH = BASE_DIR / "config.yaml.example"
DEFAULT_CONFIG: Dict[str, Any] = {
    "project_name": "AIGC-Claw",
    "server": {
        "host": "127.0.0.1",
        "port": 8000,
        "debug": False,
    },
    "api_providers": {
        "common": {
            "print_model_input": False,
            "proxy": "",
        },
        "openai": {
            "api_key": "",
            "base_url": "https://api.openai.com/v1",
            "enable_proxy": False,
        },
        "gemini": {
            "api_key": "",
            "base_url": "https://generativelanguage.googleapis.com/v1beta",
            "enable_proxy": False,
        },
        "deepseek": {
            "api_key": "",
            "base_url": "https://api.deepseek.com/v1",
            "enable_proxy": False,
        },
        "dashscope": {
            "api_key": "",
            "base_url": "https://dashscope.aliyuncs.com/api/v1",
            "enable_proxy": False,
        },
        "ark": {
            "api_key": "",
            "base_url": "https://ark.cn-beijing.volces.com/api/v3",
            "enable_proxy": False,
        },
        "kling": {
            "base_url": "https://api-beijing.klingai.com",
            "access_key": "",
            "secret_key": "",
            "enable_proxy": False,
        },
    },
    "models": {
        "llm": "qwen3.5-plus",
        "vlm": "qwen3.5-plus",
        "image_it2i": "doubao-seedream-5-0-260128",
        "image_t2i": "doubao-seedream-5-0-260128",
        "video": "wan2.7-i2v",
        "video_ratio": "16:9",
        "eval": "qwen3.5-plus",
    },
}
def _deep_merge(base: Dict[str, Any], override: Dict[str, Any]) -> Dict[str, Any]:
    merged = copy.deepcopy(base)
    for key, value in (override or {}).items():
        if isinstance(value, dict) and isinstance(merged.get(key), dict):
            merged[key] = _deep_merge(merged[key], value)
        else:
            merged[key] = value
    return merged
def _get(data: Dict[str, Any], path: str, default: Any = None) -> Any:
    current: Any = data
    for part in path.split("."):
        if not isinstance(current, dict) or part not in current:
            return default
        current = current[part]
    return current
def _coerce_config(data: Dict[str, Any]) -> Dict[str, Any]:
    clean = _deep_merge(DEFAULT_CONFIG, data)
    clean.pop("llm", None)
    server = clean["server"]
    server["host"] = str(server.get("host") or DEFAULT_CONFIG["server"]["host"])
    try:
        server["port"] = int(server.get("port"))
    except (TypeError, ValueError):
        server["port"] = DEFAULT_CONFIG["server"]["port"]
    server["debug"] = _as_bool(server.get("debug"))
    server.pop("admin_password", None)
    common = clean["api_providers"]["common"]
    for key in ("local_proxy", "http_proxy", "https_proxy"):
        common.pop(key, None)
    common["print_model_input"] = _as_bool(common.get("print_model_input"))
    common["proxy"] = str(common.get("proxy") or "")
    if isinstance(clean["models"].get("llm"), dict):
        clean["models"]["llm"] = clean["models"]["llm"].get("model") or DEFAULT_CONFIG["models"]["llm"]
    for key, value in clean["models"].items():
        if isinstance(value, dict):
            for sub_key, sub_value in value.items():
                value[sub_key] = "" if sub_value is None else str(sub_value)
        else:
            clean["models"][key] = "" if value is None else str(value)
    for provider, values in clean["api_providers"].items():
        if provider == "common":
            continue
        for key, value in values.items():
            if key == "enable_proxy":
                values[key] = _as_bool(value)
            else:
                values[key] = "" if value is None else str(value)
    return clean
def _as_bool(value: Any) -> bool:
    if isinstance(value, bool):
        return value
    return str(value).strip().lower() in {"1", "true", "yes", "on"}
def load_config() -> Dict[str, Any]:
    if not CONFIG_PATH.exists():
        source = CONFIG_EXAMPLE_PATH if CONFIG_EXAMPLE_PATH.exists() else None
        if source:
            with source.open("r", encoding="utf-8") as f:
                loaded = yaml.safe_load(f) or {}
            return _coerce_config(loaded)
        return copy.deepcopy(DEFAULT_CONFIG)
    with CONFIG_PATH.open("r", encoding="utf-8") as f:
        loaded = yaml.safe_load(f) or {}
    if not isinstance(loaded, dict):
        raise ValueError("backend/config.yaml must contain a YAML mapping.")
    return _coerce_config(loaded)
def save_config(values: Dict[str, Any]) -> Dict[str, Any]:
    clean = _coerce_config(values)
    with CONFIG_PATH.open("w", encoding="utf-8") as f:
        yaml.safe_dump(clean, f, allow_unicode=True, sort_keys=False)
    return clean
CONFIG_VALUES = load_config()
class Config:
    # ==========================
    # 基础服务配置
    # ==========================
    HOST = os.getenv("HOST", "0.0.0.0")
    PORT = int(os.getenv("PORT", 8000))
    DEBUG = os.getenv("DEBUG", "True").lower() == "true"
    CONFIG = CONFIG_VALUES
    
    # 控制是否打印发送给模型的提示词/输入 (LLM, Image, Video)
    PRINT_MODEL_INPUT = os.getenv("PRINT_MODEL_INPUT", "False").lower() == "true"
    HOST = _get(CONFIG, "server.host")
    PORT = _get(CONFIG, "server.port")
    DEBUG = _get(CONFIG, "server.debug")
    
    # ==========================
    # 路径配置 (自动计算绝对路径)
    # ==========================
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))
    PRINT_MODEL_INPUT = _get(CONFIG, "api_providers.common.print_model_input")
    PROXY = _get(CONFIG, "api_providers.common.proxy")
    
    # 生成结果存放目录
    CODE_DIR = os.path.join(BASE_DIR, 'code')
    RESULT_DIR = os.path.join(CODE_DIR, 'result')
    OPENAI_API_KEY = _get(CONFIG, "api_providers.openai.api_key")
    OPENAI_BASE_URL = _get(CONFIG, "api_providers.openai.base_url")
    OPENAI_ENABLE_PROXY = _get(CONFIG, "api_providers.openai.enable_proxy")
    GEMINI_API_KEY = _get(CONFIG, "api_providers.gemini.api_key")
    GOOGLE_GEMINI_BASE_URL = _get(CONFIG, "api_providers.gemini.base_url")
    GEMINI_ENABLE_PROXY = _get(CONFIG, "api_providers.gemini.enable_proxy")
    DEEPSEEK_API_KEY = _get(CONFIG, "api_providers.deepseek.api_key")
    DEEPSEEK_BASE_URL = _get(CONFIG, "api_providers.deepseek.base_url")
    DEEPSEEK_ENABLE_PROXY = _get(CONFIG, "api_providers.deepseek.enable_proxy")
    DASHSCOPE_API_KEY = _get(CONFIG, "api_providers.dashscope.api_key")
    DASHSCOPE_BASE_URL = _get(CONFIG, "api_providers.dashscope.base_url")
    DASHSCOPE_ENABLE_PROXY = _get(CONFIG, "api_providers.dashscope.enable_proxy")
    ARK_API_KEY = _get(CONFIG, "api_providers.ark.api_key")
    ARK_BASE_URL = _get(CONFIG, "api_providers.ark.base_url")
    ARK_ENABLE_PROXY = _get(CONFIG, "api_providers.ark.enable_proxy")
    KLING_ACCESS_KEY = _get(CONFIG, "api_providers.kling.access_key")
    KLING_SECRET_KEY = _get(CONFIG, "api_providers.kling.secret_key")
    KLING_BASE_URL = _get(CONFIG, "api_providers.kling.base_url")
    KLING_ENABLE_PROXY = _get(CONFIG, "api_providers.kling.enable_proxy")
    
    # 临时文件目录
    TEMP_DIR = os.path.join(BASE_DIR, 'temp')
    LLM_API_KEY = DASHSCOPE_API_KEY
    LLM_BASE_URL = ""
    LLM_MODEL = _get(CONFIG, "models.llm")
    VLM_MODEL = _get(CONFIG, "models.vlm")
    IMAGE_IT2I_MODEL = _get(CONFIG, "models.image_it2i")
    IMAGE_T2I_MODEL = _get(CONFIG, "models.image_t2i")
    VIDEO_MODEL = _get(CONFIG, "models.video")
    VIDEO_RATIO = _get(CONFIG, "models.video_ratio")
    EVAL_MODEL = _get(CONFIG, "models.eval")
    
    # 会话数据目录
    SESSION_DIR = os.path.join(CODE_DIR, 'data', 'sessions')
    BASE_DIR = str(BASE_DIR)
    CODE_DIR = os.path.join(BASE_DIR, "code")
    RESULT_DIR = os.path.join(CODE_DIR, "result")
    TEMP_DIR = os.path.join(BASE_DIR, "temp")
    SESSION_DIR = os.path.join(CODE_DIR, "data", "sessions")
    TASK_DIR = os.path.join(CODE_DIR, "data", "tasks")
    TASK_RESULT_DIR = os.path.join(RESULT_DIR, "task")
    # 一次性 pipeline 任务数据目录
    TASK_DIR = os.path.join(CODE_DIR, 'data', 'tasks')
    TASK_RESULT_DIR = os.path.join(RESULT_DIR, 'task')
    @classmethod
    def as_dict(cls) -> Dict[str, Any]:
        return copy.deepcopy(cls.CONFIG)
    # ==========================
    # AI 模型 API 配置
    # ==========================
    # LLM (OpenAI / Gemini)
    OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
    OPENAI_BASE_URL = os.getenv("OPENAI_BASE_URL", "https://api.openai.com/v1")
    GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "")
    GOOGLE_GEMINI_BASE_URL = os.getenv("GOOGLE_GEMINI_BASE_URL", "")
    @classmethod
    def provider_proxy(cls, provider: str) -> str:
        provider_config = _get(cls.CONFIG, f"api_providers.{provider}", {})
        if not isinstance(provider_config, dict) or not _as_bool(provider_config.get("enable_proxy")):
            return ""
        return cls.PROXY or ""
    # Dashscope(Aliyun) API
    DASHSCOPE_API_KEY = os.getenv("DASHSCOPE_API_KEY", "")
    DASHSCOPE_BASE_URL = os.getenv("DASHSCOPE_BASE_URL", "https://dashscope.aliyuncs.com/api/v1")
    @classmethod
    def requests_proxies(cls, provider: str) -> Optional[Dict[str, str]]:
        proxy = cls.provider_proxy(provider)
        if not proxy:
            return None
        return {"http": proxy, "https": proxy}
    # 可灵 (Kling AI) API
    KLING_ACCESS_KEY = os.getenv("KLING_ACCESS_KEY", "")
    KLING_SECRET_KEY = os.getenv("KLING_SECRET_KEY", "")
    KLING_BASE_URL = os.getenv("KLING_BASE_URL", "https://api-beijing.klingai.com")
    @classmethod
    def update_config(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        clean = save_config(values)
        cls.CONFIG = clean
    # 字节跳动 ARK (Seedream) API
    ARK_API_KEY = os.getenv("ARK_API_KEY", "")
    ARK_BASE_URL = os.getenv("ARK_BASE_URL", "https://ark.cn-beijing.volces.com/api/v3")
        cls.HOST = _get(clean, "server.host")
        cls.PORT = _get(clean, "server.port")
        cls.DEBUG = _get(clean, "server.debug")
    # 管理员密码(用于删除历史记录等管理操作)
    ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD", "")
        cls.PRINT_MODEL_INPUT = _get(clean, "api_providers.common.print_model_input")
        cls.PROXY = _get(clean, "api_providers.common.proxy")
    # 代理设置
    PROXY = os.getenv("PROXY", "")
    LOCAL_PROXY = os.getenv("LOCAL_PROXY", PROXY)
    HTTP_PROXY = os.getenv("HTTP_PROXY", PROXY)
    HTTPS_PROXY = os.getenv("HTTPS_PROXY", PROXY)
        cls.OPENAI_API_KEY = _get(clean, "api_providers.openai.api_key")
        cls.OPENAI_BASE_URL = _get(clean, "api_providers.openai.base_url")
        cls.OPENAI_ENABLE_PROXY = _get(clean, "api_providers.openai.enable_proxy")
        cls.GEMINI_API_KEY = _get(clean, "api_providers.gemini.api_key")
        cls.GOOGLE_GEMINI_BASE_URL = _get(clean, "api_providers.gemini.base_url")
        cls.GEMINI_ENABLE_PROXY = _get(clean, "api_providers.gemini.enable_proxy")
        cls.DEEPSEEK_API_KEY = _get(clean, "api_providers.deepseek.api_key")
        cls.DEEPSEEK_BASE_URL = _get(clean, "api_providers.deepseek.base_url")
        cls.DEEPSEEK_ENABLE_PROXY = _get(clean, "api_providers.deepseek.enable_proxy")
        cls.DASHSCOPE_API_KEY = _get(clean, "api_providers.dashscope.api_key")
        cls.DASHSCOPE_BASE_URL = _get(clean, "api_providers.dashscope.base_url")
        cls.DASHSCOPE_ENABLE_PROXY = _get(clean, "api_providers.dashscope.enable_proxy")
        cls.ARK_API_KEY = _get(clean, "api_providers.ark.api_key")
        cls.ARK_BASE_URL = _get(clean, "api_providers.ark.base_url")
        cls.ARK_ENABLE_PROXY = _get(clean, "api_providers.ark.enable_proxy")
        cls.KLING_ACCESS_KEY = _get(clean, "api_providers.kling.access_key")
        cls.KLING_SECRET_KEY = _get(clean, "api_providers.kling.secret_key")
        cls.KLING_BASE_URL = _get(clean, "api_providers.kling.base_url")
        cls.KLING_ENABLE_PROXY = _get(clean, "api_providers.kling.enable_proxy")
    
    # ==========================
    # 视频生成参数配置
    # ==========================
    # 1. 剧本生成
    LLM_MODEL = os.getenv("LLM_MODEL", "qwen3.5-plus") # LLM 模型选择
    # 2. VLM 评估模型
    VLM_MODEL = os.getenv("VLM_MODEL", "qwen3.5-plus")
    # 3. 图片生成 (分镜)
    IMAGE_IT2I_MODEL = os.getenv("IMAGE_IT2I_MODEL", "doubao-seedream-5-0-260128")
    IMAGE_T2I_MODEL = os.getenv("IMAGE_T2I_MODEL", "doubao-seedream-5-0-260128")
    # 3. 视频生成
    # 可选: "doubao-seedance-2-0-260128", "wan2.7-i2v", "wan2.6-i2v-flash",
    VIDEO_MODEL = os.getenv("VIDEO_MODEL", "wan2.7-i2v")
    VIDEO_RATIO = os.getenv("VIDEO_RATIO", "16:9")
        cls.LLM_API_KEY = cls.DASHSCOPE_API_KEY
        cls.LLM_BASE_URL = ""
        cls.LLM_MODEL = _get(clean, "models.llm")
        cls.VLM_MODEL = _get(clean, "models.vlm")
        cls.IMAGE_IT2I_MODEL = _get(clean, "models.image_it2i")
        cls.IMAGE_T2I_MODEL = _get(clean, "models.image_t2i")
        cls.VIDEO_MODEL = _get(clean, "models.video")
        cls.VIDEO_RATIO = _get(clean, "models.video_ratio")
        cls.EVAL_MODEL = _get(clean, "models.eval")
        return cls.as_dict()
    @classmethod
    def check_dirs(cls):
        """自动创建必要的目录"""
        # 确保 data 和 sessions 目录存在
        data_dir = os.path.join(cls.CODE_DIR, 'data')
        for directory in [cls.CODE_DIR, data_dir, cls.SESSION_DIR, cls.TASK_DIR, cls.RESULT_DIR, cls.TASK_RESULT_DIR, cls.TEMP_DIR]:
        data_dir = os.path.join(cls.CODE_DIR, "data")
        for directory in [
            cls.CODE_DIR,
            data_dir,
            cls.SESSION_DIR,
            cls.TASK_DIR,
            cls.RESULT_DIR,
            cls.TASK_RESULT_DIR,
            cls.TEMP_DIR,
        ]:
            if not os.path.exists(directory):
                os.makedirs(directory, exist_ok=True)
                logger.info("Created directory: %s", directory)
# 初始化目录结构
Config.check_dirs()
# 导出一个单例
Config.check_dirs()
settings = Config()
aigc-director/aigc-claw/backend/config.yaml.example
New file
@@ -0,0 +1,42 @@
project_name: AIGC-Claw
server:
  host: 127.0.0.1
  port: 8000
  debug: false
api_providers:
  common:
    print_model_input: false
    proxy: ''
  openai:
    api_key: ''
    base_url: https://api.openai.com/v1
    enable_proxy: false
  gemini:
    api_key: ''
    base_url: https://generativelanguage.googleapis.com/v1beta
    enable_proxy: false
  deepseek:
    api_key: ''
    base_url: https://api.deepseek.com/v1
    enable_proxy: false
  dashscope:
    api_key: ''
    base_url: https://dashscope.aliyuncs.com/api/v1
    enable_proxy: false
  ark:
    api_key: ''
    base_url: https://ark.cn-beijing.volces.com/api/v3
    enable_proxy: false
  kling:
    base_url: https://api-beijing.klingai.com
    access_key: ''
    secret_key: ''
    enable_proxy: false
models:
  llm: qwen3.5-plus
  vlm: qwen3.5-plus
  image_it2i: doubao-seedream-5-0-260128
  image_t2i: doubao-seedream-5-0-260128
  video: wan2.7-i2v
  video_ratio: '16:9'
  eval: qwen3.5-plus
aigc-director/aigc-claw/backend/core/agents/base_agent.py
@@ -71,6 +71,12 @@
        if self.cancellation_check and self.cancellation_check():
            raise RuntimeError(f"Agent [{self.name}] cancelled by user")
    def _require_input(self, input_data: Dict, key: str) -> str:
        value = input_data.get(key)
        if not value:
            raise ValueError(f"Missing required model configuration: {key}")
        return str(value)
    def _cancellable_query(self, llm, prompt: str, image_urls=[], model="gemini-3-flash-preview", safe_content=True, task_id=None, web_search=False):
        """在 LLM 调用前后检查取消状态"""
        self._check_cancel()
aigc-director/aigc-claw/backend/core/agents/character_agent.py
@@ -379,8 +379,8 @@
        sid = input_data["session_id"]
        style = input_data.get("style", "anime")
        t2i_model = input_data.get("image_t2i_model", "") or settings.IMAGE_T2I_MODEL
        vlm_model = input_data.get("vlm_model", "qwen3.5-plus")
        t2i_model = self._require_input(input_data, "image_t2i_model")
        vlm_model = self._require_input(input_data, "vlm_model")
        # 根据 enable_concurrency 决定并发数
        enable_concurrency = input_data.get("enable_concurrency", True)
        logger.info(f"[CharacterAgent] enable_concurrency={enable_concurrency}")
@@ -392,9 +392,9 @@
        img_client = ImageClient(
            dashscope_api_key=settings.DASHSCOPE_API_KEY,
            dashscope_base_url=settings.DASHSCOPE_BASE_URL,
            gpt_api_key=os.getenv("OPENAI_API_KEY"),
            gpt_base_url=os.getenv("OPENAI_BASE_URL"),
            local_proxy=settings.LOCAL_PROXY,
            gpt_api_key=settings.OPENAI_API_KEY,
            gpt_base_url=settings.OPENAI_BASE_URL,
            proxy=settings.provider_proxy("openai"),
            ark_api_key=settings.ARK_API_KEY,
            ark_base_url=settings.ARK_BASE_URL,
        )
aigc-director/aigc-claw/backend/core/agents/reference_agent.py
@@ -478,10 +478,10 @@
        style = input_data.get("style", "anime")
        video_ratio = input_data.get("video_ratio", "16:9")
        resolution = input_data.get("resolution", "2K")
        llm_model = input_data.get("llm_model", "") or settings.LLM_MODEL
        t2i = input_data.get("image_t2i_model", "") or settings.IMAGE_T2I_MODEL
        it2i = input_data.get("image_it2i_model", "") or settings.IMAGE_IT2I_MODEL
        vlm_model = input_data.get("vlm_model", "") or settings.VLM_MODEL
        llm_model = self._require_input(input_data, "llm_model")
        t2i = self._require_input(input_data, "image_t2i_model")
        it2i = self._require_input(input_data, "image_it2i_model")
        vlm_model = self._require_input(input_data, "vlm_model")
        # 根据 enable_concurrency 决定并发数
        enable_concurrency = input_data.get("enable_concurrency", True)
        logger.info(f"[ReferenceAgent] enable_concurrency={enable_concurrency}")
@@ -505,9 +505,9 @@
        img_client = ImageClient(
            dashscope_api_key=settings.DASHSCOPE_API_KEY,
            dashscope_base_url=settings.DASHSCOPE_BASE_URL,
            gpt_api_key=os.getenv("OPENAI_API_KEY"),
            gpt_base_url=os.getenv("OPENAI_BASE_URL"),
            local_proxy=settings.LOCAL_PROXY,
            gpt_api_key=settings.OPENAI_API_KEY,
            gpt_base_url=settings.OPENAI_BASE_URL,
            proxy=settings.provider_proxy("openai"),
            ark_api_key=settings.ARK_API_KEY,
            ark_base_url=settings.ARK_BASE_URL,
        )
aigc-director/aigc-claw/backend/core/agents/script_agent.py
@@ -118,7 +118,7 @@
        async def run_smart_continue():
            import copy
            sid = input_data.get("session_id", "")
            llm_model = input_data.get("llm_model", "qwen3.5-plus")
            llm_model = self._require_input(input_data, "llm_model")
            web_search = input_data.get("web_search", False)
            episodes_to_add = intervention.get("episodes_to_add", 1)
            sequel_idea = intervention.get("sequel_idea", "").strip()
@@ -244,9 +244,17 @@
            idea = input_data.get("idea", "")
            sid = input_data.get("session_id", "")
            style = input_data.get("style", "anime")
            llm_model = input_data.get("llm_model", "qwen3.5-plus")
            llm_model = self._require_input(input_data, "llm_model")
            web_search = input_data.get("web_search", False)
            episodes = input_data.get("episodes", 4)
            episodes = input_data.get("episodes")
            if episodes is None:
                logger.warning("[ScriptWriter] episodes missing from input_data; falling back to 4. session=%s", sid)
                episodes = 4
            try:
                episodes = max(1, int(episodes))
            except (TypeError, ValueError):
                logger.warning("[ScriptWriter] invalid episodes=%r; falling back to 4. session=%s", episodes, sid)
                episodes = 4
            is_zh = any('\u4e00' <= c <= '\u9fff' for c in idea)
            from config import settings as app_settings
aigc-director/aigc-claw/backend/core/agents/storyboard_agent.py
@@ -110,7 +110,9 @@
        with open(session_file, "r", encoding="utf-8") as f:
            session_data = json.load(f)
            
        llm_model = input_data.get("llm_model") or session_data.get("llm_model") or "qwen-max"
        llm_model = input_data.get("llm_model") or session_data.get("llm_model")
        if not llm_model:
            raise ValueError("Missing required model configuration: llm_model")
        style = input_data.get("style") or session_data.get("style") or "anime"
        
        # 处理人工干预/修改
aigc-director/aigc-claw/backend/core/agents/video_agent.py
@@ -255,7 +255,7 @@
                segments.extend(ep.get("segments", []))
            return self._build_payload(sid, segments)
        video_model = input_data.get("video_model", "") or settings.VIDEO_MODEL
        video_model = self._require_input(input_data, "video_model")
        enable_concurrency = input_data.get("enable_concurrency", True)
        from models.config_model import get_max_concurrency
        concurrency = get_max_concurrency(video_model, enable_concurrency)
aigc-director/aigc-claw/backend/core/orchestrator.py
@@ -47,6 +47,44 @@
    WorkflowStage.POST_PRODUCTION,
]
SESSION_META_KEYS = (
    "idea",
    "user_textbox_input",
    "style",
    "video_ratio",
    "expand_idea",
    "llm_model",
    "vlm_model",
    "image_t2i_model",
    "image_it2i_model",
    "video_model",
    "enable_concurrency",
    "web_search",
    "episodes",
)
def _normalize_meta_value(value: Any) -> Any:
    if isinstance(value, str):
        lower = value.lower()
        if lower == "true":
            return True
        if lower == "false":
            return False
    return value
def _extract_session_meta(data: Dict[str, Any]) -> Dict[str, Any]:
    """Restore session-level generation params from nested or legacy flat storage."""
    meta: Dict[str, Any] = {}
    nested_meta = data.get("meta")
    if isinstance(nested_meta, dict):
        meta.update({k: _normalize_meta_value(v) for k, v in nested_meta.items() if v is not None})
    for key in SESSION_META_KEYS:
        if key in data and data[key] is not None:
            meta[key] = _normalize_meta_value(data[key])
    return meta
class WorkflowState:
    """工作流状态"""
@@ -106,6 +144,8 @@
    def get_or_create_state(self, session_id: str) -> WorkflowState:
        if session_id not in self.sessions:
            loaded_state = self.get_state(session_id)
            if loaded_state is None:
            self.sessions[session_id] = WorkflowState(session_id=session_id)
        if session_id not in self._stop_events:
            self._stop_events[session_id] = threading.Event()
@@ -144,7 +184,7 @@
                    state.status = loaded_status
                state.artifacts = data.get('artifacts', {})
                state.meta = data.get('meta', {})
                state.meta = _extract_session_meta(data)
                state.updated_at = data.get('updated_at', 0)
                # 缓存到内存
@@ -593,7 +633,10 @@
        data["session_id"] = session_id
        if meta:
            for k, v in meta.items():
            normalized_meta = {k: _normalize_meta_value(v) for k, v in meta.items() if v is not None}
            if state:
                state.meta.update(normalized_meta)
            for k, v in normalized_meta.items():
                data[k] = v
        if "created_at" not in data:
            data["created_at"] = time.time()
@@ -607,16 +650,12 @@
            data["error"] = state.error
            data["updated_at"] = state.updated_at.timestamp() if isinstance(state.updated_at, datetime) else time.time()
            
            # 保存元数据(将 meta 中的键展开到根目录下)
            # 保存元数据:nested meta 是主结构;根字段保留给旧会话文件和外部读写兼容。
            if state.meta:
                data["meta"] = copy.deepcopy(state.meta)
                for k, v in state.meta.items():
                    if v is not None:
                        if isinstance(v, str) and v.lower() == 'true':
                            data[k] = True
                        elif isinstance(v, str) and v.lower() == 'false':
                            data[k] = False
                        else:
                            data[k] = v
                        data[k] = _normalize_meta_value(v)
        else:
            data["updated_at"] = time.time()
@@ -675,10 +714,7 @@
                state.artifacts = data.get("artifacts", {})
                state.error = data.get("error")
                state.updated_at = data.get("updated_at", 0)
                state.meta = {k: data[k] for k in
                              ("idea", "style", "llm_model", "image_t2i_model",
                               "image_it2i_model", "video_model")
                              if k in data}
                state.meta = _extract_session_meta(data)
                self.sessions[sid] = state
            except json.JSONDecodeError:
                logger.warning(f"Skipping corrupted session file: {filename}")
@@ -702,7 +738,7 @@
        result_base = settings.RESULT_DIR
        # 删除剧本文件
        script_file = os.path.join(result_base, 'script', f'script_{session_id}.json')
        script_file = os.path.join(result_base, 'script', f'{session_id}.json')
        if os.path.exists(script_file):
            os.remove(script_file)
aigc-director/aigc-claw/backend/docs/api.md
@@ -41,11 +41,11 @@
  "idea": "故事线描述",
  "style": "anime",
  "episodes": 4,
  "llm_model": "qwen3.5-plus",
  "vlm_model": "qwen-vl-plus",
  "image_t2i_model": "doubao-seedream-5-0",
  "image_it2i_model": "doubao-seedream-5-0",
  "video_model": "wan2.6-i2v-flash",
  "llm_model": "deepseek-v3.2",
  "vlm_model": "qwen3.5-plus",
  "image_t2i_model": "doubao-seedream-5-0-260128",
  "image_it2i_model": "doubao-seedream-5-0-260128",
  "video_model": "wan2.7-i2v",
  "enable_concurrency": true
}
```
@@ -56,11 +56,11 @@
| idea | string | 是 | 故事线描述 | - |
| style | string | 否 | 视频风格 | anime |
| episodes | int | 否 | 生成的剧集数量 | 4 |
| llm_model | string | 否 | LLM 模型 | qwen3.5-plus |
| vlm_model | string | 否 | VLM 评估模型 | qwen-vl-plus |
| image_t2i_model | string | 否 | 文生图模型 | doubao-seedream-5-0 |
| image_it2i_model | string | 否 | 图生图模型 | doubao-seedream-5-0 |
| video_model | string | 否 | 视频模型 | wan2.6-i2v-flash |
| llm_model | string | 是 | LLM 模型;前端从 `backend/config.yaml` 读取默认值并传递 | - |
| vlm_model | string | 是 | VLM 评估模型;前端从 `backend/config.yaml` 读取默认值并传递 | - |
| image_t2i_model | string | 是 | 文生图模型;前端从 `backend/config.yaml` 读取默认值并传递 | - |
| image_it2i_model | string | 是 | 图生图模型;前端从 `backend/config.yaml` 读取默认值并传递 | - |
| video_model | string | 是 | 视频模型;前端从 `backend/config.yaml` 读取默认值并传递 | - |
| enable_concurrency | bool | 否 | 开启并发生成(可同时生成多张图片/视频) | true |
**响应示例**:
@@ -71,8 +71,8 @@
  "params": {
    "idea": "故事线描述",
    "style": "anime",
    "llm_model": "gemini-3-flash-preview",
    "vlm_model": "qwen-vl-plus",
    "llm_model": "deepseek-v3.2",
    "vlm_model": "qwen3.5-plus",
    "episodes": 4
  }
}
@@ -182,11 +182,22 @@
请求体格式**因阶段而异**:
#### storyboard — 修改分镜(时长/剧情/视觉提示词)
#### storyboard — 修改分集/片段/镜头
```json
{
  "shots": [
    {"shot_id": "shot_001_01", "duration": 5, "plot": "新剧情描述", "visual_prompt": "新视觉提示词"}
  "episodes": [
    {
      "episode_number": 1,
      "segments": [
        {
          "segment_id": "seg_01_01",
          "total_duration": 10,
          "visual_prompt": "新视觉提示词",
          "video_prompt": "新视频提示词",
          "shots": []
        }
      ]
    }
  ]
}
```
@@ -194,8 +205,8 @@
#### reference_generation — 修改视觉提示词
```json
{
  "shots": [
    {"shot_id": "shot_001_01", "visual_prompt": "新提示词"}
  "segments": [
    {"segment_id": "seg_01_01", "visual_prompt": "新提示词"}
  ]
}
```
@@ -203,21 +214,21 @@
#### reference_generation — 选择参考图版本
```json
{
  "shot_001_01": "code/result/image/xxx/shot_001_01_v2.jpg"
  "seg_01_01": "code/result/image/xxx/seg_01_01_v2.jpg"
}
```
#### video_generation — 修改片段描述/时长
```json
{
  "shot_001_01": {"description": "新描述", "duration": 5}
  "seg_01_01": {"description": "新描述", "duration": 5}
}
```
#### video_generation — 选择视频版本
```json
{
  "shot_001_01": "code/result/video/xxx/shot_001_01_v2.mp4"
  "seg_01_01": "code/result/video/xxx/seg_01_01_v2.mp4"
}
```
aigc-director/aigc-claw/backend/docs/session_format.md
@@ -121,25 +121,35 @@
```json
{
  "session_id": "...",
  "episodes": [
    {
      "episode_number": 1,
      "episode_title": "第一集标题",
      "segments": [
        {
          "segment_id": "seg_01_01",
          "segment_number": 1,
          "total_duration": 10,
          "characters": ["角色名"],
          "setting": "场景位置",
          "visual_prompt": "该视频片段的参考图提示词",
          "video_prompt": "该视频片段的视频生成提示词",
  "shots": [
    {
      "shot_number": 1,
      "duration": 5,
      "characters": ["角色名"],
      "location": "场景位置",
      "plot": "镜头剧情描述",
      "visual_prompt": "视觉生成提示词",
      "shot_id": "shot_001_01",
      "scene_number": 1,
      "act": 1
              "content": "镜头内容",
              "camera": "镜头语言"
    }
  ],
  "user_modified": true,
  "new_shot_ids": []
          ]
        }
      ]
    }
  ]
}
```
> **注意**:storyboard 结构是 `{shots: [...]}`,**没有** `payload` 包装层。
> **注意**:当前完整链路是 `episode → segment → shot`。一个 `segment` 对应一次视频模型调用,`segment.shots[]` 描述同一个视频片段内部的镜头变化。
### 4. reference_generation
@@ -148,27 +158,21 @@
  "session_id": "...",
  "scenes": [
    {
      "id": "shot_001_01",
      "name": "场景1-镜头1",
      "id": "seg_01_01",
      "name": "第1集-片段1",
      "index": 1,
      "description": "视觉生成提示词(由 storyboard.visual_prompt 同步过来)",
      "description": "视频片段参考图描述",
      "selected": "用户选中的参考图路径",
      "versions": ["所有版本路径"],
      "status": "done/pending/failed"
    }
  ],
  "shots": [
    {
      "shot_id": "shot_001_01",
      "video_prompt": "视频生成提示词"
    }
  ]
}
```
> **注意**:
> - `scenes[].id` = `storyboard.shots[].shot_id`,用于跨阶段关联
> - `shots[]` 是给视频生成用的提示词,格式为 `{shot_id, video_prompt}`
> - `scenes[].id` = `storyboard.episodes[].segments[].segment_id`,用于跨阶段关联
> - 参考图按视频片段生成,不按单个 shot 生成
### 5. video_generation
@@ -177,8 +181,8 @@
  "session_id": "...",
  "clips": [
    {
      "id": "shot_001_01",
      "name": "场景1-镜头1",
      "id": "seg_01_01",
      "name": "第1集-片段1",
      "index": 1,
      "description": "视频片段描述(由 storyboard.plot 同步)",
      "duration": 5,
@@ -190,7 +194,7 @@
}
```
> **注意**:`clips[].id` = `storyboard.shots[].shot_id`
> **注意**:`clips[].id` = `storyboard.episodes[].segments[].segment_id`
### 6. post_production
@@ -215,18 +219,18 @@
## 跨阶段数据同步关系
```
storyboard (修改 plot/visual_prompt/duration)
storyboard (修改 segment.visual_prompt / segment.video_prompt / total_duration / shots)
    ↓
video_generation.clips (description/duration)
    ↑ (修改 description/duration)
    ↑
video_generation (修改 clips.description/clips.duration)
    ↓ (修改后同步回 storyboard)
storyboard (修改后同步回 storyboard.shots.plot)
storyboard (修改后同步回 storyboard.episodes[].segments[])
reference_generation (修改 scenes.description)
    ↓
storyboard.shots.visual_prompt (由 reference_generation 同步)
storyboard.episodes[].segments[].visual_prompt (由 reference_generation 同步)
    ↑ (修改后同步)
    ↑
reference_generation (修改 scenes.description)
@@ -239,8 +243,13 @@
### storyboard
```json
{
  "shots": [
    {"shot_id": "shot_001_01", "duration": 5, "plot": "新描述", "visual_prompt": "新提示词"}
  "episodes": [
    {
      "episode_number": 1,
      "segments": [
        {"segment_id": "seg_01_01", "total_duration": 10, "visual_prompt": "新提示词", "shots": []}
      ]
    }
  ]
}
```
@@ -248,8 +257,8 @@
### reference_generation(修改视觉提示词)
```json
{
  "shots": [
    {"shot_id": "shot_001_01", "visual_prompt": "新提示词"}
  "segments": [
    {"segment_id": "seg_01_01", "visual_prompt": "新提示词"}
  ]
}
```
@@ -257,14 +266,14 @@
### reference_generation(选择图片版本)
```json
{
  "shot_001_01": "code/result/image/xxx/shot_001_01_v2.jpg"
  "seg_01_01": "code/result/image/xxx/seg_01_01_v2.jpg"
}
```
### video_generation(修改片段描述/时长)
```json
{
  "shot_001_01": {"description": "新描述", "duration": 5}
  "seg_01_01": {"description": "新描述", "duration": 5}
}
```
aigc-director/aigc-claw/backend/models/image_client.py
@@ -25,7 +25,7 @@
                 dashscope_base_url: Optional[str] = None,
                 gpt_api_key: Optional[str] = None,
                 gpt_base_url: Optional[str] = None,
                 local_proxy: Optional[str] = None,
                 proxy: Optional[str] = None,
                 ark_api_key: Optional[str] = None,
                 ark_base_url: Optional[str] = None):
        """
@@ -48,7 +48,7 @@
        self.gpt_client = ImageGPT(
            api_key=gpt_api_key,
            base_url=gpt_base_url,
            local_proxy=local_proxy
            proxy=Config.provider_proxy("openai") if proxy is None else proxy
        )
        # Initialize Image Processor for downloads
aigc-director/aigc-claw/backend/models/image_dashscope.py
@@ -6,6 +6,7 @@
import dashscope
from dashscope import MultiModalConversation
from dashscope.aigc.image_generation import ImageGeneration
from config import Config
try:
    from models.image_processor import ImageProcessor
except ImportError:
@@ -13,9 +14,9 @@
class DashScopeClient:
    def __init__(self, api_key=None, base_url=None):
        self.api_key = api_key or os.getenv("DASHSCOPE_API_KEY")
        # 默认使用中国(北京)地域 API,如果环境变量或参数未设置则使用默认地址
        self.base_url = base_url or os.getenv("DASHSCOPE_BASE_URL")
        self.api_key = api_key or Config.DASHSCOPE_API_KEY
        # 默认使用中国(北京)地域 API,如果参数或 config.yaml 未设置则使用默认地址
        self.base_url = base_url or Config.DASHSCOPE_BASE_URL
        dashscope.api_key = self.api_key
        dashscope.base_http_api_url = self.base_url
        self.image_processor = ImageProcessor()
@@ -53,7 +54,7 @@
                    for i, url in enumerate(results):
                        file_name = f"ds_{session_id if session_id else 'nosess'}_{int(time.time())}_{i}_{uuid.uuid4().hex[:6]}.png"
                        file_path = os.path.join(save_dir, file_name)
                        if self.image_processor.download_image(url, file_path):
                        if self.image_processor.download_image(url, file_path, proxies=Config.requests_proxies("dashscope")):
                            local_files.append(file_path)
                    return local_files
                
@@ -121,7 +122,7 @@
                    for i, url in enumerate(results):
                        file_name = f"ds_{session_id if session_id else 'nosess'}_{int(time.time())}_{i}_{uuid.uuid4().hex[:6]}.png"
                        file_path = os.path.join(save_dir, file_name)
                        if self.image_processor.download_image(url, file_path):
                        if self.image_processor.download_image(url, file_path, proxies=Config.requests_proxies("dashscope")):
                            local_files.append(file_path)
                    return local_files
aigc-director/aigc-claw/backend/models/image_gpt.py
@@ -5,6 +5,7 @@
import httpx
import logging
from openai import OpenAI
from config import Config
try:
    from models.image_processor import ImageProcessor
except ImportError:
@@ -23,23 +24,26 @@
    def __init__(self,
                 api_key: str = None,
                 base_url: str = None,
                 local_proxy: str = None,
                 proxy: str = None,
                 timeout: float = 300.0):
        """
        OpenAI 图片生成客户端
        :param api_key: API Key
        :param base_url: 自定义 Base URL(如果传入,则不使用本地代理)
        :param base_url: 自定义 Base URL
        :param proxy: 当前 provider 显式启用时使用的代理
        :param timeout: 超时时间
        """
        self.api_key = api_key or os.getenv("OPENAI_API_KEY")
        self.api_key = api_key or Config.OPENAI_API_KEY
        self.timeout = timeout
        
        kwargs = {"api_key": self.api_key, "timeout": self.timeout}
        
        self.base_url = base_url
        if not self.base_url and local_proxy:
        if proxy is None:
            proxy = Config.provider_proxy("openai")
        if proxy:
            kwargs["http_client"] = httpx.Client(
                proxy=local_proxy,
                proxy=proxy,
                timeout=self.timeout,
            )
        if self.base_url:
@@ -124,7 +128,7 @@
                        os.makedirs(save_dir, exist_ok=True)
                        file_name = f"gpt_{int(time.time())}_{uuid.uuid4().hex[:6]}.png"
                        file_path = os.path.join(save_dir, file_name)
                        if self.image_processor.download_image(url, file_path):
                        if self.image_processor.download_image(url, file_path, proxies=Config.requests_proxies("openai")):
                            return file_path
                        return url
                
@@ -169,7 +173,7 @@
    print("\n=== GPT 文生图可用性测试 ===")
    img_prompt = "A cute orange cat lying on a sunny windowsill, watercolor style"
    img_path = ""
    client = ImageGPT(api_key=api_key, base_url=Config.OPENAI_BASE_URL, local_proxy=Config.LOCAL_PROXY)
    client = ImageGPT(api_key=api_key, base_url=Config.OPENAI_BASE_URL, proxy=Config.provider_proxy("openai"))
    for model in MODELS:
        print(f"\nTesting model: {model}")
        print(f"Prompt: {img_prompt}")
aigc-director/aigc-claw/backend/models/image_processor.py
@@ -5,6 +5,7 @@
from datetime import datetime, timedelta
from PIL import Image
import logging
from config import Config
logger = logging.getLogger(__name__)
@@ -20,14 +21,14 @@
    
    def __init__(self,
                 image_path='',
                 api_key: str = "sk-bcab316d69a7414faa9dc29737019333",
                 api_key: str = "",
                 model_name: str = "wan2.6-i2v-flash"):
        """
        初始化图片处理器
        
        Args:
            image_path: 图片文件路径(可选,用于处理已有图片)
            api_key: DashScope API Key(用于上传,可从环境变量 DASHSCOPE_API_KEY 读取)
            api_key: DashScope API Key(用于上传,可从 config.yaml 读取)
            model_name: 模型名称,默认使用 wan2.6-i2v-flash
        """
        # 图片处理部分
@@ -44,7 +45,7 @@
            self.height = None
        
        # 上传功能部分
        self.api_key = api_key or os.getenv("DASHSCOPE_API_KEY")
        self.api_key = api_key or Config.DASHSCOPE_API_KEY
        self.model_name = model_name
    @staticmethod
@@ -132,7 +133,7 @@
        stitched_image.save(output_path)
        return output_path
    
    def download_image(self, image_url, save_path, max_retries=3):
    def download_image(self, image_url, save_path, max_retries=3, proxies=None):
        """
        下载图片,带有重试机制和SSL错误处理
        
@@ -155,7 +156,8 @@
                    verify=True,
                    headers={
                        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
                    }
                    },
                    proxies=proxies,
                )
                
                if response.status_code == 200:
@@ -184,7 +186,8 @@
                            verify=False,
                            headers={
                                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
                            }
                            },
                            proxies=proxies,
                        )
                        if response.status_code == 200:
                            with open(save_path, 'wb') as file:
@@ -276,7 +279,12 @@
            "model": self.model_name
        }
        
        response = requests.get(self.UPLOAD_API_URL, headers=headers, params=params)
        response = requests.get(
            self.UPLOAD_API_URL,
            headers=headers,
            params=params,
            proxies=Config.requests_proxies("dashscope"),
        )
        if response.status_code != 200:
            raise Exception(f"Failed to get upload policy: {response.text}")
        
@@ -314,7 +322,11 @@
                'file': (safe_file_name, file)
            }
            
            response = requests.post(policy_data['upload_host'], files=files)
            response = requests.post(
                policy_data['upload_host'],
                files=files,
                proxies=Config.requests_proxies("dashscope"),
            )
            if response.status_code != 200:
                raise Exception(f"Failed to upload file: {response.text}")
        
aigc-director/aigc-claw/backend/models/image_seedream.py
@@ -6,8 +6,10 @@
import os
import time
import logging
import httpx
from typing import Optional, List, Dict
from openai import OpenAI
from config import Config
# 模型名称映射表(旧名称 -> 新名称)
MODEL_NAME_MAP: Dict[str, str] = {
@@ -53,8 +55,8 @@
            base_url: ARK API 基础 URL
            timeout: HTTP请求超时时间(秒)
        """
        self.api_key = api_key or os.getenv("ARK_API_KEY")
        self.base_url = base_url or "https://ark.cn-beijing.volces.com/api/v3"
        self.api_key = api_key or Config.ARK_API_KEY
        self.base_url = base_url or Config.ARK_BASE_URL or "https://ark.cn-beijing.volces.com/api/v3"
        self.timeout = timeout
        if not self.api_key:
@@ -62,11 +64,15 @@
                "SeedreamClient missing api_key. Set ARK_API_KEY."
            )
        self.client = OpenAI(
            base_url=self.base_url,
            api_key=self.api_key,
            timeout=timeout,
        )
        kwargs = {
            "base_url": self.base_url,
            "api_key": self.api_key,
            "timeout": timeout,
        }
        proxy = Config.provider_proxy("ark")
        if proxy:
            kwargs["http_client"] = httpx.Client(proxy=proxy, timeout=timeout)
        self.client = OpenAI(**kwargs)
    def generate_image(
        self,
@@ -226,7 +232,7 @@
        file_path = os.path.join(result_dir, file_name)
        try:
            response = requests.get(url, timeout=self.timeout)
            response = requests.get(url, timeout=self.timeout, proxies=Config.requests_proxies("ark"))
            response.raise_for_status()
            with open(file_path, "wb") as f:
                f.write(response.content)
@@ -239,11 +245,11 @@
if __name__ == "__main__":
    import sys
    sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
    from config import Config  # 加载 .env
    from config import Config
    print("=== Seedream 可用性测试 ===")
    api_key = os.getenv("ARK_API_KEY", "")
    base_url = os.getenv("ARK_BASE_URL", "https://ark.cn-beijing.volces.com/api/v3")
    api_key = Config.ARK_API_KEY
    base_url = Config.ARK_BASE_URL
    if not api_key:
        print("✗ ARK_API_KEY 未设置,跳过")
        sys.exit(1)
aigc-director/aigc-claw/backend/models/llm_client.py
@@ -1,4 +1,3 @@
import os
import logging
try:
@@ -20,13 +19,13 @@
class LLM:
    def __init__(self, gemini_base_url="", gemini_api_key="", gpt_base_url="", gpt_api_key="", deepseek_base_url="", deepseek_api_key="", dashscope_api_key=""):
        self.gemini_base_url = gemini_base_url or os.getenv("GOOGLE_GEMINI_BASE_URL", "")
        self.gemini_api_key = gemini_api_key or os.getenv("GEMINI_API_KEY", "")
        self.gpt_base_url = gpt_base_url or os.getenv("OPENAI_BASE_URL", "")
        self.gpt_api_key = gpt_api_key or os.getenv("OPENAI_API_KEY", "")
        self.deepseek_base_url = deepseek_base_url or os.getenv("DEEPSEEK_BASE_URL", "")
        self.deepseek_api_key = deepseek_api_key or os.getenv("DEEPSEEK_API_KEY", "")
        self.dashscope_api_key = dashscope_api_key or os.getenv("DASHSCOPE_API_KEY", "")
        self.gemini_base_url = gemini_base_url or Config.GOOGLE_GEMINI_BASE_URL
        self.gemini_api_key = gemini_api_key or Config.GEMINI_API_KEY
        self.gpt_base_url = gpt_base_url or Config.OPENAI_BASE_URL
        self.gpt_api_key = gpt_api_key or Config.OPENAI_API_KEY
        self.deepseek_base_url = deepseek_base_url or Config.DEEPSEEK_BASE_URL
        self.deepseek_api_key = deepseek_api_key or Config.DEEPSEEK_API_KEY
        self.dashscope_api_key = dashscope_api_key or Config.DASHSCOPE_API_KEY
    def full_to_half(self, text):
        if not isinstance(text, str):
@@ -78,7 +77,7 @@
            client = GPT(
                base_url=self.gpt_base_url, 
                api_key=self.gpt_api_key, 
                local_proxy=Config.LOCAL_PROXY
                proxy=Config.provider_proxy("openai"),
            )
            result = client.query(prompt, image_urls=image_urls, model=model, web_search=web_search)
        elif "kimi" in model_lower or "qwen3.6-plus" in model_lower or "qwen3.6-flash" in model_lower:
aigc-director/aigc-claw/backend/models/llm_dashscope.py
@@ -4,10 +4,10 @@
支持 qwen3.5-plus, qwen3.5-max 等模型
"""
import os
import time
import logging
from typing import Optional
from config import Config
logger = logging.getLogger(__name__)
@@ -29,8 +29,8 @@
        :param api_key: DashScope API Key
        :param base_url: DashScope API Base URL (可选)
        """
        self.api_key = api_key or os.getenv("DASHSCOPE_API_KEY")
        self.base_url = base_url or os.getenv("DASHSCOPE_BASE_URL")
        self.api_key = api_key or Config.DASHSCOPE_API_KEY
        self.base_url = base_url or Config.DASHSCOPE_BASE_URL
        if not self.api_key:
            logger.warning("DASHSCOPE_API_KEY is not set")
@@ -112,7 +112,7 @@
    MODELS = ["qwen3.6-max-preview", "qwen3-max", "deepseek-v3.2"]
    print("=== DashScope LLM 可用性测试 ===")
    api_key = os.getenv("DASHSCOPE_API_KEY", "")
    api_key = Config.DASHSCOPE_API_KEY
    if not api_key:
        print("✗ DASHSCOPE_API_KEY 未设置,跳过")
        sys.exit(1)
aigc-director/aigc-claw/backend/models/llm_deepseek.py
@@ -1,7 +1,7 @@
import os
import time
import logging
from openai import OpenAI
from config import Config
logger = logging.getLogger(__name__)
@@ -14,16 +14,18 @@
    deepseek-v4-pro: DeepSeek-V4 Pro
    """
    def __init__(self, base_url="", api_key=""):
        self.base_url = base_url or os.getenv("DEEPSEEK_BASE_URL") or "https://api.deepseek.com/v1"
        self.api_key = api_key or os.getenv("DEEPSEEK_API_KEY")
        import httpx
        self.base_url = base_url or Config.DEEPSEEK_BASE_URL or "https://api.deepseek.com/v1"
        self.api_key = api_key or Config.DEEPSEEK_API_KEY
        
        if not self.api_key:
            logger.warning("DEEPSEEK_API_KEY is not set")
        self.client = OpenAI(
            api_key=self.api_key,
            base_url=self.base_url
        )
        kwargs = {"api_key": self.api_key, "base_url": self.base_url}
        proxy = Config.provider_proxy("deepseek")
        if proxy:
            kwargs["http_client"] = httpx.Client(proxy=proxy)
        self.client = OpenAI(**kwargs)
        self.max_attempts = 3
        self.max_tokens = 8000
@@ -76,8 +78,8 @@
    MODELS = ["deepseek-chat", "deepseek-reasoner", "deepseek-v4-flash", "deepseek-v4-pro"]
    print("=== DeepSeek 可用性测试 ===")
    api_key = os.getenv("DEEPSEEK_API_KEY")
    base_url = os.getenv("DEEPSEEK_BASE_URL", "")
    api_key = Config.DEEPSEEK_API_KEY
    base_url = Config.DEEPSEEK_BASE_URL
    if not api_key:
        print("✗ DEEPSEEK_API_KEY 未设置,跳过")
        sys.exit(1)
aigc-director/aigc-claw/backend/models/llm_gemini.py
@@ -14,8 +14,10 @@
import os
import time
import logging
import httpx
from openai import OpenAI
from typing import List
from config import Config
logger = logging.getLogger(__name__)
@@ -32,11 +34,15 @@
        """
        # 确保 base_url 以 /v1 结尾
        default_url = "https://generativelanguage.googleapis.com/v1beta"
        self.base_url = base_url or os.getenv("GOOGLE_GEMINI_BASE_URL", default_url)
        self.base_url = base_url or Config.GOOGLE_GEMINI_BASE_URL or default_url
        if self.base_url and not self.base_url.endswith("/v1"):
            self.base_url = self.base_url.rstrip("/") + "/v1"
        self.api_key = api_key or os.getenv("GEMINI_API_KEY", "")
        self.client = OpenAI(api_key=self.api_key, base_url=self.base_url)
        self.api_key = api_key or Config.GEMINI_API_KEY
        kwargs = {"api_key": self.api_key, "base_url": self.base_url}
        proxy = Config.provider_proxy("gemini")
        if proxy:
            kwargs["http_client"] = httpx.Client(proxy=proxy)
        self.client = OpenAI(**kwargs)
        self.max_attempts = 10
        self.max_tokens = 8000
aigc-director/aigc-claw/backend/models/llm_gpt.py
@@ -1,8 +1,8 @@
import os
import time
import logging
from openai import OpenAI
from config import Config
logger = logging.getLogger(__name__)
@@ -12,20 +12,19 @@
    OpenAI 文本生成客户端
    可选模型:gpt-4o, 
    """
    def __init__(self, base_url="", api_key="", local_proxy=None, timeout=300):
    def __init__(self, base_url="", api_key="", proxy=None, timeout=300):
        import httpx
        self.api_key = api_key or os.getenv("OPENAI_API_KEY")
        self.api_key = api_key or Config.OPENAI_API_KEY
        self.timeout = timeout
        
        kwargs = {"api_key": self.api_key, "timeout": self.timeout}
        
        # 代理逻辑:
        # 1. 如果传入了 base_url,则不使用本地代理
        # 2. 如果没传入 base_url,则使用默认值并尝试开启本地代理
        self.base_url = base_url
        if not self.base_url and local_proxy:
        if proxy is None:
            proxy = Config.provider_proxy("openai")
        if proxy:
            kwargs["http_client"] = httpx.Client(
                proxy=local_proxy,
                proxy=proxy,
                timeout=self.timeout,
            )
        if self.base_url:
aigc-director/aigc-claw/backend/models/video_client.py
@@ -53,8 +53,8 @@
        # Seedance 客户端
        self.seedance_client = SeedanceVideoClient(
            api_key=ark_api_key or Config.ARK_API_KEY or os.getenv("ARK_API_KEY"),
            base_url=ark_base_url or Config.ARK_BASE_URL or os.getenv("ARK_BASE_URL"),
            api_key=ark_api_key or Config.ARK_API_KEY,
            base_url=ark_base_url or Config.ARK_BASE_URL,
        )
    def generate_video(
aigc-director/aigc-claw/backend/models/video_dashscope.py
@@ -18,6 +18,7 @@
    VideoSynthesis = None
import requests
from requests import exceptions as requests_exceptions
from config import Config
logger = logging.getLogger(__name__)
@@ -33,8 +34,8 @@
        api_key: Optional[str] = None,
        base_url: Optional[str] = None,
    ) -> None:
        self.api_key = api_key or os.getenv("DASHSCOPE_API_KEY")
        self.base_url = base_url or os.getenv("DASHSCOPE_BASE_URL")
        self.api_key = api_key or Config.DASHSCOPE_API_KEY
        self.base_url = base_url or Config.DASHSCOPE_BASE_URL
        if dashscope and self.api_key:
            dashscope.api_key = self.api_key
@@ -350,7 +351,12 @@
        # 下载视频
        resp = self._with_network_retry(
            "download video",
            lambda: requests.get(video_url, stream=True, timeout=120),
            lambda: requests.get(
                video_url,
                stream=True,
                timeout=120,
                proxies=Config.requests_proxies("dashscope"),
            ),
            max_attempts=5,
            base_delay=3.0,
        )
@@ -527,7 +533,7 @@
    ak = Config.DASHSCOPE_API_KEY
    base_url = Config.DASHSCOPE_BASE_URL
    if not ak:
        print("✗ DASHSCOPE_API_KEY 未设置,请检查 .env 配置")
        print("✗ DASHSCOPE_API_KEY 未设置,请检查 config.yaml 配置")
        sys.exit(1)
    if not os.path.exists(IMAGE_PATH):
aigc-director/aigc-claw/backend/models/video_kling.py
@@ -17,6 +17,7 @@
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from PIL import Image
from config import Config
logger = logging.getLogger(__name__)
@@ -36,9 +37,11 @@
        return super().init_poolmanager(*args, **kwargs)
def _build_session(max_retries: int = 3) -> requests.Session:
def _build_session(max_retries: int = 3, proxy: str = "") -> requests.Session:
    """创建带 TLS 适配器和自动重试的 requests Session"""
    session = requests.Session()
    if proxy:
        session.proxies.update({"http": proxy, "https": proxy})
    retry = Retry(
        total=max_retries,
        backoff_factor=1,
@@ -74,9 +77,9 @@
            poll_interval: 轮询间隔(秒)
            max_polls:  最大轮询次数
        """
        self.access_key = access_key or os.getenv("KLING_ACCESS_KEY", "")
        self.secret_key = secret_key or os.getenv("KLING_SECRET_KEY", "")
        self.base_url = (base_url or os.getenv("KLING_BASE_URL", "")).rstrip("/") or KLING_BASE_URL
        self.access_key = access_key or Config.KLING_ACCESS_KEY
        self.secret_key = secret_key or Config.KLING_SECRET_KEY
        self.base_url = (base_url or Config.KLING_BASE_URL).rstrip("/") or KLING_BASE_URL
        self.token_ttl = token_ttl
        self.poll_interval = poll_interval
        self.max_polls = max_polls
@@ -87,7 +90,7 @@
            )
        # 使用强制 TLS 1.2 + 自动重试的 Session
        self._session = _build_session()
        self._session = _build_session(proxy=Config.provider_proxy("kling"))
    # ─── JWT 鉴权 ───
@@ -395,7 +398,7 @@
    sk = Config.KLING_SECRET_KEY
    base_url = Config.KLING_BASE_URL
    if not ak or not sk:
        print("✗ KLING_ACCESS_KEY / KLING_SECRET_KEY 未设置,请检查 .env 配置")
        print("✗ KLING_ACCESS_KEY / KLING_SECRET_KEY 未设置,请检查 config.yaml 配置")
        sys.exit(1)
    if not os.path.exists(IMAGE_PATH):
aigc-director/aigc-claw/backend/models/video_seedance.py
@@ -9,6 +9,7 @@
import requests
import base64
from typing import Optional
from config import Config
logger = logging.getLogger(__name__)
@@ -24,8 +25,8 @@
        base_url: Optional[str] = None,
        timeout: int = 120,
    ) -> None:
        self.api_key = api_key or os.getenv("ARK_API_KEY")
        self.base_url = (base_url or os.getenv("ARK_BASE_URL") or "https://ark.cn-beijing.volces.com/api/v3").rstrip("/")
        self.api_key = api_key or Config.ARK_API_KEY
        self.base_url = (base_url or Config.ARK_BASE_URL or "https://ark.cn-beijing.volces.com/api/v3").rstrip("/")
        self.timeout = timeout
        if not self.api_key:
@@ -114,7 +115,13 @@
                payload[key] = kwargs[key]
        logger.info(f"SeedanceVideoClient: 提交任务 model={model}, duration={duration}s")
        resp = requests.post(url, headers=self._headers(), json=payload, timeout=self.timeout)
        resp = requests.post(
            url,
            headers=self._headers(),
            json=payload,
            timeout=self.timeout,
            proxies=Config.requests_proxies("ark"),
        )
        
        if not resp.ok:
            logger.error(f"Seedance 提交失败: {resp.text}")
@@ -132,7 +139,12 @@
        url = f"{self.base_url}/contents/generations/tasks/{task_id}"
        
        for i in range(max_polls):
            resp = requests.get(url, headers=self._headers(), timeout=30)
            resp = requests.get(
                url,
                headers=self._headers(),
                timeout=30,
                proxies=Config.requests_proxies("ark"),
            )
            resp.raise_for_status()
            data = resp.json()
            
@@ -154,7 +166,7 @@
    def _download_video(self, url: str, save_path: str):
        os.makedirs(os.path.dirname(save_path), exist_ok=True)
        resp = requests.get(url, stream=True, timeout=120)
        resp = requests.get(url, stream=True, timeout=120, proxies=Config.requests_proxies("ark"))
        resp.raise_for_status()
        with open(save_path, "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
@@ -183,7 +195,7 @@
    base_url = Config.ARK_BASE_URL
    
    if not api_key:
        print("✗ ARK_API_KEY 未设置,请检查 .env 配置")
        print("✗ ARK_API_KEY 未设置,请检查 config.yaml 配置")
        sys.exit(1)
    if not os.path.exists(IMAGE_PATH):
aigc-director/aigc-claw/backend/models/vlm_client.py
@@ -23,7 +23,7 @@
                 gemini_base_url: Optional[str] = None,
                 gpt_api_key: Optional[str] = None,
                 gpt_base_url: Optional[str] = None,
                 local_proxy: Optional[str] = None):
                 proxy: Optional[str] = None):
        """
        Unified VLM (Vision Language Model) Client
        Routes requests to DashScope (QwenVL) or Gemini based on model name.
@@ -42,7 +42,7 @@
        self.gpt_client = GPTVLClient(
            api_key=gpt_api_key,
            base_url=gpt_base_url,
            local_proxy=local_proxy
            proxy=Config.provider_proxy("openai") if proxy is None else proxy
        )
    def query(self,
aigc-director/aigc-claw/backend/models/vlm_dashscope.py
@@ -13,6 +13,7 @@
logger = logging.getLogger(__name__)
from typing import Any, Dict, List, Optional
from config import Config
class QwenVLClient:
    def __init__(self,
@@ -23,7 +24,7 @@
        :param api_key: DashScope/Qwen3.5 API Key
        :param model: 模型名(如 qwen3.5-plus/qwen3.5-max 等)
        """
        self.api_key = api_key or os.getenv("DASHSCOPE_API_KEY")
        self.api_key = api_key or Config.DASHSCOPE_API_KEY
    def chat(self, text: str, images: List[str], model: str, stream: bool = False, parameters: Optional[Dict] = None, **kwargs) -> Any:
        """
@@ -72,7 +73,7 @@
    MODELS = ["qwen3.6-plus", "qwen3.6-flash", "kimi-k2.6"]
    print("=== Qwen VL (DashScope) 多模态可用性测试 ===")
    api_key = getattr(Config, "DASHSCOPE_API_KEY", None) or os.getenv("DASHSCOPE_API_KEY", "")
    api_key = Config.DASHSCOPE_API_KEY
    if not api_key:
        print("✗ DASHSCOPE_API_KEY 未设置,跳过")
        sys.exit(1)
aigc-director/aigc-claw/backend/models/vlm_gemini.py
@@ -14,8 +14,10 @@
import time
import base64
import logging
import httpx
from openai import OpenAI
from typing import Dict, List, Optional
from config import Config
logger = logging.getLogger(__name__)
@@ -30,12 +32,16 @@
        :param api_key: Gemini API Key
        :param base_url: 自定义 Base URL(可选,用于代理)
        """
        self.api_key = api_key or os.getenv("GEMINI_API_KEY")
        self.api_key = api_key or Config.GEMINI_API_KEY
        default_url = "https://generativelanguage.googleapis.com/v1beta"
        self.base_url = base_url or os.getenv("GOOGLE_GEMINI_BASE_URL", default_url)
        self.base_url = base_url or Config.GOOGLE_GEMINI_BASE_URL or default_url
        if self.base_url and not self.base_url.endswith("/v1"):
            self.base_url = self.base_url.rstrip("/") + "/v1"
        self.client = OpenAI(api_key=self.api_key, base_url=self.base_url)
        kwargs = {"api_key": self.api_key, "base_url": self.base_url}
        proxy = Config.provider_proxy("gemini")
        if proxy:
            kwargs["http_client"] = httpx.Client(proxy=proxy)
        self.client = OpenAI(**kwargs)
        self.max_attempts = 10
        self.max_tokens = 8000
aigc-director/aigc-claw/backend/models/vlm_gpt.py
@@ -3,9 +3,7 @@
OpenAI GPT 多模态大模型 API 客户端
支持 gpt-4o, gpt-5.4 (未来版本) 等视觉模型
逻辑:
- 如果未传入 base_url,使用官方 URL 并启用本地代理
- 如果传入 base_url,则直接使用,不启用代理
代理由 provider 的 enable_proxy 决定,通过 httpx.Client 注入到 OpenAI SDK。
"""
import os
@@ -15,6 +13,7 @@
import logging
from openai import OpenAI
from typing import Dict, List, Optional
from config import Config
logger = logging.getLogger(__name__)
@@ -26,7 +25,7 @@
    def __init__(self,
                 api_key: Optional[str] = None,
                 base_url: Optional[str] = None,
                 local_proxy: Optional[str] = None,
                 proxy: Optional[str] = None,
                 timeout: float = 60.0):
        """
        GPT 多模态客户端
@@ -34,20 +33,18 @@
        :param base_url: 自定义 Base URL(如果传入,则不使用本地代理)
        :param timeout: 超时时间
        """
        # 优先使用传入的 api_key,否则从环境变量读取
        self.api_key = api_key or os.getenv("OPENAI_API_KEY")
        # 优先使用传入的 api_key,否则从 config.yaml 读取
        self.api_key = api_key or Config.OPENAI_API_KEY
        self.timeout = timeout
        
        kwargs = {"api_key": self.api_key, "timeout": self.timeout}
        
        # 代理逻辑:
        # 1. 如果传入了 base_url,则不使用本地代理
        # 2. 如果没传入 base_url,则使用默认值并尝试开启本地代理
        self.base_url = base_url
        local_proxy = local_proxy
        if not self.base_url and local_proxy:
        if proxy is None:
            proxy = Config.provider_proxy("openai")
        if proxy:
            kwargs["http_client"] = httpx.Client(
                proxy=local_proxy,
                proxy=proxy,
                timeout=self.timeout,
            )
        if self.base_url:
@@ -148,7 +145,7 @@
    if not Config.OPENAI_API_KEY:
        print("✗ 未设置 OPENAI_API_KEY,跳过")
        sys.exit(1)
    client = GPTVLClient(api_key=Config.OPENAI_API_KEY, base_url=Config.OPENAI_BASE_URL, local_proxy=Config.LOCAL_PROXY)
    client = GPTVLClient(api_key=Config.OPENAI_API_KEY, base_url=Config.OPENAI_BASE_URL, proxy=Config.provider_proxy("openai"))
    
    # 支持的 VLM 模型列表,包含用户要求的 gpt-5.4
    MODELS = ["gpt-5.4"]
aigc-director/aigc-claw/backend/pipelines/action_transfer.py
@@ -5,6 +5,13 @@
from .utils import artifact, copy_input_file, run_blocking, write_json
def required_param(params: dict, key: str) -> str:
    value = params.get(key)
    if not value:
        raise ValueError(f"action_transfer pipeline requires {key}")
    return str(value)
async def run(task_id: str, params: dict) -> tuple[dict, list[dict]]:
    output_dir = task_output_dir(task_id)
    os.makedirs(output_dir, exist_ok=True)
@@ -22,12 +29,13 @@
    image_path = copy_input_file(image_path, output_dir, "input_image")
    video_path = copy_input_file(video_path, output_dir, "input_video")
    final_video_path = os.path.join(output_dir, "final.mp4")
    video_model = required_param(params, "video_model")
    update_task(task_id, progress=20, message="Calling action-transfer video API")
    await run_blocking(
        generate_video_api,
        prompt=prompt,
        model=params.get("video_model") or "wan2.7-videoedit",
        model=video_model,
        output_path=final_video_path,
        image_path=None,
        duration=int(params.get("duration") or 5),
@@ -44,7 +52,7 @@
        "prompt": prompt,
        "image_path": image_path,
        "video_path": video_path,
        "video_model": params.get("video_model") or "wan2.7-videoedit",
        "video_model": video_model,
    })
    artifacts = [
        artifact(request_path, "text", "request"),
aigc-director/aigc-claw/backend/pipelines/digital_human.py
@@ -2,7 +2,6 @@
import re
import logging
from config import settings
from models.llm_client import LLM
from .api_media import generate_image_api, generate_video_api
@@ -25,6 +24,13 @@
from models.config_model import video_capabilities
logger = logging.getLogger(__name__)
def required_param(params: dict, key: str) -> str:
    value = params.get(key)
    if not value:
        raise ValueError(f"digital_human pipeline requires {key}")
    return str(value)
def split_by_periods(text: str) -> list[str]:
@@ -56,7 +62,7 @@
        goods_image = copy_input_file(goods_image, output_dir, "goods")
    llm = LLM()
    llm_model = params.get("llm_model") or settings.LLM_MODEL
    llm_model = required_param(params, "llm_model")
    if not goods_text.strip():
        update_task(task_id, progress=15, message="Generating digital-human script")
        logger.info("Generating digital-human script from title: %s", goods_title)
@@ -83,8 +89,7 @@
    reference_images = [character_image]
    if mode == "digital" and goods_image:
        reference_images.append(goods_image)
        image_model = params.get("image_model")
        if image_model:
        image_model = required_param(params, "image_model")
            update_task(task_id, progress=30, message="Generating digital-human reference image")
            logger.info("Generating digital-human reference image: model=%s refs=%d", image_model, len(reference_images))
            image_prompt = (
@@ -107,7 +112,7 @@
            append_artifact(task_id, artifact(generated_image, "image", "generated_reference"))
    update_task(task_id, progress=62, message="Preparing digital-human video segments")
    video_model = params.get("video_model") or "wan2.7-r2v"
    video_model = required_param(params, "video_model")
    provider, resolved_video_model = parse_api_workflow(video_model, "video")
    duration_contract = video_capabilities(provider, resolved_video_model).get("duration") or {}
    max_duration = int(duration_contract.get("max") or 10)
aigc-director/aigc-claw/backend/pipelines/standard.py
@@ -3,7 +3,6 @@
import os
import re
from config import settings
from models.llm_client import LLM
from prompts.loader import format_prompt, load_prompt
@@ -27,6 +26,13 @@
)
logger = logging.getLogger(__name__)
def required_param(params: dict, key: str) -> str:
    value = params.get(key)
    if not value:
        raise ValueError(f"standard pipeline requires {key}")
    return str(value)
def split_by_periods(text: str) -> list[str]:
@@ -137,7 +143,7 @@
    mode = params.get("mode") or "copy"
    source_text = text.strip()
    llm = None
    llm_model = params.get("llm_model") or settings.LLM_MODEL
    llm_model = required_param(params, "llm_model")
    if mode == "inspiration":
        segment_count = clamp_segment_count(params.get("segment_count"))
        update_task(task_id, progress=6, message="Writing narration from inspiration")
@@ -169,12 +175,16 @@
    style_control = (params.get("style_control") or params.get("negative_prompt") or DEFAULT_STYLE_CONTROL).strip()
    video_ratio = params.get("video_ratio") or "9:16"
    image_model = params.get("image_model") or params.get("image_workflow") or settings.IMAGE_T2I_MODEL
    image_model = params.get("image_model") or params.get("image_workflow")
    if not image_model:
        raise ValueError("standard pipeline requires image_model")
    image_resolution = params.get("image_resolution") or "1080P"
    enable_subtitles = bool(params.get("enable_subtitles", False))
    video_mode = params.get("video_mode") or "image_concat"
    dynamic_video = video_mode == "dynamic_video" or bool(params.get("generate_videos", False))
    video_model = params.get("video_model") or settings.VIDEO_MODEL
    video_model = params.get("video_model")
    if dynamic_video and not video_model:
        raise ValueError("standard pipeline dynamic_video mode requires video_model")
    video_duration = clamp_segment_count(params.get("video_duration") or params.get("duration") or 5, default=5)
    update_task(task_id, progress=9, message="Generating image prompts")
aigc-director/aigc-claw/backend/pyproject.toml
@@ -13,7 +13,7 @@
    "uvicorn>=0.23.0",
    "pydantic>=2.0.0",
    "python-multipart>=0.0.6",
    "python-dotenv>=1.0.0",
    "PyYAML>=6.0.0",
    "requests>=2.28.0",
    "httpx>=0.24.0",
    "Pillow>=10.0.0",
aigc-director/aigc-claw/backend/requirements.txt
@@ -9,8 +9,8 @@
pydantic>=2.0.0
python-multipart>=0.0.6
# Environment Variables
python-dotenv>=1.0.0
# YAML Configuration
PyYAML>=6.0.0
# HTTP Clients
requests>=2.28.0
aigc-director/aigc-claw/backend/uv.lock
@@ -28,10 +28,9 @@
    { name = "pyjwt" },
    { name = "pypdf2" },
    { name = "python-docx" },
    { name = "python-dotenv", version = "1.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
    { name = "python-dotenv", version = "1.2.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" },
    { name = "python-multipart", version = "0.0.20", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
    { name = "python-multipart", version = "0.0.27", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" },
    { name = "pyyaml" },
    { name = "requests", version = "2.32.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
    { name = "requests", version = "2.33.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" },
    { name = "uvicorn", version = "0.39.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
@@ -63,8 +62,8 @@
    { name = "pytest", marker = "extra == 'dev'", specifier = ">=8.0.0" },
    { name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.23.0" },
    { name = "python-docx", specifier = ">=1.1.0" },
    { name = "python-dotenv", specifier = ">=1.0.0" },
    { name = "python-multipart", specifier = ">=0.0.6" },
    { name = "pyyaml", specifier = ">=6.0.0" },
    { name = "requests", specifier = ">=2.28.0" },
    { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.6.0" },
    { name = "uvicorn", specifier = ">=0.23.0" },
@@ -2225,31 +2224,6 @@
]
[[package]]
name = "python-dotenv"
version = "1.2.1"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
    "python_full_version < '3.10'",
]
sdist = { url = "https://files.pythonhosted.org/packages/f0/26/19cadc79a718c5edbec86fd4919a6b6d3f681039a2f6d66d14be94e75fb9/python_dotenv-1.2.1.tar.gz", hash = "sha256:42667e897e16ab0d66954af0e60a9caa94f0fd4ecf3aaf6d2d260eec1aa36ad6", size = 44221, upload-time = "2025-10-26T15:12:10.434Z" }
wheels = [
    { url = "https://files.pythonhosted.org/packages/14/1b/a298b06749107c305e1fe0f814c6c74aea7b2f1e10989cb30f544a1b3253/python_dotenv-1.2.1-py3-none-any.whl", hash = "sha256:b81ee9561e9ca4004139c6cbba3a238c32b03e4894671e181b671e8cb8425d61", size = 21230, upload-time = "2025-10-26T15:12:09.109Z" },
]
[[package]]
name = "python-dotenv"
version = "1.2.2"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
    "python_full_version >= '3.11'",
    "python_full_version == '3.10.*'",
]
sdist = { url = "https://files.pythonhosted.org/packages/82/ed/0301aeeac3e5353ef3d94b6ec08bbcabd04a72018415dcb29e588514bba8/python_dotenv-1.2.2.tar.gz", hash = "sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3", size = 50135, upload-time = "2026-03-01T16:00:26.196Z" }
wheels = [
    { url = "https://files.pythonhosted.org/packages/0b/d7/1959b9648791274998a9c3526f6d0ec8fd2233e4d4acce81bbae76b44b2a/python_dotenv-1.2.2-py3-none-any.whl", hash = "sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a", size = 22101, upload-time = "2026-03-01T16:00:25.09Z" },
]
[[package]]
name = "python-multipart"
version = "0.0.20"
source = { registry = "https://pypi.org/simple" }
@@ -2275,6 +2249,79 @@
]
[[package]]
name = "pyyaml"
version = "6.0.3"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f", size = 130960, upload-time = "2025-09-25T21:33:16.546Z" }
wheels = [
    { url = "https://files.pythonhosted.org/packages/f4/a0/39350dd17dd6d6c6507025c0e53aef67a9293a6d37d3511f23ea510d5800/pyyaml-6.0.3-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:214ed4befebe12df36bcc8bc2b64b396ca31be9304b8f59e25c11cf94a4c033b", size = 184227, upload-time = "2025-09-25T21:31:46.04Z" },
    { url = "https://files.pythonhosted.org/packages/05/14/52d505b5c59ce73244f59c7a50ecf47093ce4765f116cdb98286a71eeca2/pyyaml-6.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:02ea2dfa234451bbb8772601d7b8e426c2bfa197136796224e50e35a78777956", size = 174019, upload-time = "2025-09-25T21:31:47.706Z" },
    { url = "https://files.pythonhosted.org/packages/43/f7/0e6a5ae5599c838c696adb4e6330a59f463265bfa1e116cfd1fbb0abaaae/pyyaml-6.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b30236e45cf30d2b8e7b3e85881719e98507abed1011bf463a8fa23e9c3e98a8", size = 740646, upload-time = "2025-09-25T21:31:49.21Z" },
    { url = "https://files.pythonhosted.org/packages/2f/3a/61b9db1d28f00f8fd0ae760459a5c4bf1b941baf714e207b6eb0657d2578/pyyaml-6.0.3-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:66291b10affd76d76f54fad28e22e51719ef9ba22b29e1d7d03d6777a9174198", size = 840793, upload-time = "2025-09-25T21:31:50.735Z" },
    { url = "https://files.pythonhosted.org/packages/7a/1e/7acc4f0e74c4b3d9531e24739e0ab832a5edf40e64fbae1a9c01941cabd7/pyyaml-6.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9c7708761fccb9397fe64bbc0395abcae8c4bf7b0eac081e12b809bf47700d0b", size = 770293, upload-time = "2025-09-25T21:31:51.828Z" },
    { url = "https://files.pythonhosted.org/packages/8b/ef/abd085f06853af0cd59fa5f913d61a8eab65d7639ff2a658d18a25d6a89d/pyyaml-6.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:418cf3f2111bc80e0933b2cd8cd04f286338bb88bdc7bc8e6dd775ebde60b5e0", size = 732872, upload-time = "2025-09-25T21:31:53.282Z" },
    { url = "https://files.pythonhosted.org/packages/1f/15/2bc9c8faf6450a8b3c9fc5448ed869c599c0a74ba2669772b1f3a0040180/pyyaml-6.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:5e0b74767e5f8c593e8c9b5912019159ed0533c70051e9cce3e8b6aa699fcd69", size = 758828, upload-time = "2025-09-25T21:31:54.807Z" },
    { url = "https://files.pythonhosted.org/packages/a3/00/531e92e88c00f4333ce359e50c19b8d1de9fe8d581b1534e35ccfbc5f393/pyyaml-6.0.3-cp310-cp310-win32.whl", hash = "sha256:28c8d926f98f432f88adc23edf2e6d4921ac26fb084b028c733d01868d19007e", size = 142415, upload-time = "2025-09-25T21:31:55.885Z" },
    { url = "https://files.pythonhosted.org/packages/2a/fa/926c003379b19fca39dd4634818b00dec6c62d87faf628d1394e137354d4/pyyaml-6.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:bdb2c67c6c1390b63c6ff89f210c8fd09d9a1217a465701eac7316313c915e4c", size = 158561, upload-time = "2025-09-25T21:31:57.406Z" },
    { url = "https://files.pythonhosted.org/packages/6d/16/a95b6757765b7b031c9374925bb718d55e0a9ba8a1b6a12d25962ea44347/pyyaml-6.0.3-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:44edc647873928551a01e7a563d7452ccdebee747728c1080d881d68af7b997e", size = 185826, upload-time = "2025-09-25T21:31:58.655Z" },
    { url = "https://files.pythonhosted.org/packages/16/19/13de8e4377ed53079ee996e1ab0a9c33ec2faf808a4647b7b4c0d46dd239/pyyaml-6.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:652cb6edd41e718550aad172851962662ff2681490a8a711af6a4d288dd96824", size = 175577, upload-time = "2025-09-25T21:32:00.088Z" },
    { url = "https://files.pythonhosted.org/packages/0c/62/d2eb46264d4b157dae1275b573017abec435397aa59cbcdab6fc978a8af4/pyyaml-6.0.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:10892704fc220243f5305762e276552a0395f7beb4dbf9b14ec8fd43b57f126c", size = 775556, upload-time = "2025-09-25T21:32:01.31Z" },
    { url = "https://files.pythonhosted.org/packages/10/cb/16c3f2cf3266edd25aaa00d6c4350381c8b012ed6f5276675b9eba8d9ff4/pyyaml-6.0.3-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:850774a7879607d3a6f50d36d04f00ee69e7fc816450e5f7e58d7f17f1ae5c00", size = 882114, upload-time = "2025-09-25T21:32:03.376Z" },
    { url = "https://files.pythonhosted.org/packages/71/60/917329f640924b18ff085ab889a11c763e0b573da888e8404ff486657602/pyyaml-6.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b8bb0864c5a28024fac8a632c443c87c5aa6f215c0b126c449ae1a150412f31d", size = 806638, upload-time = "2025-09-25T21:32:04.553Z" },
    { url = "https://files.pythonhosted.org/packages/dd/6f/529b0f316a9fd167281a6c3826b5583e6192dba792dd55e3203d3f8e655a/pyyaml-6.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1d37d57ad971609cf3c53ba6a7e365e40660e3be0e5175fa9f2365a379d6095a", size = 767463, upload-time = "2025-09-25T21:32:06.152Z" },
    { url = "https://files.pythonhosted.org/packages/f2/6a/b627b4e0c1dd03718543519ffb2f1deea4a1e6d42fbab8021936a4d22589/pyyaml-6.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:37503bfbfc9d2c40b344d06b2199cf0e96e97957ab1c1b546fd4f87e53e5d3e4", size = 794986, upload-time = "2025-09-25T21:32:07.367Z" },
    { url = "https://files.pythonhosted.org/packages/45/91/47a6e1c42d9ee337c4839208f30d9f09caa9f720ec7582917b264defc875/pyyaml-6.0.3-cp311-cp311-win32.whl", hash = "sha256:8098f252adfa6c80ab48096053f512f2321f0b998f98150cea9bd23d83e1467b", size = 142543, upload-time = "2025-09-25T21:32:08.95Z" },
    { url = "https://files.pythonhosted.org/packages/da/e3/ea007450a105ae919a72393cb06f122f288ef60bba2dc64b26e2646fa315/pyyaml-6.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:9f3bfb4965eb874431221a3ff3fdcddc7e74e3b07799e0e84ca4a0f867d449bf", size = 158763, upload-time = "2025-09-25T21:32:09.96Z" },
    { url = "https://files.pythonhosted.org/packages/d1/33/422b98d2195232ca1826284a76852ad5a86fe23e31b009c9886b2d0fb8b2/pyyaml-6.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196", size = 182063, upload-time = "2025-09-25T21:32:11.445Z" },
    { url = "https://files.pythonhosted.org/packages/89/a0/6cf41a19a1f2f3feab0e9c0b74134aa2ce6849093d5517a0c550fe37a648/pyyaml-6.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0", size = 173973, upload-time = "2025-09-25T21:32:12.492Z" },
    { url = "https://files.pythonhosted.org/packages/ed/23/7a778b6bd0b9a8039df8b1b1d80e2e2ad78aa04171592c8a5c43a56a6af4/pyyaml-6.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28", size = 775116, upload-time = "2025-09-25T21:32:13.652Z" },
    { url = "https://files.pythonhosted.org/packages/65/30/d7353c338e12baef4ecc1b09e877c1970bd3382789c159b4f89d6a70dc09/pyyaml-6.0.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c", size = 844011, upload-time = "2025-09-25T21:32:15.21Z" },
    { url = "https://files.pythonhosted.org/packages/8b/9d/b3589d3877982d4f2329302ef98a8026e7f4443c765c46cfecc8858c6b4b/pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc", size = 807870, upload-time = "2025-09-25T21:32:16.431Z" },
    { url = "https://files.pythonhosted.org/packages/05/c0/b3be26a015601b822b97d9149ff8cb5ead58c66f981e04fedf4e762f4bd4/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e", size = 761089, upload-time = "2025-09-25T21:32:17.56Z" },
    { url = "https://files.pythonhosted.org/packages/be/8e/98435a21d1d4b46590d5459a22d88128103f8da4c2d4cb8f14f2a96504e1/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea", size = 790181, upload-time = "2025-09-25T21:32:18.834Z" },
    { url = "https://files.pythonhosted.org/packages/74/93/7baea19427dcfbe1e5a372d81473250b379f04b1bd3c4c5ff825e2327202/pyyaml-6.0.3-cp312-cp312-win32.whl", hash = "sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5", size = 137658, upload-time = "2025-09-25T21:32:20.209Z" },
    { url = "https://files.pythonhosted.org/packages/86/bf/899e81e4cce32febab4fb42bb97dcdf66bc135272882d1987881a4b519e9/pyyaml-6.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b", size = 154003, upload-time = "2025-09-25T21:32:21.167Z" },
    { url = "https://files.pythonhosted.org/packages/1a/08/67bd04656199bbb51dbed1439b7f27601dfb576fb864099c7ef0c3e55531/pyyaml-6.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd", size = 140344, upload-time = "2025-09-25T21:32:22.617Z" },
    { url = "https://files.pythonhosted.org/packages/d1/11/0fd08f8192109f7169db964b5707a2f1e8b745d4e239b784a5a1dd80d1db/pyyaml-6.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8da9669d359f02c0b91ccc01cac4a67f16afec0dac22c2ad09f46bee0697eba8", size = 181669, upload-time = "2025-09-25T21:32:23.673Z" },
    { url = "https://files.pythonhosted.org/packages/b1/16/95309993f1d3748cd644e02e38b75d50cbc0d9561d21f390a76242ce073f/pyyaml-6.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2283a07e2c21a2aa78d9c4442724ec1eb15f5e42a723b99cb3d822d48f5f7ad1", size = 173252, upload-time = "2025-09-25T21:32:25.149Z" },
    { url = "https://files.pythonhosted.org/packages/50/31/b20f376d3f810b9b2371e72ef5adb33879b25edb7a6d072cb7ca0c486398/pyyaml-6.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ee2922902c45ae8ccada2c5b501ab86c36525b883eff4255313a253a3160861c", size = 767081, upload-time = "2025-09-25T21:32:26.575Z" },
    { url = "https://files.pythonhosted.org/packages/49/1e/a55ca81e949270d5d4432fbbd19dfea5321eda7c41a849d443dc92fd1ff7/pyyaml-6.0.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a33284e20b78bd4a18c8c2282d549d10bc8408a2a7ff57653c0cf0b9be0afce5", size = 841159, upload-time = "2025-09-25T21:32:27.727Z" },
    { url = "https://files.pythonhosted.org/packages/74/27/e5b8f34d02d9995b80abcef563ea1f8b56d20134d8f4e5e81733b1feceb2/pyyaml-6.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0f29edc409a6392443abf94b9cf89ce99889a1dd5376d94316ae5145dfedd5d6", size = 801626, upload-time = "2025-09-25T21:32:28.878Z" },
    { url = "https://files.pythonhosted.org/packages/f9/11/ba845c23988798f40e52ba45f34849aa8a1f2d4af4b798588010792ebad6/pyyaml-6.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f7057c9a337546edc7973c0d3ba84ddcdf0daa14533c2065749c9075001090e6", size = 753613, upload-time = "2025-09-25T21:32:30.178Z" },
    { url = "https://files.pythonhosted.org/packages/3d/e0/7966e1a7bfc0a45bf0a7fb6b98ea03fc9b8d84fa7f2229e9659680b69ee3/pyyaml-6.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:eda16858a3cab07b80edaf74336ece1f986ba330fdb8ee0d6c0d68fe82bc96be", size = 794115, upload-time = "2025-09-25T21:32:31.353Z" },
    { url = "https://files.pythonhosted.org/packages/de/94/980b50a6531b3019e45ddeada0626d45fa85cbe22300844a7983285bed3b/pyyaml-6.0.3-cp313-cp313-win32.whl", hash = "sha256:d0eae10f8159e8fdad514efdc92d74fd8d682c933a6dd088030f3834bc8e6b26", size = 137427, upload-time = "2025-09-25T21:32:32.58Z" },
    { url = "https://files.pythonhosted.org/packages/97/c9/39d5b874e8b28845e4ec2202b5da735d0199dbe5b8fb85f91398814a9a46/pyyaml-6.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:79005a0d97d5ddabfeeea4cf676af11e647e41d81c9a7722a193022accdb6b7c", size = 154090, upload-time = "2025-09-25T21:32:33.659Z" },
    { url = "https://files.pythonhosted.org/packages/73/e8/2bdf3ca2090f68bb3d75b44da7bbc71843b19c9f2b9cb9b0f4ab7a5a4329/pyyaml-6.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:5498cd1645aa724a7c71c8f378eb29ebe23da2fc0d7a08071d89469bf1d2defb", size = 140246, upload-time = "2025-09-25T21:32:34.663Z" },
    { url = "https://files.pythonhosted.org/packages/9d/8c/f4bd7f6465179953d3ac9bc44ac1a8a3e6122cf8ada906b4f96c60172d43/pyyaml-6.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:8d1fab6bb153a416f9aeb4b8763bc0f22a5586065f86f7664fc23339fc1c1fac", size = 181814, upload-time = "2025-09-25T21:32:35.712Z" },
    { url = "https://files.pythonhosted.org/packages/bd/9c/4d95bb87eb2063d20db7b60faa3840c1b18025517ae857371c4dd55a6b3a/pyyaml-6.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:34d5fcd24b8445fadc33f9cf348c1047101756fd760b4dacb5c3e99755703310", size = 173809, upload-time = "2025-09-25T21:32:36.789Z" },
    { url = "https://files.pythonhosted.org/packages/92/b5/47e807c2623074914e29dabd16cbbdd4bf5e9b2db9f8090fa64411fc5382/pyyaml-6.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:501a031947e3a9025ed4405a168e6ef5ae3126c59f90ce0cd6f2bfc477be31b7", size = 766454, upload-time = "2025-09-25T21:32:37.966Z" },
    { url = "https://files.pythonhosted.org/packages/02/9e/e5e9b168be58564121efb3de6859c452fccde0ab093d8438905899a3a483/pyyaml-6.0.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b3bc83488de33889877a0f2543ade9f70c67d66d9ebb4ac959502e12de895788", size = 836355, upload-time = "2025-09-25T21:32:39.178Z" },
    { url = "https://files.pythonhosted.org/packages/88/f9/16491d7ed2a919954993e48aa941b200f38040928474c9e85ea9e64222c3/pyyaml-6.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c458b6d084f9b935061bc36216e8a69a7e293a2f1e68bf956dcd9e6cbcd143f5", size = 794175, upload-time = "2025-09-25T21:32:40.865Z" },
    { url = "https://files.pythonhosted.org/packages/dd/3f/5989debef34dc6397317802b527dbbafb2b4760878a53d4166579111411e/pyyaml-6.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7c6610def4f163542a622a73fb39f534f8c101d690126992300bf3207eab9764", size = 755228, upload-time = "2025-09-25T21:32:42.084Z" },
    { url = "https://files.pythonhosted.org/packages/d7/ce/af88a49043cd2e265be63d083fc75b27b6ed062f5f9fd6cdc223ad62f03e/pyyaml-6.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5190d403f121660ce8d1d2c1bb2ef1bd05b5f68533fc5c2ea899bd15f4399b35", size = 789194, upload-time = "2025-09-25T21:32:43.362Z" },
    { url = "https://files.pythonhosted.org/packages/23/20/bb6982b26a40bb43951265ba29d4c246ef0ff59c9fdcdf0ed04e0687de4d/pyyaml-6.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:4a2e8cebe2ff6ab7d1050ecd59c25d4c8bd7e6f400f5f82b96557ac0abafd0ac", size = 156429, upload-time = "2025-09-25T21:32:57.844Z" },
    { url = "https://files.pythonhosted.org/packages/f4/f4/a4541072bb9422c8a883ab55255f918fa378ecf083f5b85e87fc2b4eda1b/pyyaml-6.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:93dda82c9c22deb0a405ea4dc5f2d0cda384168e466364dec6255b293923b2f3", size = 143912, upload-time = "2025-09-25T21:32:59.247Z" },
    { url = "https://files.pythonhosted.org/packages/7c/f9/07dd09ae774e4616edf6cda684ee78f97777bdd15847253637a6f052a62f/pyyaml-6.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:02893d100e99e03eda1c8fd5c441d8c60103fd175728e23e431db1b589cf5ab3", size = 189108, upload-time = "2025-09-25T21:32:44.377Z" },
    { url = "https://files.pythonhosted.org/packages/4e/78/8d08c9fb7ce09ad8c38ad533c1191cf27f7ae1effe5bb9400a46d9437fcf/pyyaml-6.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c1ff362665ae507275af2853520967820d9124984e0f7466736aea23d8611fba", size = 183641, upload-time = "2025-09-25T21:32:45.407Z" },
    { url = "https://files.pythonhosted.org/packages/7b/5b/3babb19104a46945cf816d047db2788bcaf8c94527a805610b0289a01c6b/pyyaml-6.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6adc77889b628398debc7b65c073bcb99c4a0237b248cacaf3fe8a557563ef6c", size = 831901, upload-time = "2025-09-25T21:32:48.83Z" },
    { url = "https://files.pythonhosted.org/packages/8b/cc/dff0684d8dc44da4d22a13f35f073d558c268780ce3c6ba1b87055bb0b87/pyyaml-6.0.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a80cb027f6b349846a3bf6d73b5e95e782175e52f22108cfa17876aaeff93702", size = 861132, upload-time = "2025-09-25T21:32:50.149Z" },
    { url = "https://files.pythonhosted.org/packages/b1/5e/f77dc6b9036943e285ba76b49e118d9ea929885becb0a29ba8a7c75e29fe/pyyaml-6.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:00c4bdeba853cc34e7dd471f16b4114f4162dc03e6b7afcc2128711f0eca823c", size = 839261, upload-time = "2025-09-25T21:32:51.808Z" },
    { url = "https://files.pythonhosted.org/packages/ce/88/a9db1376aa2a228197c58b37302f284b5617f56a5d959fd1763fb1675ce6/pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e1674c3ef6f541c35191caae2d429b967b99e02040f5ba928632d9a7f0f065", size = 805272, upload-time = "2025-09-25T21:32:52.941Z" },
    { url = "https://files.pythonhosted.org/packages/da/92/1446574745d74df0c92e6aa4a7b0b3130706a4142b2d1a5869f2eaa423c6/pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:16249ee61e95f858e83976573de0f5b2893b3677ba71c9dd36b9cf8be9ac6d65", size = 829923, upload-time = "2025-09-25T21:32:54.537Z" },
    { url = "https://files.pythonhosted.org/packages/f0/7a/1c7270340330e575b92f397352af856a8c06f230aa3e76f86b39d01b416a/pyyaml-6.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9", size = 174062, upload-time = "2025-09-25T21:32:55.767Z" },
    { url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341, upload-time = "2025-09-25T21:32:56.828Z" },
    { url = "https://files.pythonhosted.org/packages/9f/62/67fc8e68a75f738c9200422bf65693fb79a4cd0dc5b23310e5202e978090/pyyaml-6.0.3-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:b865addae83924361678b652338317d1bd7e79b1f4596f96b96c77a5a34b34da", size = 184450, upload-time = "2025-09-25T21:33:00.618Z" },
    { url = "https://files.pythonhosted.org/packages/ae/92/861f152ce87c452b11b9d0977952259aa7df792d71c1053365cc7b09cc08/pyyaml-6.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c3355370a2c156cffb25e876646f149d5d68f5e0a3ce86a5084dd0b64a994917", size = 174319, upload-time = "2025-09-25T21:33:02.086Z" },
    { url = "https://files.pythonhosted.org/packages/d0/cd/f0cfc8c74f8a030017a2b9c771b7f47e5dd702c3e28e5b2071374bda2948/pyyaml-6.0.3-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3c5677e12444c15717b902a5798264fa7909e41153cdf9ef7ad571b704a63dd9", size = 737631, upload-time = "2025-09-25T21:33:03.25Z" },
    { url = "https://files.pythonhosted.org/packages/ef/b2/18f2bd28cd2055a79a46c9b0895c0b3d987ce40ee471cecf58a1a0199805/pyyaml-6.0.3-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5ed875a24292240029e4483f9d4a4b8a1ae08843b9c54f43fcc11e404532a8a5", size = 836795, upload-time = "2025-09-25T21:33:05.014Z" },
    { url = "https://files.pythonhosted.org/packages/73/b9/793686b2d54b531203c160ef12bec60228a0109c79bae6c1277961026770/pyyaml-6.0.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0150219816b6a1fa26fb4699fb7daa9caf09eb1999f3b70fb6e786805e80375a", size = 750767, upload-time = "2025-09-25T21:33:06.398Z" },
    { url = "https://files.pythonhosted.org/packages/a9/86/a137b39a611def2ed78b0e66ce2fe13ee701a07c07aebe55c340ed2a050e/pyyaml-6.0.3-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:fa160448684b4e94d80416c0fa4aac48967a969efe22931448d853ada8baf926", size = 727982, upload-time = "2025-09-25T21:33:08.708Z" },
    { url = "https://files.pythonhosted.org/packages/dd/62/71c27c94f457cf4418ef8ccc71735324c549f7e3ea9d34aba50874563561/pyyaml-6.0.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:27c0abcb4a5dac13684a37f76e701e054692a9b2d3064b70f5e4eb54810553d7", size = 755677, upload-time = "2025-09-25T21:33:09.876Z" },
    { url = "https://files.pythonhosted.org/packages/29/3d/6f5e0d58bd924fb0d06c3a6bad00effbdae2de5adb5cda5648006ffbd8d3/pyyaml-6.0.3-cp39-cp39-win32.whl", hash = "sha256:1ebe39cb5fc479422b83de611d14e2c0d3bb2a18bbcb01f229ab3cfbd8fee7a0", size = 142592, upload-time = "2025-09-25T21:33:10.983Z" },
    { url = "https://files.pythonhosted.org/packages/f0/0c/25113e0b5e103d7f1490c0e947e303fe4a696c10b501dea7a9f49d4e876c/pyyaml-6.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:2e71d11abed7344e42a8849600193d15b6def118602c4c176f748e4583246007", size = 158777, upload-time = "2025-09-25T21:33:15.55Z" },
]
[[package]]
name = "requests"
version = "2.32.5"
source = { registry = "https://pypi.org/simple" }
aigc-director/aigc-claw/frontend/app/settings/page.tsx
New file
@@ -0,0 +1,335 @@
'use client';
import { useEffect, useState } from 'react';
import { CheckCircle, Loader2, Save, Settings, XCircle } from 'lucide-react';
import BrandHeader from '@/components/BrandHeader';
import {
  I2I_PROVIDERS,
  LLM_PROVIDERS,
  T2I_PROVIDERS,
  VIDEO_PROVIDERS,
  VIDEO_RATIOS,
  VLM_PROVIDERS,
  type ProviderGroup,
} from '@/config/models';
type ConfigTree = Record<string, any>;
type Field = {
  path: string;
  label: string;
  type?: 'text' | 'number' | 'boolean' | 'password' | 'select';
  options?: Array<{ id: string; label: string }> | ProviderGroup[];
};
const MODEL_SELECTS = {
  llm: LLM_PROVIDERS,
  vlm: VLM_PROVIDERS,
  image_it2i: I2I_PROVIDERS,
  image_t2i: T2I_PROVIDERS,
  video: VIDEO_PROVIDERS,
  eval: LLM_PROVIDERS,
};
const GROUPS: Array<{ title: string; description: string; fields: Field[] }> = [
  {
    title: 'API Server',
    description: '服务启动与调试配置。host / port 保存后需要重启后端完全生效。',
    fields: [
      { path: 'server.host', label: 'host' },
      { path: 'server.port', label: 'port', type: 'number' },
      { path: 'server.debug', label: 'debug', type: 'boolean' },
    ],
  },
  {
    title: 'Common Provider Settings',
    description: '模型调用公共配置和代理设置。',
    fields: [
      { path: 'api_providers.common.print_model_input', label: 'print_model_input', type: 'boolean' },
      { path: 'api_providers.common.proxy', label: 'proxy' },
    ],
  },
  {
    title: 'OpenAI',
    description: 'OpenAI / 兼容 OpenAI 接口配置。',
    fields: [
      { path: 'api_providers.openai.api_key', label: 'api_key', type: 'password' },
      { path: 'api_providers.openai.base_url', label: 'base_url' },
      { path: 'api_providers.openai.enable_proxy', label: 'enable_proxy', type: 'boolean' },
    ],
  },
  {
    title: 'Gemini',
    description: 'Gemini 及兼容接口配置。',
    fields: [
      { path: 'api_providers.gemini.api_key', label: 'api_key', type: 'password' },
      { path: 'api_providers.gemini.base_url', label: 'base_url' },
      { path: 'api_providers.gemini.enable_proxy', label: 'enable_proxy', type: 'boolean' },
    ],
  },
  {
    title: 'DeepSeek',
    description: 'DeepSeek 接口配置。',
    fields: [
      { path: 'api_providers.deepseek.api_key', label: 'api_key', type: 'password' },
      { path: 'api_providers.deepseek.base_url', label: 'base_url' },
      { path: 'api_providers.deepseek.enable_proxy', label: 'enable_proxy', type: 'boolean' },
    ],
  },
  {
    title: 'DashScope',
    description: '通义千问、通义万相等 DashScope 服务配置。',
    fields: [
      { path: 'api_providers.dashscope.api_key', label: 'api_key', type: 'password' },
      { path: 'api_providers.dashscope.base_url', label: 'base_url' },
      { path: 'api_providers.dashscope.enable_proxy', label: 'enable_proxy', type: 'boolean' },
    ],
  },
  {
    title: 'ARK',
    description: 'Seedream / Seedance 使用的火山方舟配置。',
    fields: [
      { path: 'api_providers.ark.api_key', label: 'api_key', type: 'password' },
      { path: 'api_providers.ark.base_url', label: 'base_url' },
      { path: 'api_providers.ark.enable_proxy', label: 'enable_proxy', type: 'boolean' },
    ],
  },
  {
    title: 'Kling',
    description: '可灵视频生成接口配置。',
    fields: [
      { path: 'api_providers.kling.base_url', label: 'base_url' },
      { path: 'api_providers.kling.access_key', label: 'access_key', type: 'password' },
      { path: 'api_providers.kling.secret_key', label: 'secret_key', type: 'password' },
      { path: 'api_providers.kling.enable_proxy', label: 'enable_proxy', type: 'boolean' },
    ],
  },
  {
    title: 'Default Models',
    description: '主流程和 Pipeline 使用的默认模型。',
    fields: [
      { path: 'models.llm', label: 'llm', type: 'select', options: MODEL_SELECTS.llm },
      { path: 'models.vlm', label: 'vlm', type: 'select', options: MODEL_SELECTS.vlm },
      { path: 'models.image_it2i', label: 'image_it2i', type: 'select', options: MODEL_SELECTS.image_it2i },
      { path: 'models.image_t2i', label: 'image_t2i', type: 'select', options: MODEL_SELECTS.image_t2i },
      { path: 'models.video', label: 'video', type: 'select', options: MODEL_SELECTS.video },
      { path: 'models.video_ratio', label: 'video_ratio', type: 'select', options: VIDEO_RATIOS },
      { path: 'models.eval', label: 'eval', type: 'select', options: MODEL_SELECTS.eval },
    ],
  },
];
function getValue(config: ConfigTree, path: string) {
  return path.split('.').reduce((current, key) => current?.[key], config);
}
function setValue(config: ConfigTree, path: string, value: any): ConfigTree {
  const next = structuredClone(config || {});
  const parts = path.split('.');
  let current = next;
  for (const part of parts.slice(0, -1)) {
    current[part] = current[part] || {};
    current = current[part];
  }
  current[parts[parts.length - 1]] = value;
  return next;
}
function formatConfigPath(path: string) {
  if (!path) return 'backend/config.yaml';
  const normalized = path.replace(/\\/g, '/');
  const marker = '/aigc-director/aigc-claw/';
  const markerIndex = normalized.lastIndexOf(marker);
  if (markerIndex >= 0) return normalized.slice(markerIndex + marker.length);
  const backendIndex = normalized.lastIndexOf('/backend/config.yaml');
  if (backendIndex >= 0) return normalized.slice(backendIndex + 1);
  return normalized;
}
function maskSecret(value: unknown) {
  const text = String(value ?? '');
  if (!text) return '';
  if (text.length <= 10) return '*'.repeat(text.length);
  return `${text.slice(0, 5)}${'*'.repeat(Math.min(12, text.length - 10))}${text.slice(-5)}`;
}
function isProviderOptions(options: Field['options']): options is ProviderGroup[] {
  return Array.isArray(options) && options.some(option => 'models' in option);
}
export default function SettingsPage() {
  const [config, setConfig] = useState<ConfigTree>({});
  const [path, setPath] = useState('');
  const [loading, setLoading] = useState(true);
  const [saving, setSaving] = useState(false);
  const [message, setMessage] = useState('');
  const [error, setError] = useState('');
  const [secretDrafts, setSecretDrafts] = useState<Record<string, string>>({});
  useEffect(() => {
    const load = async () => {
      setLoading(true);
      setError('');
      try {
        const resp = await fetch('/api/config');
        if (!resp.ok) throw new Error('读取配置失败');
        const data = await resp.json();
        setConfig(data.config || {});
        setPath(data.path || '');
        setSecretDrafts({});
      } catch (e: any) {
        setError(e.message || '读取配置失败');
      } finally {
        setLoading(false);
      }
    };
    load();
  }, []);
  const updateField = (field: Field, raw: string | boolean) => {
    const value = field.type === 'number' ? Number(raw) || 0 : raw;
    setConfig(current => setValue(current, field.path, value));
  };
  const save = async () => {
    setSaving(true);
    setMessage('');
    setError('');
    try {
      const resp = await fetch('/api/config', {
        method: 'PUT',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ values: config }),
      });
      if (!resp.ok) throw new Error('保存配置失败');
      const data = await resp.json();
      setConfig(data.config || {});
      setPath(data.path || '');
      setSecretDrafts({});
      setMessage('配置已保存');
    } catch (e: any) {
      setError(e.message || '保存配置失败');
    } finally {
      setSaving(false);
    }
  };
  const updateSecretField = (field: Field, raw: string) => {
    setSecretDrafts(current => ({ ...current, [field.path]: raw }));
    setConfig(current => setValue(current, field.path, raw));
  };
  return (
    <div className="min-h-screen bg-gray-50/50">
      <BrandHeader />
      <main className="w-full max-w-6xl mx-auto px-6 pt-10 pb-12">
        <div className="mb-8 text-center">
          <div className="inline-flex items-center gap-2 mb-3">
            <Settings className="w-7 h-7 text-blue-500" />
            <h1 className="text-2xl font-bold text-gray-800">设置</h1>
          </div>
          <p className="text-sm text-gray-500">
            修改后端配置并保存到 <span className="font-mono">{formatConfigPath(path)}</span>
          </p>
        </div>
        {loading ? (
          <div className="h-56 rounded-2xl border border-gray-200 bg-white flex items-center justify-center text-sm text-gray-400">
            <Loader2 className="w-4 h-4 mr-2 animate-spin" />
            正在读取配置
          </div>
        ) : (
          <div className="space-y-5">
            {GROUPS.map(group => (
              <section key={group.title} className="rounded-2xl border border-gray-200 bg-white p-5 shadow-sm">
                <div className="mb-4">
                  <h2 className="text-sm font-semibold text-gray-800">{group.title}</h2>
                  <p className="mt-1 text-xs text-gray-500">{group.description}</p>
                </div>
                <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
                  {group.fields.map(field => {
                    const value = getValue(config, field.path);
                    return (
                      <label key={field.path} className="flex flex-col gap-1.5 min-w-0">
                        <span className="text-xs font-medium text-gray-500">{field.label}</span>
                        {field.type === 'boolean' ? (
                          <select
                            value={String(Boolean(value))}
                            onChange={event => updateField(field, event.target.value === 'true')}
                            className="h-10 rounded-lg border border-gray-200 bg-white px-3 text-sm text-gray-700 outline-none focus:border-blue-300"
                          >
                            <option value="true">true</option>
                            <option value="false">false</option>
                          </select>
                        ) : field.type === 'select' ? (
                          <select
                            value={String(value ?? '')}
                            onChange={event => updateField(field, event.target.value)}
                            className="h-10 rounded-lg border border-gray-200 bg-white px-3 text-sm text-gray-700 outline-none focus:border-blue-300"
                          >
                            {isProviderOptions(field.options) ? (
                              field.options.map(group => (
                                <optgroup key={group.provider} label={group.label}>
                                  {group.models.map(model => (
                                    <option key={model.id} value={model.id}>{model.label}</option>
                                  ))}
                                </optgroup>
                              ))
                            ) : (
                              (field.options || []).map(option => (
                                <option key={option.id} value={option.id}>{option.label}</option>
                              ))
                            )}
                          </select>
                        ) : field.type === 'password' ? (
                          <input
                            type="text"
                            value={secretDrafts[field.path] ?? maskSecret(value)}
                            onFocus={event => event.currentTarget.select()}
                            onChange={event => updateSecretField(field, event.target.value)}
                            placeholder="输入新密钥覆盖"
                            className="h-10 rounded-lg border border-gray-200 bg-white px-3 font-mono text-sm text-gray-700 outline-none focus:border-blue-300"
                          />
                        ) : (
                          <input
                            type={field.type === 'number' ? 'number' : 'text'}
                            value={String(value ?? '')}
                            onChange={event => updateField(field, event.target.value)}
                            className="h-10 rounded-lg border border-gray-200 bg-white px-3 text-sm text-gray-700 outline-none focus:border-blue-300"
                          />
                        )}
                      </label>
                    );
                  })}
                </div>
              </section>
            ))}
            <div className="sticky bottom-4 flex items-center gap-3 rounded-2xl border border-gray-200 bg-white/95 p-3 shadow-lg backdrop-blur">
              {message && (
                <span className="flex items-center gap-1.5 text-sm text-green-600">
                  <CheckCircle className="w-4 h-4" />
                  {message}
                </span>
              )}
              {error && (
                <span className="flex items-center gap-1.5 text-sm text-red-600">
                  <XCircle className="w-4 h-4" />
                  {error}
                </span>
              )}
              <button
                onClick={save}
                disabled={saving}
                className="ml-auto flex items-center gap-2 rounded-xl bg-blue-500 px-5 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-blue-600 disabled:cursor-not-allowed disabled:bg-gray-200"
              >
                {saving ? <Loader2 className="w-4 h-4 animate-spin" /> : <Save className="w-4 h-4" />}
                保存配置
              </button>
            </div>
          </div>
        )}
      </main>
    </div>
  );
}
aigc-director/aigc-claw/frontend/components/AppShell.tsx
@@ -2,7 +2,7 @@
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { ChevronLeft, ChevronRight, Clapperboard, Hexagon, Home, PanelLeftOpen, Repeat2, UserRound } from 'lucide-react';
import { ChevronLeft, ChevronRight, Clapperboard, Hexagon, Home, PanelLeftOpen, Repeat2, Settings, UserRound } from 'lucide-react';
import clsx from 'clsx';
import { useState } from 'react';
@@ -13,6 +13,8 @@
  { href: '/pipelines/action-transfer', label: '动作迁移', icon: Repeat2 },
  { href: '/pipelines/digital-human', label: '数字人口播', icon: UserRound },
];
const SETTINGS_ITEM = { href: '/settings', label: '设置', icon: Settings };
export default function AppShell({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();
@@ -33,7 +35,7 @@
              <span className="text-sm font-semibold text-gray-800 truncate">AIGC-Claw</span>
            </div>
          </div>
          <nav className="p-3 space-y-1">
          <nav className="p-3 pb-20 space-y-1">
            {NAV_ITEMS.map(item => {
              const Icon = item.icon;
              const active = item.href === '/' ? pathname === '/' : pathname.startsWith(item.href);
@@ -54,6 +56,26 @@
              );
            })}
          </nav>
          <div className="absolute bottom-0 left-0 right-0 border-t border-gray-100 p-3">
            {(() => {
              const Icon = SETTINGS_ITEM.icon;
              const active = pathname.startsWith(SETTINGS_ITEM.href);
              return (
                <Link
                  href={SETTINGS_ITEM.href}
                  className={clsx(
                    'flex items-center gap-3 rounded-xl px-3 py-2.5 text-sm font-medium transition-colors',
                    active
                      ? 'bg-blue-50 text-blue-600'
                      : 'text-gray-500 hover:bg-gray-50 hover:text-gray-800'
                  )}
                >
                  <Icon className="w-4 h-4 flex-shrink-0" />
                  <span className="truncate">{SETTINGS_ITEM.label}</span>
                </Link>
              );
            })()}
          </div>
        </div>
      </aside>
aigc-director/aigc-claw/frontend/components/HomePage.tsx
@@ -1,10 +1,10 @@
'use client';
import React, { useState, useRef } from 'react';
import React, { useState, useRef, useEffect } from 'react';
import { Sparkles, Play, Settings2, Clock, ArrowRight, Zap, CheckCircle, Trash2, X, Lock, Globe, ListOrdered, Upload, Loader2 } from 'lucide-react';
import clsx from 'clsx';
import { PROMPT_EXAMPLES } from '@/config/examples';
import { LLM_MODELS, T2I_MODELS, I2I_MODELS, VIDEO_MODELS, VLM_MODELS, STYLES, VIDEO_RATIOS, LLM_PROVIDERS, T2I_PROVIDERS, I2I_PROVIDERS, VIDEO_PROVIDERS, VLM_PROVIDERS, ProviderGroup } from '@/config/models';
import { STYLES, VIDEO_RATIOS, LLM_PROVIDERS, T2I_PROVIDERS, I2I_PROVIDERS, VIDEO_PROVIDERS, VLM_PROVIDERS } from '@/config/models';
import { STAGES } from './TopBar';
export interface ProjectParams {
@@ -57,12 +57,14 @@
  const [idea, setIdea] = useState('');
  const [showSettings, setShowSettings] = useState(false);
  const [selectedStyle, setSelectedStyle] = useState('realistic');
  const [selectedLLM, setSelectedLLM] = useState(LLM_MODELS.find(m => m.default)?.id || LLM_MODELS[0].id);
  const [selectedVLM, setSelectedVLM] = useState(VLM_MODELS.find(m => m.default)?.id || VLM_MODELS[0].id);
  const [selectedT2I, setSelectedT2I] = useState(T2I_MODELS.find(m => m.default)?.id || T2I_MODELS[0].id);
  const [selectedI2I, setSelectedI2I] = useState(I2I_MODELS.find(m => m.default)?.id || I2I_MODELS[0].id);
  const [selectedVideo, setSelectedVideo] = useState(VIDEO_MODELS.find(m => m.default)?.id || VIDEO_MODELS[0].id);
  const [selectedRatio, setSelectedRatio] = useState('16:9');
  const [selectedLLM, setSelectedLLM] = useState('');
  const [selectedVLM, setSelectedVLM] = useState('');
  const [selectedT2I, setSelectedT2I] = useState('');
  const [selectedI2I, setSelectedI2I] = useState('');
  const [selectedVideo, setSelectedVideo] = useState('');
  const [selectedRatio, setSelectedRatio] = useState('');
  const [configLoading, setConfigLoading] = useState(true);
  const [configError, setConfigError] = useState('');
  const [enableConcurrency, setEnableConcurrency] = useState(true);
  const [webSearch, setWebSearch] = useState(false);
  const [episodes, setEpisodes] = useState(4);
@@ -78,6 +80,38 @@
  const [deleteTarget, setDeleteTarget] = useState<string | null>(null);
  const [deleteError, setDeleteError] = useState('');
  const [deleting, setDeleting] = useState(false);
  const modelConfigReady = Boolean(selectedLLM && selectedVLM && selectedT2I && selectedI2I && selectedVideo && selectedRatio);
  const canStart = Boolean((idea.trim() || uploadedFile) && modelConfigReady && !configLoading);
  useEffect(() => {
    let cancelled = false;
    const loadDefaultConfig = async () => {
      setConfigLoading(true);
      setConfigError('');
      try {
        const resp = await fetch('/api/config');
        if (!resp.ok) throw new Error('读取默认模型配置失败');
        const data = await resp.json();
        const models = data.config?.models || {};
        if (!models.llm || !models.vlm || !models.image_t2i || !models.image_it2i || !models.video) {
          throw new Error('backend/config.yaml 缺少主流程默认模型');
        }
        if (cancelled) return;
        setSelectedLLM(models.llm);
        setSelectedVLM(models.vlm);
        setSelectedT2I(models.image_t2i);
        setSelectedI2I(models.image_it2i);
        setSelectedVideo(models.video);
        setSelectedRatio(models.video_ratio || '16:9');
      } catch (e: any) {
        if (!cancelled) setConfigError(e.message || '读取默认模型配置失败');
      } finally {
        if (!cancelled) setConfigLoading(false);
      }
    };
    loadDefaultConfig();
    return () => { cancelled = true; };
  }, []);
  const handleDelete = async () => {
    if (!deleteTarget) return;
@@ -94,7 +128,7 @@
  };
  const handleStart = (auto?: boolean) => {
    if (!idea.trim() && !uploadedFile) return;
    if (!canStart) return;
    onStartProject({
      idea,
      file_path: uploadedFile?.path, // 如果上传了文件,传给后端
@@ -326,10 +360,10 @@
              </button>
              <button
                onClick={() => handleStart(false)}
                disabled={!idea.trim() && !uploadedFile}
                disabled={!canStart}
                className={clsx(
                  'flex items-center gap-2 px-5 py-2 rounded-xl text-sm font-medium transition-colors',
                  (idea.trim() || uploadedFile)
                  canStart
                    ? 'bg-blue-500 text-white hover:bg-blue-600 shadow-sm'
                    : 'bg-gray-100 text-gray-400 cursor-not-allowed'
                )}
@@ -339,10 +373,10 @@
              </button>
              <button
                onClick={() => handleStart(true)}
                disabled={!idea.trim() && !uploadedFile}
                disabled={!canStart}
                className={clsx(
                  'flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-medium transition-colors',
                  (idea.trim() || uploadedFile)
                  canStart
                    ? 'bg-amber-500 text-white hover:bg-amber-600 shadow-sm'
                    : 'bg-gray-100 text-gray-400 cursor-not-allowed'
                )}
@@ -353,6 +387,11 @@
              </button>
            </div>
          </div>
          {(configLoading || configError) && (
            <div className={clsx('mt-3 text-xs', configError ? 'text-red-500' : 'text-gray-400')}>
              {configError || '正在读取 backend/config.yaml 中的默认模型...'}
            </div>
          )}
          {/* 模型设置折叠面板 */}
          {showSettings && (
aigc-director/aigc-claw/frontend/components/WorkflowPanel.tsx
@@ -495,6 +495,9 @@
        video_model: params.video_model,
        scene_number: result.params?.scene_number,
        expand_idea: params.expand_idea,
        enable_concurrency: params.enable_concurrency,
        web_search: params.web_search,
        episodes: params.episodes,
        auto_mode: useAutoMode,
      };
aigc-director/aigc-claw/frontend/components/pipelines/PipelinePage.tsx
@@ -493,7 +493,7 @@
  };
  return (
    <section className="w-full max-w-6xl px-6 pb-12">
    <section className="w-full max-w-6xl mx-auto px-6 pb-12">
      <div className="flex items-center gap-2 mb-4">
        <Clock className="w-4 h-4 text-gray-400" />
        <h3 className="text-sm font-medium text-gray-600">历史记录</h3>
aigc-director/aigc-claw/frontend/lib/workflowApi.ts
@@ -208,6 +208,10 @@
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(params),
  });
  if (!resp.ok) {
    const err = await resp.json().catch(() => ({ detail: '项目创建失败' }));
    throw new Error(err.detail || '项目创建失败');
  }
  return resp.json();
}
aigc-director/aigc-claw/frontend/next.config.ts
@@ -32,6 +32,10 @@
        source: '/api/models',
        destination: 'http://127.0.0.1:8000/api/models',
      },
      {
        source: '/api/config',
        destination: 'http://127.0.0.1:8000/api/config',
      },
      // 一键 pipeline API
      {
        source: '/api/pipelines',
aigc-director/aigc-claw/install.bat
@@ -32,9 +32,9 @@
)
cd /d "%BACKEND_DIR%"
if not exist ".env" if exist ".env.example" (
  copy ".env.example" ".env" >nul
  echo [install] Created backend .env from .env.example. Fill in API keys before generating videos.
if not exist "config.yaml" if exist "config.yaml.example" (
  copy "config.yaml.example" "config.yaml" >nul
  echo [install] Created backend config.yaml from config.yaml.example. Fill in API keys before generating videos.
)
where uv >nul 2>nul
@@ -72,7 +72,7 @@
echo.
echo Next steps:
echo   1. Edit backend API keys:
echo      %BACKEND_DIR%\.env
echo      %BACKEND_DIR%\config.yaml
echo.
echo   2. Start backend:
echo      cd /d "%BACKEND_DIR%"
aigc-director/aigc-claw/install.sh
@@ -59,9 +59,9 @@
  info "Installing backend dependencies..."
  cd "$BACKEND_DIR"
  if [ ! -f ".env" ] && [ -f ".env.example" ]; then
    cp .env.example .env
    warn "Created backend .env from .env.example. Fill in API keys before generating videos."
  if [ ! -f "config.yaml" ] && [ -f "config.yaml.example" ]; then
    cp config.yaml.example config.yaml
    warn "Created backend config.yaml from config.yaml.example. Fill in API keys before generating videos."
  fi
  if ensure_uv; then
@@ -108,7 +108,7 @@
Next steps:
  1. Edit backend API keys:
     $BACKEND_DIR/.env
     $BACKEND_DIR/config.yaml
  2. Start backend:
     cd "$BACKEND_DIR"
aigc-director/references/init_project/init_all.md
@@ -28,11 +28,11 @@
## 一键初始化(推荐)
在 `aigc-director/aigc-claw` 项目目录执行:
从仓库根目录进入 `aigc-director/aigc-claw` 后执行:
```bash
# macOS / Linux
cd aigc-claw
cd aigc-director/aigc-claw
chmod +x install.sh
./install.sh
```
@@ -40,11 +40,11 @@
Windows 执行:
```bat
cd aigc-claw
cd aigc-director\aigc-claw
install.bat
```
安装脚本会完成后端依赖、`.env` 初始化、前端依赖安装和前端 build。安装完成后,提醒用户编辑 `aigc-claw/backend/.env` 填入 API Key。
安装脚本会完成后端依赖、`config.yaml` 初始化、前端依赖安装和前端 build。安装完成后,提醒用户编辑 `aigc-claw/backend/config.yaml` 填入 API Key,或启动前端后通过侧边栏底部「设置」页面配置。
## 手动初始化步骤
@@ -70,7 +70,7 @@
| 问题 | 解决方法 |
|------|----------|
| 后端启动失败 | 检查 Python 版本,确保 3.9+,检查 .env 配置 |
| 后端启动失败 | 检查 Python 版本,确保 3.9+,检查 `config.yaml` 配置 |
| 前端 build 失败 | 删除 node_modules 和 .next,重新 `npm install` |
| 端口被占用 | `lsof -ti :8000 | xargs kill` 或 `lsof -ti :3000 | xargs kill` |
| 依赖安装慢 | 使用国内镜像源 |
aigc-director/references/init_project/init_backend.md
@@ -30,20 +30,26 @@
> pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
> ```
## 步骤4:配置环境变量
## 步骤4:配置后端 YAML
```bash
# 复制配置示例文件
cp .env.example .env
cp config.yaml.example config.yaml
```
然后编辑 `.env` 文件,填入必要的 API Key:
然后编辑 `config.yaml` 文件,或启动前端后通过侧边栏底部「设置」页面填写必要配置:
| 变量 | 说明 | 获取方式 |
| 字段 | 说明 | 获取方式 |
|------|------|----------|
| `DASHSCOPE_API_KEY` | 阿里云 Dashscope API Key(文生图、文生视频) | [阿里云百炼](https://dashscope.console.aliyun.com/) |
| `DEEPSEEK_API_KEY` | DeepSeek API Key(LLM) | [DeepSeek](https://platform.deepseek.com/) |
| `OPENAI_API_KEY` | OpenAI 兼容 API Key | 根据实际部署情况 |
| `models.llm` | 默认 LLM 模型名 | 按后端模型注册表选择 |
| `api_providers.dashscope.api_key` | 阿里云 DashScope API Key | [阿里云百炼](https://dashscope.console.aliyun.com/) |
| `api_providers.ark.api_key` | 火山方舟 API Key | [火山方舟](https://www.volcengine.com/product/ark) |
| `api_providers.openai.api_key` | OpenAI 兼容 API Key | 根据实际部署情况 |
| `api_providers.deepseek.api_key` | DeepSeek API Key | [DeepSeek](https://platform.deepseek.com/) |
| `api_providers.kling.access_key` / `api_providers.kling.secret_key` | Kling 视频模型鉴权 | [Kling 开放平台](https://klingai.com/cn/dev) |
| `models.*` | 默认 LLM、图片、视频、评估模型 | 按后端模型注册表选择 |
| `server.host` / `server.port` / `server.debug` | 后端服务地址、端口和调试开关 | 本地部署配置 |
| `api_providers.common.proxy` / `api_providers.<provider>.enable_proxy` | 统一代理地址,以及每个模型提供商是否启用代理 | 默认不启用代理 |
> ⚠️ **重要**:至少需要配置一个 LLM 和一个图片/视频生成 API,否则无法正常使用。
@@ -69,5 +75,5 @@
| `python: command not found` | Python 未安装 | 安装 Python 3.9+ |
| `No module named venv` | python3-venv 未安装 | `brew install python3-venv` (macOS) |
| `ModuleNotFoundError` | 依赖未安装 | `pip install -r requirements.txt` |
| `KeyError: 'DASHSCOPE_API_KEY'` | .env 未配置 | 编辑 .env 填入 API Key |
| 模型 API Key 缺失 | `config.yaml` 未配置 | 编辑 `config.yaml` 或在前端「设置」页面填入 API Key |
| `Address already in use` | 端口 8000 被占用 | `lsof -ti :8000 | xargs kill` |
aigc-director/references/init_project/init_frontend.md
@@ -20,14 +20,9 @@
> npm install
> ```
## 步骤3:配置环境变量(可选)
## 步骤3:确认后端地址
```bash
# 复制配置示例文件
cp .env.local.example .env.local
```
通常无需修改默认配置。
前端默认通过 Next.js rewrite 访问本机后端 `http://localhost:8000`,通常无需单独配置。
## 步骤4:Build 并启动
aigc-director/references/pipelines/overview.md
@@ -6,7 +6,7 @@
| Pipeline | 前端名称 | API | 说明 |
|----------|----------|-----|------|
| `standard` | 静态短视频 | `/api/pipelines/standard/tasks` | 输入创作灵感或完整文案,生成图片、TTS、静态视频片段并拼接成片 |
| `standard` | 文艺短视频 | `/api/pipelines/standard/tasks` | 输入创作灵感或完整文案,生成图片、TTS,并按「图片拼接 / 动态视频」模式合成成片 |
| `action_transfer` | 动作迁移 | `/api/pipelines/action_transfer/tasks` | 输入角色图片、动作视频和提示词,调用动作迁移视频模型 |
| `digital_human` | 数字人口播 | `/api/pipelines/digital_human/tasks` | 输入人物图片和口播文案,生成数字人口播视频 |
@@ -70,7 +70,7 @@
## 上传媒体文件
静态短视频不需要上传文件;动作迁移和数字人口播常需要上传图片或视频。
文艺短视频不需要上传文件;动作迁移和数字人口播常需要上传图片或视频。
```bash
curl -X POST "http://localhost:8000/api/upload_media" \
@@ -103,7 +103,8 @@
| media_type | ability | 用途 |
|------------|---------|------|
| `image` | `text_to_image` | 静态短视频文生图 |
| `image` | `text_to_image` | 文艺短视频文生图 |
| `video` | `image_to_video` | 文艺短视频动态视频模式 |
| `image` | `reference_image` | 数字人口播商品/人物参考图 |
| `video` | `action_transfer` | 动作迁移 |
| `video` | `digital_human` | 数字人口播 |
@@ -114,7 +115,7 @@
|------|-----|
| AIGC-Claw 主流程 | `http://localhost:3000/` |
| 临时工作台 | `http://localhost:3000/sandbox` |
| 静态短视频 | `http://localhost:3000/pipelines/standard` |
| 文艺短视频 | `http://localhost:3000/pipelines/standard` |
| 动作迁移 | `http://localhost:3000/pipelines/action-transfer` |
| 数字人口播 | `http://localhost:3000/pipelines/digital-human` |
aigc-director/references/pipelines/static_short_video.md
@@ -1,14 +1,14 @@
# 静态短视频
# 文艺短视频
静态短视频对应 `standard` pipeline。它不调用视频生成模型,而是:
文艺短视频对应 `standard` pipeline。它支持两种生成方式:
1. 输入创作灵感或完整文案
2. 必要时用 LLM 将创作灵感扩写成旁白
3. 按句号切分旁白
4. 每句生成一张图片
5. 每句生成一段 TTS 音频
6. 用图片和音频合成静态视频片段
7. 拼接成最终视频
1. `image_concat`:为每句旁白生成一张图和一段 TTS 音频,用图片+音频合成静态图文片段,再拼接成最终视频。
2. `dynamic_video`:先为每句旁白生成图片,再调用图生视频模型生成动态片段,最后使用生成的 TTS 音频替换片段音轨并拼接成最终视频。
输入也支持两种方式:
1. `inspiration`:用户给创作灵感,并提供目标片段数量,后端用 LLM 扩写成对应数量的旁白句子。
2. `copy`:用户给完整文案,后端直接按句号切分,得到实际片段数量。
## 请求
@@ -16,11 +16,13 @@
curl -X POST "http://localhost:8000/api/pipelines/standard/tasks" \
  -H "Content-Type: application/json" \
  -d '{
    "video_mode": "image_concat",
    "mode": "inspiration",
    "text": "一个关于拖延症和自救的短视频灵感",
    "segment_count": 6,
    "title": "",
    "llm_model": "qwen3.5-plus",
    "image_model": "wan2.7-image",
    "image_model": "doubao-seedream-5-0-260128",
    "video_ratio": "9:16",
    "tts_voice": "zh-CN-YunjianNeural",
    "tts_speed": 1.2,
@@ -29,20 +31,37 @@
  }'
```
动态视频模式示例:
```json
{
  "video_mode": "dynamic_video",
  "mode": "copy",
  "text": "第一句旁白。第二句旁白。",
  "image_model": "doubao-seedream-5-0-260128",
  "video_model": "wan2.7-i2v",
  "video_duration": 5
}
```
## 参数说明
| 参数 | 必填 | 默认 | 说明 |
|------|------|------|------|
| `mode` | | `copy` | `inspiration` 为创作灵感,先经 LLM 构思;`copy` 为完整文案,直接进入 TTS |
| `video_mode` | | `image_concat` | `image_concat` 为图片拼接;`dynamic_video` 为动态视频 |
| `mode` | | `copy` | `inspiration` 为创作灵感,先经 LLM 构思;`copy` 为完整文案,直接切分 |
| `text` | ✅ | | 创作灵感或完整文案 |
| `segment_count` | | `6` | 仅 `inspiration` 模式使用,用于约束 LLM 扩写出的旁白句子数量 |
| `title` | | | 可选,留空时由 LLM 根据最终旁白生成 |
| `llm_model` | | 后端默认 | 标题生成和创作灵感扩写使用的 LLM |
| `llm_model` | | 后端默认 | 标题生成、创作灵感扩写和图片提示词生成使用的 LLM |
| `image_model` | | 后端默认 | 文生图模型,需支持 `text_to_image` |
| `video_model` | | 后端默认 | 仅 `dynamic_video` 模式使用,需支持图生视频 |
| `video_duration` | | `5` | 仅 `dynamic_video` 模式使用,单个动态片段目标时长 |
| `video_ratio` | | `9:16` | 视频比例,支持 `9:16` / `16:9` / `1:1` |
| `tts_voice` | | `zh-CN-YunjianNeural` | Edge TTS 声音 |
| `tts_speed` | | `1.2` | TTS 语速 |
| `style_control` | | 火柴人黑白简笔风 | 作为所有图像提示词的前缀 |
| `enable_subtitles` | | `false` | 是否把标题和字幕直接绘制到静态图片上 |
| `enable_subtitles` | | `false` | 是否把标题和字幕直接绘制到生成图片上 |
默认风格控制:
@@ -52,13 +71,14 @@
## 字幕与标题
静态短视频不依赖 FFmpeg `libass` 烧字幕。开启 `enable_subtitles` 时:
文艺短视频不依赖 FFmpeg `libass` 烧字幕。开启 `enable_subtitles` 时:
1. 后端先用 Pillow 将标题和当前句字幕绘制到每张图片上
2. 生成 `captioned_image_XX.jpg`
3. 再用带字图片合成视频片段
3. 图片拼接模式用带字图片合成静态视频片段
4. 动态视频模式用带字图片作为图生视频首帧
因此静态短视频的标题/字幕功能只需要 Pillow,不需要 FFmpeg 的 `ass` filter。
因此标题/字幕功能只需要 Pillow,不需要 FFmpeg 的 `ass` filter。
## 产物
@@ -77,7 +97,8 @@
| `image_XX.*` | 每句旁白生成的原始图片 |
| `captioned_image_XX.jpg` | 开启字幕时生成的带标题/字幕图片 |
| `audio_XX.mp3` | 每句旁白生成的 TTS |
| `video_XX.mp4` | 每句图片+音频合成的静态片段 |
| `video_XX.mp4` | 图片拼接模式下,每句图片+音频合成的静态片段 |
| `video_XX_motion.mp4` | 动态视频模式下,每句生成的动态视频片段 |
| `final.mp4` | 最终拼接成片 |
## 响应
@@ -104,6 +125,7 @@
```bash
curl "http://localhost:8000/api/models?media_type=image&ability=text_to_image&verified_only=true"
curl "http://localhost:8000/api/models?media_type=video&ability=image_to_video&verified_only=true"
```
## 前端入口
@@ -116,14 +138,17 @@
| 控件 | 说明 |
|------|------|
| 图片拼接 / 动态视频 | 决定最终片段是由图片直接合成,还是继续调用图生视频模型 |
| 说明 | 根据当前模式提示生成方式和等待时间;图片约 10-20 秒/张,视频约 1-2 分钟/片段 |
| 创作灵感 / 完整文案 | 决定输入是否先经 LLM 构思 |
| 片段数量 | 仅创作灵感模式显示,用于约束 LLM 扩写句子数量 |
| 标题 | 可选,留空时由 LLM 生成 |
| 添加标题和字幕 | 只作用于静态短视频,会直接画到图片上 |
| 生成配置 | LLM 模型、图片模型、视频比例、TTS 声音、TTS 速度、风格控制 |
| 添加标题和字幕 | 直接画到生成图片上 |
| 生成配置 | LLM 模型、图片模型、动态视频模型、视频比例、TTS 声音、TTS 速度、风格控制 |
## 注意事项
1. 静态短视频不会调用视频生成模型。
1. 图片拼接模式不会调用视频生成模型;动态视频模式会调用图生视频模型。
2. 完整文案会按所有句号切分,建议每句不要太长。
3. 图像提示词会自动追加“不要生成文字、logo、水印、标签”等约束。
4. 如果开启标题和字幕,会额外生成带字图片产物。