Xinfan Chen
2026-03-31 8b2c41e5a5239fc43f3684fc8bc8b7510305cf4f
Set the log level to INFO
4 files modified
91 ■■■■■ changed files
aigc-director/aigc-claw/backend/api_server.py 1 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/docs/api.md 80 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/tool/image_client.py 5 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/tool/video_client.py 5 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api_server.py
@@ -22,6 +22,7 @@
    # 控制台处理器(主线程输出)
    console_handler = logging.StreamHandler()
    console_handler.setLevel(logging.INFO)   # 只显示 INFO 及以上,避免 HTTP DEBUG 日志刷屏
    console_handler.setFormatter(logging.Formatter(
        '[%(asctime)s] [%(threadName)-12s] %(levelname)-8s %(message)s',
        datefmt='%H:%M:%S'
aigc-director/aigc-claw/backend/docs/api.md
@@ -89,15 +89,11 @@
**请求体**:
```json
{
  "session_id": "1773208355389",
  "style": "anime",
  "llm_model": "deepseek-chat",
  "vlm_model": "qwen3.5-plus",
  "image_t2i_model": "jimeng_t2i_v40",
  "image_it2i_model": "jimeng_t2i_v40",
  "video_model": "wan2.6-i2v-flash"
  "style": "anime"
}
```
> 请求体参数与创建项目相同(可选),会覆盖项目中已有的对应参数。
**响应**: SSE 流式返回,包含以下事件类型:
- `progress`: 进度更新
@@ -176,15 +172,48 @@
### 5. 更新阶段产物
更新指定阶段的产物数据(如用户选择)。
更新指定阶段的产物数据(如用户修改提示词、选择版本)。
**接口**: `PATCH /api/project/{session_id}/artifact/{stage}`
**请求体**:
请求体格式**因阶段而异**:
#### storyboard — 修改分镜(时长/剧情/视觉提示词)
```json
{
  "selected_logline": "选中的logan",
  "scenes": [...]
  "shots": [
    {"shot_id": "shot_001_01", "duration": 5, "plot": "新剧情描述", "visual_prompt": "新视觉提示词"}
  ]
}
```
#### reference_generation — 修改视觉提示词
```json
{
  "shots": [
    {"shot_id": "shot_001_01", "visual_prompt": "新提示词"}
  ]
}
```
#### reference_generation — 选择参考图版本
```json
{
  "shot_001_01": "code/result/image/xxx/shot_001_01_v2.jpg"
}
```
#### video_generation — 修改片段描述/时长
```json
{
  "shot_001_01": {"description": "新描述", "duration": 5}
}
```
#### video_generation — 选择视频版本
```json
{
  "shot_001_01": "code/result/video/xxx/shot_001_01_v2.mp4"
}
```
@@ -194,21 +223,27 @@
### 6. 干预阶段
对已完成的阶段进行修改并重新执行。
对已完成的阶段进行修改并重新执行(重新生成部分产物)。
**接口**: `POST /api/project/{session_id}/intervene`
**请求体**:
```json
{
  "stage": "script_generation",
  "stage": "reference_generation",
  "modifications": {
    "modified_script": "修改后的剧本内容"
    "regenerate_scenes": ["shot_001_01", "shot_001_02"]
  }
}
```
**响应**: SSE 流式返回,同执行阶段。
- `stage`:要干预的阶段
- `modifications`:修改内容,目前支持 `regenerate_scenes`(要重新生成的镜头 ID 列表)
**响应**: SSE 流式返回,包含以下事件类型:
- `progress`: 进度更新
- `stage_complete`: 阶段完成
- `error`: 执行错误
---
@@ -306,10 +341,7 @@
# 2. 执行第一阶段(剧本生成)- 监听 SSE
curl -X POST "http://localhost:8000/api/project/${SESSION_ID}/execute/script_generation" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "'$SESSION_ID'",
    "style": "anime"
  }'
  -d '{"style": "anime"}'
# 3. 获取剧本产物
curl -s "http://localhost:8000/api/project/${SESSION_ID}/artifact/script_generation"
@@ -320,7 +352,7 @@
# 5. 执行第二阶段(角色设计)
curl -X POST "http://localhost:8000/api/project/${SESSION_ID}/execute/character_design" \
  -H "Content-Type: application/json" \
  -d '{"session_id": "'$SESSION_ID'", "style": "anime"}'
  -d '{"style": "anime"}'
# 6. 确认并继续
curl -s -X POST "http://localhost:8000/api/project/${SESSION_ID}/continue"
@@ -328,7 +360,7 @@
# 7. 执行第三阶段(分镜设计)
curl -X POST "http://localhost:8000/api/project/${SESSION_ID}/execute/storyboard" \
  -H "Content-Type: application/json" \
  -d '{"session_id": "'$SESSION_ID'", "style": "anime"}'
  -d '{"style": "anime"}'
# 8. 确认并继续
curl -s -X POST "http://localhost:8000/api/project/${SESSION_ID}/continue"
@@ -336,7 +368,7 @@
# 9. 执行第四阶段(参考图生成)
curl -X POST "http://localhost:8000/api/project/${SESSION_ID}/execute/reference_generation" \
  -H "Content-Type: application/json" \
  -d '{"session_id": "'$SESSION_ID'", "style": "anime"}'
  -d '{"style": "anime"}'
# 10. 确认并继续
curl -s -X POST "http://localhost:8000/api/project/${SESSION_ID}/continue"
@@ -344,7 +376,7 @@
# 11. 执行第五阶段(视频生成)
curl -X POST "http://localhost:8000/api/project/${SESSION_ID}/execute/video_generation" \
  -H "Content-Type: application/json" \
  -d '{"session_id": "'$SESSION_ID'", "style": "anime"}'
  -d '{"style": "anime"}'
# 12. 确认并继续
curl -s -X POST "http://localhost:8000/api/project/${SESSION_ID}/continue"
@@ -352,7 +384,7 @@
# 13. 执行第六阶段(后期剪辑)
curl -X POST "http://localhost:8000/api/project/${SESSION_ID}/execute/post_production" \
  -H "Content-Type: application/json" \
  -d '{"session_id": "'$SESSION_ID'", "style": "anime"}'
  -d '{"style": "anime"}'
```
### 使用 jq 简化
aigc-director/aigc-claw/backend/tool/image_client.py
@@ -98,7 +98,10 @@
            if image_paths:
                print(f"Refs: {len(image_paths)}")
                for p in image_paths:
                    print(f" - {p}")
                    if str(p).startswith("data:"):
                        print(f" - [Base64图片]")
                    else:
                        print(f" - {p}")
            print(f"Model: {model}")
            if session_id:
                print(f"Session ID: {session_id}")
aigc-director/aigc-claw/backend/tool/video_client.py
@@ -94,7 +94,10 @@
        if Config.PRINT_MODEL_INPUT:
            print("---- VIDEO GENERATION REQUEST ----")
            print(f"Prompt: {prompt}")
            print(f"Image: {image_path}")
            if image_path and str(image_path).startswith("data:"):
                print(f"Image: [Base64图片]")
            else:
                print(f"Image: {image_path}")
            print(f"Model: {model}")
            print(f"Duration: {duration}s")
            print(f"Shot Type: {shot_type}")