修改cf渠道 火山视频生成时间问题

This commit is contained in:
Connor
2026-01-14 22:57:03 +08:00
parent 6a1f146ee4
commit 862ab3ca6c
2 changed files with 24 additions and 1 deletions

View File

@@ -146,13 +146,23 @@ func (c *ChatfireClient) GenerateVideo(imageURL, prompt string, opts ...VideoOpt
reqBody := ChatfireDoubaoRequest{
Model: model,
}
// 构建prompt文本包含duration和ratio参数
promptText := prompt
if options.AspectRatio != "" {
promptText += fmt.Sprintf(" --ratio %s", options.AspectRatio)
}
if options.Duration > 0 {
promptText += fmt.Sprintf(" --dur %d", options.Duration)
}
// 添加文本内容
reqBody.Content = append(reqBody.Content, struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
ImageURL map[string]interface{} `json:"image_url,omitempty"`
Role string `json:"role,omitempty"`
}{Type: "text", Text: prompt})
}{Type: "text", Text: promptText})
// 处理不同的图片模式
// 1. 组图模式多个reference_image