🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
feat: update backend for filmstrip workbench pipeline
Connor9c5fa776e9c3
diff --git a/application/services/agent_tools_script.go b/application/services/agent_tools_script.goindex 41f76a0..9b3f8b0 100644--- a/application/services/agent_tools_script.go+++ b/application/services/agent_tools_script.go@@ -51,12 +51,39 @@ func (s *AgentService) getScriptRewriterTools() []tool.BaseTool {return "", fmt.Errorf("episode has no script content")}- prompt := fmt.Sprintf(`将以下小说内容改写为短剧剧本格式。+ prompt := fmt.Sprintf(`将以下内容改写为格式化剧本。+要求:1. 保持情节核心不变-2. 增加画面感描写和角色对白-3. 使用标准剧本格式(场景标题、动作描写、对话)-4. 适合短视频拍摄(每场戏控制在30-60秒)+2. 增强画面感描写和角色对白+3. 严格按以下格式输出,不要输出任何镜头语言(景别、角度、运镜等属于分镜拆解步骤)+4. 每个场景 30-60 秒内容,适合短视频++格式规范:+- 场景头:## S编号 | 内景/外景 · 地点 | 时间段+- 动作描写:自然段落+- 对白:角色名:(状态/表情)台词内容++示例:+## S01 | 内景 · 咖啡厅 | 黄昏++黄昏的光线透过落地窗洒进咖啡厅,吧台上咖啡杯热气升腾。++小明独自坐在角落卡座,低头看手机,神情有些焦虑。++门铃响起,小红推门而入。她看到小明,微笑着走过去。++小红:(微笑)等很久了吗?+小明:(抬头)还好,刚到。++## S02 | 外景 · 街道 | 夜晚++路灯映着两人的身影,秋风吹落几片树叶。++小红裹紧围巾,脚步慢了下来。++小红:(低头)其实我今天来,是想跟你说一件事。+%s【原始内容】diff --git a/application/services/agent_tools_storyboard.go b/application/services/agent_tools_storyboard.goindex 8e883a8..19ad782 100644--- a/application/services/agent_tools_storyboard.go+++ b/application/services/agent_tools_storyboard.go@@ -63,6 +63,12 @@ func (s *AgentService) getStoryboardBreakerTools() []tool.BaseTool {if params.Duration != nil {updates["duration"] = *params.Duration}+ if params.VideoPrompt != nil {+ updates["video_prompt"] = *params.VideoPrompt+ }+ if params.Description != nil {+ updates["description"] = *params.Description+ }if len(updates) == 0 {return "", fmt.Errorf("no fields to update")}@@ -90,6 +96,8 @@ type UpdateStoryboardParams struct {Action *string `json:"action,omitempty" jsonschema:"description=Character action description"`Dialogue *string `json:"dialogue,omitempty" jsonschema:"description=Dialogue content"`Duration *int `json:"duration,omitempty" jsonschema:"description=Shot duration in seconds"`+ VideoPrompt *string `json:"video_prompt,omitempty" jsonschema:"description=Video generation prompt with time segments and tags"`+ Description *string `json:"description,omitempty" jsonschema:"description=Shot description in Chinese"`}func formatStoryboardSummary(storyboards []Storyboard) []map[string]interface{} {diff --git a/application/services/prompt_i18n.go b/application/services/prompt_i18n.goindex dc0e513..dfcca7d 100644--- a/application/services/prompt_i18n.go+++ b/application/services/prompt_i18n.go@@ -78,6 +78,16 @@ func (p *PromptI18n) GetStoryboardSystemPrompt() string {- dialogue: Character dialogue or narration (if any)- emotion: Current emotion- emotion_intensity: Emotion intensity level (3/2/1/0/-1)+ - video_prompt: Video generation prompt with time segments (REQUIRED)++2. video_prompt format rules:+ - Split into 3-second segments with time markers+ - Use <location>place</location> for scene tags+ - Use <role>name</role> for character tags+ - Use <voice>name</voice> for voiceover/narration tags+ - Use <n> to separate segments+ - Each shot should be 10-15 seconds total+ - Example: "0-3秒:<location>咖啡厅</location>,近景,<role>小明</role>低头看手机,表情焦虑。<n>3-6秒:<location>咖啡厅</location>,全景,门铃响,<role>小红</role>推门走入。"**CRITICAL: Return ONLY a valid JSON array. Do NOT include any markdown code blocks, explanations, or other text. Start directly with [ and end with ].**@@ -133,6 +143,16 @@ func (p *PromptI18n) GetStoryboardSystemPrompt() string {- dialogue:角色对话或旁白(如有)- emotion:当前情绪- emotion_intensity:情绪强度等级(3/2/1/0/-1)+ - video_prompt:视频生成提示词,按时间段描述(必填)++2. video_prompt 格式要求:+ - 按 3 秒为一段,用时间标记分隔+ - 使用 <location>地点</location> 标记场景+ - 使用 <role>角色名</role> 标记角色+ - 使用 <voice>角色名</voice> 标记画外音/旁白+ - 用 <n> 分隔不同时间段+ - 每个镜头总时长 10-15 秒+ - 示例:"0-3秒:<location>咖啡厅</location>,近景,<role>小明</role>低头看手机,表情焦虑。<n>3-6秒:<location>咖啡厅</location>,全景,门铃响,<role>小红</role>推门走入。"**重要:必须只返回纯JSON数组,不要包含任何markdown代码块、说明文字或其他内容。直接以 [ 开头,以 ] 结尾。**diff --git a/application/services/storyboard_service.go b/application/services/storyboard_service.goindex c93f889..4f891ad 100644--- a/application/services/storyboard_service.go+++ b/application/services/storyboard_service.go@@ -37,23 +37,24 @@ func NewStoryboardService(db *gorm.DB, cfg *config.Config, log *logger.Logger) *type Storyboard struct {ShotNumber int `json:"shot_number"`- Title string `json:"title"` // 镜头标题- ShotType string `json:"shot_type"` // 景别- Angle string `json:"angle"` // 镜头角度- Time string `json:"time"` // 时间- Location string `json:"location"` // 地点- SceneID *uint `json:"scene_id"` // 背景ID(AI直接返回,可为null)- Movement string `json:"movement"` // 运镜- Action string `json:"action"` // 动作- Dialogue string `json:"dialogue"` // 对话/独白- Result string `json:"result"` // 画面结果- Atmosphere string `json:"atmosphere"` // 环境氛围- Emotion string `json:"emotion"` // 情绪- Duration int `json:"duration"` // 时长(秒)- BgmPrompt string `json:"bgm_prompt"` // 配乐提示词- SoundEffect string `json:"sound_effect"` // 音效描述- Characters []uint `json:"characters"` // 涉及的角色ID列表- IsPrimary bool `json:"is_primary"` // 是否主镜+ Title string `json:"title"` // 镜头标题+ ShotType string `json:"shot_type"` // 景别+ Angle string `json:"angle"` // 镜头角度+ Time string `json:"time"` // 时间+ Location string `json:"location"` // 地点+ SceneID *uint `json:"scene_id"` // 背景ID(AI直接返回,可为null)+ Movement string `json:"movement"` // 运镜+ Action string `json:"action"` // 动作+ Dialogue string `json:"dialogue"` // 对话/独白+ Result string `json:"result"` // 画面结果+ Atmosphere string `json:"atmosphere"` // 环境氛围+ Emotion string `json:"emotion"` // 情绪+ Duration int `json:"duration"` // 时长(秒)+ BgmPrompt string `json:"bgm_prompt"` // 配乐提示词+ SoundEffect string `json:"sound_effect"` // 音效描述+ VideoPrompt string `json:"video_prompt"` // 视频生成提示词(带时间段+标签)+ Characters []uint `json:"characters"` // 涉及的角色ID列表+ IsPrimary bool `json:"is_primary"` // 是否主镜}type GenerateStoryboardResult struct {@@ -874,7 +875,11 @@ func (s *StoryboardService) saveStoryboards(episodeID string, storyboards []Stor// 生成两种专用提示词imagePrompt := s.generateImagePrompt(sb) // 专用于图片生成- videoPrompt := s.generateVideoPrompt(sb) // 专用于视频生成+ // 优先使用 AI 拆分时直接生成的视频提示词,否则 fallback 到自动生成+ videoPrompt := sb.VideoPrompt+ if videoPrompt == "" {+ videoPrompt = s.generateVideoPrompt(sb)+ }// 处理 dialogue 字段var dialoguePtr *stringdiff --git a/skills/script-rewriter/SKILL.md b/skills/script-rewriter/SKILL.mdindex dab91bf..f95c8fc 100644--- a/skills/script-rewriter/SKILL.md+++ b/skills/script-rewriter/SKILL.md@@ -1,6 +1,6 @@---name: script-rewriter-description: 小说改写为短剧剧本的方法论和规范+description: 小说改写为格式化剧本的方法论和规范---# 剧本改写指南@@ -11,27 +11,39 @@ description: 小说改写为短剧剧本的方法论和规范2. **增强画面感**:将叙述性文字转化为可视化的场景描写3. **对话驱动**:用对白推动情节,减少旁白4. **节奏把控**:每场戏控制在 30-60 秒,适合短视频+5. **不写镜头语言**:不涉及景别、角度、运镜,这些属于分镜拆解步骤-## 剧本格式规范+## 格式化剧本格式```-【场景标题】地点 - 时间-(动作描写/环境描述)+## S01 | 内景 · 咖啡厅 | 黄昏-角色A:对白内容-(角色A的表情/动作)+黄昏的光线透过落地窗洒进咖啡厅,吧台上咖啡杯热气升腾。-角色B:对白内容+小明独自坐在角落卡座,低头看手机,神情有些焦虑。-【旁白】(仅在必要时使用)+门铃响起,小红推门而入。她看到小明,微笑着走过去。++小红:(微笑)等很久了吗?+小明:(抬头)还好,刚到。```+### 格式规则++- `## S编号 | 内景/外景 · 地点 | 时间段` — 场景头+- 动作描写自然段 — 不包含任何镜头语言+- `角色名:(状态/表情)台词内容` — 对白格式++### 内容量参考++格式化剧本相比原始内容增加约 20-30%,主要增量是场景头标记和对白格式化,不是扩写。+## 改写步骤-1. 先调用 `read_episode_script` 读取原始小说内容+1. 先调用 `read_episode_script` 读取原始内容2. 分析内容结构(对话、叙述、心理描写的比例)3. 调用 `rewrite_to_screenplay` 执行改写-4. 检查改写结果,确认符合短剧格式+4. 检查改写结果,确认符合格式化剧本格式5. 调用 `save_script` 保存最终结果## 注意事项@@ -40,3 +52,5 @@ description: 小说改写为短剧剧本的方法论和规范- 长段叙述拆分为多个短场景- 确保每个场景有明确的情绪转折点- 保持角色语言风格一致性+- 场景编号连续递增(S01, S02, S03...)+- 时间段要具体(黄昏、深夜、清晨),不要笼统写"白天"diff --git a/skills/storyboard-breaker/SKILL.md b/skills/storyboard-breaker/SKILL.mdindex 4774be0..f9f92ab 100644--- a/skills/storyboard-breaker/SKILL.md+++ b/skills/storyboard-breaker/SKILL.md@@ -7,7 +7,7 @@ description: 分镜拆解专业规范## 拆解原则-每个镜头聚焦**单一动作**,描述要详尽具体。+每个镜头聚焦**单一动作**,描述要详尽具体。每个镜头时长 10-15 秒。## 镜头要素@@ -21,10 +21,27 @@ description: 分镜拆解专业规范8. **对话**:该镜头的完整对话9. **画面结果**:动作的即时后果 + 视觉细节10. **氛围**:光线 + 色调 + 声音 + 整体氛围-11. **时长**:每个镜头 3-8 秒+11. **时长**:每个镜头 10-15 秒+12. **视频提示词**:按 3 秒分段的视频生成描述(必填)++## 视频提示词格式++每个镜头必须包含 `video_prompt` 字段,用于驱动 AI 视频生成:++```+0-3秒:<location>咖啡厅</location>,近景,<role>小明</role>低头看手机,表情焦虑。+<n>3-6秒:<location>咖啡厅</location>,全景,门铃响,<role>小红</role>推门走入。+<n>6-9秒:<location>咖啡厅</location>,中景,<role>小红</role>微笑走向小明,坐下。+```++标签说明:+- `<location>地点</location>` — 场景标记+- `<role>角色名</role>` — 角色标记+- `<voice>角色名</voice>` — 画外音/旁白标记+- `<n>` — 时间段分隔符## 使用步骤1. 调用 `generate_storyboard` 生成分镜-2. 检查生成结果(镜头数量、总时长)-3. 如需调整,调用 `update_storyboard` 修改具体镜头+2. 检查生成结果(镜头数量、总时长、视频提示词)+3. 如需调整,调用 `update_storyboard` 修改具体镜头(支持修改 video_prompt)