🎬 火宝短剧 - 基于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
fix 修改风格
jiangzj70224d947850
diff --git a/api/handlers/image_generation.go b/api/handlers/image_generation.goindex 051862c..c857911 100644--- a/api/handlers/image_generation.go+++ b/api/handlers/image_generation.go@@ -87,9 +87,9 @@ func (h *ImageGenerationHandler) ExtractBackgroundsForEpisode(c *gin.Context) {req.Model = ""req.Style = ""}- // 如果style为空,使用配置中的默认风格+ // 如果style为空,使用硬编码默认风格if req.Style == "" {- req.Style = h.config.Style.DefaultStyle + ", " + h.config.Style.DefaultSceneStyle+ req.Style = "Modern Japanese anime style"}// 直接调用服务层的异步方法,该方法会创建任务并返回任务IDdiff --git a/application/services/character_library_service.go b/application/services/character_library_service.goindex 5fb4a9e..135d78a 100644--- a/application/services/character_library_service.go+++ b/application/services/character_library_service.go@@ -334,9 +334,7 @@ func (s *CharacterLibraryService) GenerateCharacterImage(characterID string, imaprompt = character.Name}- prompt += s.config.Style.DefaultStyle- prompt += s.config.Style.DefaultRoleStyle- prompt += s.config.Style.DefaultRoleRatio+ prompt += ", Modern Japanese anime style"// 调用图片生成服务dramaIDStr := fmt.Sprintf("%d", character.DramaID)imageType := "character"diff --git a/application/services/image_generation_service.go b/application/services/image_generation_service.goindex 996b2fe..ba96d1f 100644--- a/application/services/image_generation_service.go+++ b/application/services/image_generation_service.go@@ -157,7 +157,7 @@ func (s *ImageGenerationService) GenerateImage(request *GenerateImageRequest) (*func (s *ImageGenerationService) ProcessImageGeneration(imageGenID uint) {var imageGen models.ImageGeneration- imageRatio := s.config.Style.DefaultImageRatio+ imageRatio := "16:9"if err := s.db.First(&imageGen, imageGenID).Error; err != nil {s.log.Errorw("Failed to load image generation", "error", err, "id", imageGenID)returndiff --git a/application/services/prompt_i18n.go b/application/services/prompt_i18n.goindex 7932aee..7fca0e2 100644--- a/application/services/prompt_i18n.go+++ b/application/services/prompt_i18n.go@@ -145,19 +145,12 @@ func (p *PromptI18n) GetStoryboardSystemPrompt() string {// GetSceneExtractionPrompt 获取场景提取提示词func (p *PromptI18n) GetSceneExtractionPrompt(style string) string {- // 如果未指定风格,使用配置中的默认风格- if style == "" {- style = p.config.Style.DefaultSceneStyle- } else {- // 默认风格加style- style = p.config.Style.DefaultSceneStyle + ", " + style- }- // 如果配置也没有,使用硬编码默认值+ // 如果未指定风格,使用硬编码默认值if style == "" {style = "Modern Japanese anime style"}- // default_image_ratio- imageRatio := p.config.Style.DefaultImageRatio+ // 默认图片比例+ imageRatio := "16:9"if p.IsEnglish() {return fmt.Sprintf(`[Task] Extract all unique scene backgrounds from the script@@ -209,8 +202,8 @@ Each element containing:// GetFirstFramePrompt 获取首帧提示词func (p *PromptI18n) GetFirstFramePrompt() string {- style := p.config.Style.DefaultStyle- imageRatio := p.config.Style.DefaultImageRatio+ style := "Modern Japanese anime style"+ imageRatio := "16:9"if p.IsEnglish() {return fmt.Sprintf(`You are a professional image generation prompt expert. Please generate prompts suitable for AI image generation based on the provided shot information.@@ -250,8 +243,8 @@ Return a JSON object containing:// GetKeyFramePrompt 获取关键帧提示词func (p *PromptI18n) GetKeyFramePrompt() string {- style := p.config.Style.DefaultStyle- imageRatio := p.config.Style.DefaultImageRatio+ style := "Modern Japanese anime style"+ imageRatio := "16:9"if p.IsEnglish() {return fmt.Sprintf(`You are a professional image generation prompt expert. Please generate prompts suitable for AI image generation based on the provided shot information.@@ -291,8 +284,8 @@ Return a JSON object containing:// GetActionSequenceFramePrompt 获取动作序列提示词func (p *PromptI18n) GetActionSequenceFramePrompt() string {- style := p.config.Style.DefaultStyle- imageRatio := p.config.Style.DefaultImageRatio+ style := "Modern Japanese anime style"+ imageRatio := "16:9"if p.IsEnglish() {return fmt.Sprintf(`**Role:** You are an expert in visual storytelling and image generation prompting. You need to generate a single prompt that describes a 3x3 grid action sequence.@@ -377,8 +370,8 @@ You must return a **JSON object** with the following structure:// GetLastFramePrompt 获取尾帧提示词func (p *PromptI18n) GetLastFramePrompt() string {- style := p.config.Style.DefaultStyle- imageRatio := p.config.Style.DefaultImageRatio+ style := "Modern Japanese anime style"+ imageRatio := "16:9"if p.IsEnglish() {return fmt.Sprintf(`You are a professional image generation prompt expert. Please generate prompts suitable for AI image generation based on the provided shot information.@@ -461,8 +454,8 @@ Return a JSON object containing:// GetCharacterExtractionPrompt 获取角色提取提示词func (p *PromptI18n) GetCharacterExtractionPrompt() string {- style := p.config.Style.DefaultStyle- imageRatio := p.config.Style.DefaultImageRatio+ style := "Modern Japanese anime style"+ imageRatio := "16:9"if p.IsEnglish() {return fmt.Sprintf(`You are a professional character analyst, skilled at extracting and analyzing character information from scripts.@@ -508,11 +501,8 @@ Each element is a character object containing the above fields.`, style, imageRa// GetPropExtractionPrompt 获取道具提取提示词func (p *PromptI18n) GetPropExtractionPrompt() string {- style := p.config.Style.DefaultStyle + ", " + p.config.Style.DefaultPropStyle- imageRatio := p.config.Style.DefaultPropRatio- if imageRatio == "" {- imageRatio = p.config.Style.DefaultImageRatio- }+ style := "Modern Japanese anime style"+ imageRatio := "1:1"if p.IsEnglish() {return fmt.Sprintf(`Please extract key props from the following script.@@ -610,8 +600,8 @@ Output Format:// FormatUserPrompt 格式化用户提示词的通用文本func (p *PromptI18n) FormatUserPrompt(key string, args ...interface{}) string {- style := p.config.Style.DefaultStyle- imageRatio := p.config.Style.DefaultImageRatio+ style := "Modern Japanese anime style"+ imageRatio := "16:9"templates := map[string]map[string]string{"en": {diff --git a/application/services/prop_service.go b/application/services/prop_service.goindex 0038468..ae5eb17 100644--- a/application/services/prop_service.go+++ b/application/services/prop_service.go@@ -164,15 +164,8 @@ func (s *PropService) processPropImageGeneration(taskID string, prop models.Props.taskService.UpdateTaskStatus(taskID, "processing", 0, "正在生成图片...")// 准备生成参数- imageStyle := s.config.Style.DefaultStyle- if s.config != nil && s.config.Style.DefaultPropStyle != "" {- imageStyle += ", " + s.config.Style.DefaultPropStyle- }-+ imageStyle := "Modern Japanese anime style"imageSize := "1024x1024"- if s.config != nil && s.config.Style.DefaultImageSize != "" {- imageSize = s.config.Style.DefaultImageSize- }// 创建生成请求req := &GenerateImageRequest{@@ -185,17 +178,6 @@ func (s *PropService) processPropImageGeneration(taskID string, prop models.PropProvider: s.config.AI.DefaultImageProvider, // 使用默认配置}- // 增加默认比例(如果有配置)- // 注意:GenerateImageRequest 最好增加 Ratio 字段,或者在 PropService 这里拼接到 prompt- // 目前 ImageGenerationService 支持 Width/Height 和 Size- // 如果配置了 Ratio,可能需要转换为 Size 或 Model 参数- // 简单起见,如果 Prompt 中需要 Ratio,可以追加- if s.config != nil && s.config.Style.DefaultPropRatio != "" {- // 这里暂不处理,因为 ImageGenerationService 主要靠 Size 控制- // 如果需要,可以调整 prompt- // req.Prompt += ", ratio: " + s.config.Style.DefaultPropRatio- }-// 调用 ImageGenerationServiceimageGen, err := s.imageGenerationService.GenerateImage(req)if err != nil {diff --git a/application/services/storyboard_service.go b/application/services/storyboard_service.goindex 449d357..5ca2ca2 100644--- a/application/services/storyboard_service.go+++ b/application/services/storyboard_service.go@@ -620,8 +620,8 @@ func extractCompositionType(shotType string) string {// generateVideoPrompt 生成专门用于视频生成的提示词(包含运镜和动态元素)func (s *StoryboardService) generateVideoPrompt(sb Storyboard) string {var parts []string- style := s.config.Style.DefaultStyle- videoRatio := s.config.Style.DefaultVideoRatio+ style := "Modern Japanese anime style"+ videoRatio := "16:9"// 1. 人物动作if sb.Action != "" {parts = append(parts, fmt.Sprintf("Action: %s", sb.Action))diff --git a/pkg/config/config.go b/pkg/config/config.goindex 1873eb7..081db5d 100644--- a/pkg/config/config.go+++ b/pkg/config/config.go@@ -12,7 +12,6 @@ type Config struct {Database DatabaseConfig `mapstructure:"database"`Storage StorageConfig `mapstructure:"storage"`AI AIConfig `mapstructure:"ai"`- Style StyleConfig `mapstructure:"style"`}type AppConfig struct {@@ -55,29 +54,6 @@ type AIConfig struct {DefaultVideoProvider string `mapstructure:"default_video_provider"`}-type StyleConfig struct {- // 默认主风格- DefaultStyle string `mapstructure:"default_style"`- // 默认角色风格- DefaultRoleStyle string `mapstructure:"default_role_style"`- // 默认场景风格- DefaultSceneStyle string `mapstructure:"default_scene_style"`- // 默认视频比例- DefaultVideoRatio string `mapstructure:"default_video_ratio"`- // 默认图片比例- DefaultImageRatio string `mapstructure:"default_image_ratio"`- // 默认图片尺寸- DefaultImageSize string `mapstructure:"default_image_size"`- // 默认道具比例- DefaultPropRatio string `mapstructure:"default_prop_ratio"`- // 默认道具风格- DefaultPropStyle string `mapstructure:"default_prop_style"`- // 默认场景比例- DefaultSceneRatio string `mapstructure:"default_scene_ratio"`- // 默认角色比例- DefaultRoleRatio string `mapstructure:"default_role_ratio"`-}-func LoadConfig() (*Config, error) {viper.SetConfigName("config")viper.SetConfigType("yaml")