hit-cxf
2026-05-14 cc5582b71914036e24f8e75c964e320fe64e84be
aigc-director/aigc-claw/backend/docs/session_format.md
@@ -9,6 +9,7 @@
| `session_id` | string | 会话唯一 ID |
| `idea` | string | 用户原始创意/故事想法 |
| `style` | string | 视觉风格,如 `realistic`、`anime` |
| `episodes` | int | 生成的剧集数量,默认 4 |
| `video_ratio` | string | 视频比例,如 `16:9`、`9:16` |
| `expand_idea` | bool | 是否扩展创意 |
| `llm_model` | string | LLM 模型名称 |
@@ -51,22 +52,25 @@
```json
{
  "project_id": "proj_xxx",
  "session_id": "...",
  "title": "守",
  "version": 1,
  "created_at": "2026-04-06T00:00:00.000Z",
  "metadata": {
    "generation_model": "模型名",
    "generation_prompt": "原始生成提示词",
    "original_text": "LLM生成的原始剧本文本"
  },
  "title": "剧本名称",
  "logline": "详细故事梗概",
  "genre": ["奇幻", "温情"],
  "target_duration": 180,
  "mood": "整体情绪基调",
  "characters": [
    {
      "name": "角色名",
      "character_id": "char_xxx",
      "description": "角色描述",
      "personality": ["特质1", "特质2"],
      "motivation": "角色动机",
      "arc_description": "角色弧线描述",
      "role": "主角/配角/反派",
      "age": "年龄",
      "species": "物种(人类/狗等)"
      "role": "主角/配角/反派"
    }
  ],
  "settings": [
@@ -76,31 +80,13 @@
      "description": "场景描述"
    }
  ],
  "scenes": [
  "episodes": [
    {
      "scene_number": 1,
      "location": "场景位置",
      "characters": ["角色名"],
      "plot": "场景剧情描述"
      "episode_number": 1,
      "act_title": "第一集标题",
      "content": "第一集的剧本正文内容"
    }
  ],
  "overall_style": "realistic",
  "mood": "整体情绪基调",
  "project_id": "proj_xxx",
  "version": 1,
  "metadata": {
    "generation_model": "模型名",
    "generation_prompt": "原始生成提示词",
    "mode": "movie/micro"
  },
  "logline_data": {
    "logline": "完整logline",
    "who": "主角是谁",
    "goal": "主角目标",
    "conflict": "核心冲突",
    "twist": "反转点",
    "theme": "主题"
  }
  ]
}
```
@@ -135,25 +121,35 @@
```json
{
  "session_id": "...",
  "shots": [
  "episodes": [
    {
      "shot_number": 1,
      "duration": 5,
      "characters": ["角色名"],
      "location": "场景位置",
      "plot": "镜头剧情描述",
      "visual_prompt": "视觉生成提示词",
      "shot_id": "shot_001_01",
      "scene_number": 1,
      "act": 1
      "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,
              "content": "镜头内容",
              "camera": "镜头语言"
            }
          ]
        }
      ]
    }
  ],
  "user_modified": true,
  "new_shot_ids": []
  ]
}
```
> **注意**:storyboard 结构是 `{shots: [...]}`,**没有** `payload` 包装层。
> **注意**:当前完整链路是 `episode → segment → shot`。一个 `segment` 对应一次视频模型调用,`segment.shots[]` 描述同一个视频片段内部的镜头变化。
### 4. reference_generation
@@ -162,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
@@ -191,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,
@@ -204,34 +194,43 @@
}
```
> **注意**:`clips[].id` = `storyboard.shots[].shot_id`
> **注意**:`clips[].id` = `storyboard.episodes[].segments[].segment_id`
### 6. post_production
```json
{
  "session_id": "...",
  "final_video": "code/result/video/xxx_final.mp4"
  "final_videos": [
    {
      "episode": 1,
      "path": "code/result/video/xxx_ep1.mp4",
      "name": "第 1 集"
    }
  ],
  "final_video": "code/result/video/xxx_ep1.mp4"
}
```
> **注意**:`final_videos` 包含按剧集拼接的所有成片列表,`final_video` 保留为兼容第一集的字段。
---
## 跨阶段数据同步关系
```
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)
@@ -244,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": []}
      ]
    }
  ]
}
```
@@ -253,8 +257,8 @@
### reference_generation(修改视觉提示词)
```json
{
  "shots": [
    {"shot_id": "shot_001_01", "visual_prompt": "新提示词"}
  "segments": [
    {"segment_id": "seg_01_01", "visual_prompt": "新提示词"}
  ]
}
```
@@ -262,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}
}
```