| 1 | # Session 数据格式 |
| 2 | |
| 3 | Session 数据存储在 `code/data/sessions/{session_id}.json`,包含完整的项目会话信息。 |
| 4 | |
| 5 | ## 根级字段 |
| 6 | |
| 7 | | 字段 | 类型 | 说明 | |
| 8 | |------|------|------| |
| 9 | | `session_id` | string | 会话唯一 ID | |
| 10 | | `idea` | string | 用户原始创意/故事想法 | |
| 11 | | `style` | string | 视觉风格,如 `realistic`、`anime` | |
| 12 | | `episodes` | int | 生成的剧集数量,默认 4 | |
| 13 | | `video_ratio` | string | 视频比例,如 `16:9`、`9:16` | |
| 14 | | `expand_idea` | bool | 是否扩展创意 | |
| 15 | | `llm_model` | string | LLM 模型名称 | |
| 16 | | `vlm_model` | string | VLM 模型名称 | |
| 17 | | `image_t2i_model` | string | 文生图模型 | |
| 18 | | `image_it2i_model` | string | 图生图模型 | |
| 19 | | `video_model` | string | 视频生成模型 | |
| 20 | | `enable_concurrency` | string/bool | 是否启用并发 | |
| 21 | | `web_search` | bool | 是否启用网络搜索 | |
| 22 | | `created_at` | float | 创建时间戳 | |
| 23 | | `updated_at` | float | 更新时间戳 | |
| 24 | | `current_stage` | string | 当前阶段 | |
| 25 | | `status` | string | 会话状态 | |
| 26 | | `stages_completed` | string[] | 已完成的阶段列表 | |
| 27 | | `error` | null / string | 错误信息 | |
| 28 | | `artifacts` | object | 各阶段产物(见下文) | |
| 29 | |
| 30 | ## Status 状态值 |
| 31 | |
| 32 | | 状态 | 说明 | |
| 33 | |------|------| |
| 34 | | `idle` | 初始状态 | |
| 35 | | `running` | 运行中 | |
| 36 | | `waiting` | 等待用户确认 | |
| 37 | | `stage_completed` | 阶段完成 | |
| 38 | | `session_completed` | 会话完成 | |
| 39 | |
| 40 | ## Stages Completed 阶段列表 |
| 41 | |
| 42 | 按顺序完成的所有阶段: |
| 43 | ``` |
| 44 | script_generation → character_design → storyboard → reference_generation → video_generation → post_production |
| 45 | ``` |
| 46 | |
| 47 | --- |
| 48 | |
| 49 | ## Artifacts 各阶段产物 |
| 50 | |
| 51 | ### 1. script_generation |
| 52 | |
| 53 | ```json |
| 54 | { |
| 55 | "project_id": "proj_xxx", |
| 56 | "session_id": "...", |
| 57 | "version": 1, |
| 58 | "created_at": "2026-04-06T00:00:00.000Z", |
| 59 | "metadata": { |
| 60 | "generation_model": "模型名", |
| 61 | "generation_prompt": "原始生成提示词", |
| 62 | "original_text": "LLM生成的原始剧本文本" |
| 63 | }, |
| 64 | "title": "剧本名称", |
| 65 | "logline": "详细故事梗概", |
| 66 | "genre": ["奇幻", "温情"], |
| 67 | "mood": "整体情绪基调", |
| 68 | "characters": [ |
| 69 | { |
| 70 | "name": "角色名", |
| 71 | "character_id": "char_xxx", |
| 72 | "description": "角色描述", |
| 73 | "role": "主角/配角/反派" |
| 74 | } |
| 75 | ], |
| 76 | "settings": [ |
| 77 | { |
| 78 | "name": "场景名", |
| 79 | "setting_id": "set_xxx", |
| 80 | "description": "场景描述" |
| 81 | } |
| 82 | ], |
| 83 | "episodes": [ |
| 84 | { |
| 85 | "episode_number": 1, |
| 86 | "act_title": "第一集标题", |
| 87 | "content": "第一集的剧本正文内容" |
| 88 | } |
| 89 | ] |
| 90 | } |
| 91 | ``` |
| 92 | |
| 93 | ### 2. character_design |
| 94 | |
| 95 | ```json |
| 96 | { |
| 97 | "session_id": "...", |
| 98 | "characters": [ |
| 99 | { |
| 100 | "id": "char_xxx", |
| 101 | "name": "角色名", |
| 102 | "description": "角色外观描述", |
| 103 | "selected": "选中的角色图路径", |
| 104 | "versions": ["所有版本路径"] |
| 105 | } |
| 106 | ], |
| 107 | "settings": [ |
| 108 | { |
| 109 | "id": "set_xxx", |
| 110 | "name": "场景名", |
| 111 | "description": "场景描述", |
| 112 | "selected": "选中的场景图路径", |
| 113 | "versions": ["所有版本路径"] |
| 114 | } |
| 115 | ] |
| 116 | } |
| 117 | ``` |
| 118 | |
| 119 | ### 3. storyboard |
| 120 | |
| 121 | ```json |
| 122 | { |
| 123 | "session_id": "...", |
| 124 | "episodes": [ |
| 125 | { |
| 126 | "episode_number": 1, |
| 127 | "episode_title": "第一集标题", |
| 128 | "segments": [ |
| 129 | { |
| 130 | "segment_id": "seg_01_01", |
| 131 | "segment_number": 1, |
| 132 | "total_duration": 10, |
| 133 | "characters": ["角色名"], |
| 134 | "setting": "场景位置", |
| 135 | "visual_prompt": "该视频片段的参考图提示词", |
| 136 | "video_prompt": "该视频片段的视频生成提示词", |
| 137 | "shots": [ |
| 138 | { |
| 139 | "shot_number": 1, |
| 140 | "duration": 5, |
| 141 | "content": "镜头内容", |
| 142 | "camera": "镜头语言" |
| 143 | } |
| 144 | ] |
| 145 | } |
| 146 | ] |
| 147 | } |
| 148 | ] |
| 149 | } |
| 150 | ``` |
| 151 | |
| 152 | > **注意**:当前完整链路是 `episode → segment → shot`。一个 `segment` 对应一次视频模型调用,`segment.shots[]` 描述同一个视频片段内部的镜头变化。 |
| 153 | |
| 154 | ### 4. reference_generation |
| 155 | |
| 156 | ```json |
| 157 | { |
| 158 | "session_id": "...", |
| 159 | "scenes": [ |
| 160 | { |
| 161 | "id": "seg_01_01", |
| 162 | "name": "第1集-片段1", |
| 163 | "index": 1, |
| 164 | "description": "视频片段参考图描述", |
| 165 | "selected": "用户选中的参考图路径", |
| 166 | "versions": ["所有版本路径"], |
| 167 | "status": "done/pending/failed" |
| 168 | } |
| 169 | ] |
| 170 | } |
| 171 | ``` |
| 172 | |
| 173 | > **注意**: |
| 174 | > - `scenes[].id` = `storyboard.episodes[].segments[].segment_id`,用于跨阶段关联 |
| 175 | > - 参考图按视频片段生成,不按单个 shot 生成 |
| 176 | |
| 177 | ### 5. video_generation |
| 178 | |
| 179 | ```json |
| 180 | { |
| 181 | "session_id": "...", |
| 182 | "clips": [ |
| 183 | { |
| 184 | "id": "seg_01_01", |
| 185 | "name": "第1集-片段1", |
| 186 | "index": 1, |
| 187 | "description": "视频片段描述(由 storyboard.plot 同步)", |
| 188 | "duration": 5, |
| 189 | "selected": "用户选中的视频路径", |
| 190 | "versions": ["所有版本路径"], |
| 191 | "status": "done/pending/failed" |
| 192 | } |
| 193 | ] |
| 194 | } |
| 195 | ``` |
| 196 | |
| 197 | > **注意**:`clips[].id` = `storyboard.episodes[].segments[].segment_id` |
| 198 | |
| 199 | ### 6. post_production |
| 200 | |
| 201 | ```json |
| 202 | { |
| 203 | "session_id": "...", |
| 204 | "final_videos": [ |
| 205 | { |
| 206 | "episode": 1, |
| 207 | "path": "code/result/video/xxx_ep1.mp4", |
| 208 | "name": "第 1 集" |
| 209 | } |
| 210 | ], |
| 211 | "final_video": "code/result/video/xxx_ep1.mp4" |
| 212 | } |
| 213 | ``` |
| 214 | |
| 215 | > **注意**:`final_videos` 包含按剧集拼接的所有成片列表,`final_video` 保留为兼容第一集的字段。 |
| 216 | |
| 217 | --- |
| 218 | |
| 219 | ## 跨阶段数据同步关系 |
| 220 | |
| 221 | ``` |
| 222 | storyboard (修改 segment.visual_prompt / segment.video_prompt / total_duration / shots) |
| 223 | ↓ |
| 224 | video_generation.clips (description/duration) |
| 225 | ↑ (修改 description/duration) |
| 226 | ↑ |
| 227 | video_generation (修改 clips.description/clips.duration) |
| 228 | ↓ (修改后同步回 storyboard) |
| 229 | storyboard (修改后同步回 storyboard.episodes[].segments[]) |
| 230 | |
| 231 | reference_generation (修改 scenes.description) |
| 232 | ↓ |
| 233 | storyboard.episodes[].segments[].visual_prompt (由 reference_generation 同步) |
| 234 | ↑ (修改后同步) |
| 235 | ↑ |
| 236 | reference_generation (修改 scenes.description) |
| 237 | ``` |
| 238 | |
| 239 | --- |
| 240 | |
| 241 | ## PATCH /artifact/{stage} 请求格式 |
| 242 | |
| 243 | ### storyboard |
| 244 | ```json |
| 245 | { |
| 246 | "episodes": [ |
| 247 | { |
| 248 | "episode_number": 1, |
| 249 | "segments": [ |
| 250 | {"segment_id": "seg_01_01", "total_duration": 10, "visual_prompt": "新提示词", "shots": []} |
| 251 | ] |
| 252 | } |
| 253 | ] |
| 254 | } |
| 255 | ``` |
| 256 | |
| 257 | ### reference_generation(修改视觉提示词) |
| 258 | ```json |
| 259 | { |
| 260 | "segments": [ |
| 261 | {"segment_id": "seg_01_01", "visual_prompt": "新提示词"} |
| 262 | ] |
| 263 | } |
| 264 | ``` |
| 265 | |
| 266 | ### reference_generation(选择图片版本) |
| 267 | ```json |
| 268 | { |
| 269 | "seg_01_01": "code/result/image/xxx/seg_01_01_v2.jpg" |
| 270 | } |
| 271 | ``` |
| 272 | |
| 273 | ### video_generation(修改片段描述/时长) |
| 274 | ```json |
| 275 | { |
| 276 | "seg_01_01": {"description": "新描述", "duration": 5} |
| 277 | } |
| 278 | ``` |
| 279 | |
| 280 | ### video_generation(选择视频版本) |
| 281 | ```json |
| 282 | { |
| 283 | "shot_001_01": "code/result/video/xxx/shot_001_01_v2.mp4" |
| 284 | } |
| 285 | ``` |
| 286 |