feat: vertex veo sora-compatible video output

This commit is contained in:
Sh1n3zZ
2025-10-25 02:00:35 +08:00
parent 032f159509
commit 810641a264
2 changed files with 41 additions and 12 deletions

View File

@@ -10,6 +10,7 @@ import (
"regexp"
"strings"
"github.com/QuantumNous/new-api/common"
"github.com/QuantumNous/new-api/model"
"github.com/gin-gonic/gin"
@@ -302,6 +303,29 @@ func (a *TaskAdaptor) ParseTaskResult(respBody []byte) (*relaycommon.TaskInfo, e
return ti, nil
}
func (a *TaskAdaptor) ConvertToOpenAIVideo(task *model.Task) ([]byte, error) {
upstreamName, err := decodeLocalTaskID(task.TaskID)
if err != nil {
upstreamName = ""
}
modelName := extractModelFromOperationName(upstreamName)
if strings.TrimSpace(modelName) == "" {
modelName = "veo-3.0-generate-001"
}
v := dto.NewOpenAIVideo()
v.ID = task.TaskID
v.Model = modelName
v.Status = task.Status.ToVideoStatus()
v.SetProgressStr(task.Progress)
v.CreatedAt = task.CreatedAt
v.CompletedAt = task.UpdatedAt
if strings.HasPrefix(task.FailReason, "data:") && len(task.FailReason) > 0 {
v.SetMetadata("url", task.FailReason)
}
return common.Marshal(v)
}
// ============================
// helpers
// ============================