feat(canvas): 视频参数 - 支持自定义时长并统一分辨率与设置面板
This commit is contained in:
@@ -1044,11 +1044,6 @@ func newAPIChannel2VideoBody(input canvasGenerationInput) (map[string]interface{
|
||||
if secondsErr != nil || seconds < 1 {
|
||||
seconds = 6
|
||||
}
|
||||
if len(images) > 1 && seconds > 10 {
|
||||
seconds = 10
|
||||
} else if seconds > 15 {
|
||||
seconds = 15
|
||||
}
|
||||
ratio := normalizeNewAPIChannel2Ratio(input.Config.Size, modelName)
|
||||
resolution := normalizeNewAPIChannel2Resolution(input.Config.VQuality, modelName)
|
||||
body := map[string]interface{}{
|
||||
@@ -2170,9 +2165,6 @@ func normalizeXAIVideoDuration(value string) int {
|
||||
if err != nil || duration <= 0 {
|
||||
return 6
|
||||
}
|
||||
if duration > 15 {
|
||||
return 15
|
||||
}
|
||||
return duration
|
||||
}
|
||||
|
||||
@@ -2238,24 +2230,14 @@ func normalizeSeedanceDuration(value string) int {
|
||||
return -1
|
||||
}
|
||||
seconds, err := strconv.Atoi(strings.TrimSpace(value))
|
||||
if err != nil || seconds == 0 {
|
||||
seconds = 5
|
||||
}
|
||||
if seconds < 4 {
|
||||
return 4
|
||||
}
|
||||
if seconds > 15 {
|
||||
return 15
|
||||
if err != nil || seconds <= 0 {
|
||||
return 5
|
||||
}
|
||||
return seconds
|
||||
}
|
||||
|
||||
func normalizeSeedanceVideosDuration(value string) int {
|
||||
seconds := normalizeSeedanceDuration(value)
|
||||
if seconds < 4 {
|
||||
return 5
|
||||
}
|
||||
return seconds
|
||||
return normalizeSeedanceDuration(value)
|
||||
}
|
||||
|
||||
func normalizeSeedanceRatio(value string) string {
|
||||
|
||||
@@ -527,7 +527,7 @@ func TestXAIVideoBodyUsesOfficialImageShapeAndNormalizesSettings(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("grokVideoBody() error = %v", err)
|
||||
}
|
||||
if body["duration"] != 15 || body["aspect_ratio"] != "9:16" || body["resolution"] != "1080p" {
|
||||
if body["duration"] != 20 || body["aspect_ratio"] != "9:16" || body["resolution"] != "1080p" {
|
||||
t.Fatalf("xAI settings = %#v", body)
|
||||
}
|
||||
image, ok := body["image"].(map[string]interface{})
|
||||
|
||||
Reference in New Issue
Block a user