mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-06 00:01:05 +00:00
fix(personal): persist placeholders for video edit and extension jobs
media_jobs requires non-empty seconds/size/quality, so edit/extend now store stable placeholders while upstream still omits generation-only fields.
This commit is contained in:
1 parent
55078cd588
commit
bb4394eef5
1 file changed
+15
-3
@@ -93,6 +93,13 @@ func (s *Service) CreateVideo(ctx context.Context, input VideoInput) (media.Job,
|
||||
if operation == provider.VideoOperationEdit && input.Duration != 0 {
|
||||
return media.Job{}, fmt.Errorf("视频编辑不支持 duration")
|
||||
}
|
||||
if operation == provider.VideoOperationEdit {
|
||||
// Official edit has no duration field. Persist a placeholder that
|
||||
// satisfies media_jobs.seconds CHECK (1-15); worker ignores it.
|
||||
if input.Duration == 0 {
|
||||
input.Duration = 1
|
||||
}
|
||||
}
|
||||
if operation == provider.VideoOperationExtend {
|
||||
if input.Duration == 0 {
|
||||
input.Duration = 6
|
||||
@@ -101,9 +108,14 @@ func (s *Service) CreateVideo(ctx context.Context, input VideoInput) (media.Job,
|
||||
return media.Job{}, fmt.Errorf("视频延长 duration 必须在 2 到 10 秒之间")
|
||||
}
|
||||
}
|
||||
// Edit/extend keep source geometry; ignore generation-only knobs.
|
||||
input.AspectRatio = ""
|
||||
input.Resolution = ""
|
||||
// Edit/extend keep source geometry upstream, but media_jobs still requires
|
||||
// non-empty size/quality columns. Store stable placeholders only.
|
||||
if strings.TrimSpace(input.AspectRatio) == "" {
|
||||
input.AspectRatio = "source"
|
||||
}
|
||||
if strings.TrimSpace(input.Resolution) == "" {
|
||||
input.Resolution = "source"
|
||||
}
|
||||
}
|
||||
allRefs := videoInputReferences(input.ImageURL, input.ReferenceURLs)
|
||||
if err := s.validateVideoInputReferences(ctx, allRefs); err != nil {
|
||||
|
||||
Reference in new issue
Block a user