fix: vertex ai video proxy and task polling improvements

This commit is contained in:
Seefs
2026-02-27 18:47:47 +08:00
parent 985189af23
commit c3291e407a
2 changed files with 9 additions and 1 deletions

View File

@@ -149,7 +149,7 @@ func getVertexVideoURL(channel *model.Channel, task *model.Task) (string, error)
if channel == nil || task == nil {
return "", fmt.Errorf("invalid channel or task")
}
if url := strings.TrimSpace(task.GetResultURL()); url != "" {
if url := strings.TrimSpace(task.GetResultURL()); url != "" && !isTaskProxyContentURL(url, task.TaskID) {
return url, nil
}
if url := extractVertexVideoURLFromTaskData(task); url != "" {
@@ -198,6 +198,13 @@ func getVertexVideoURL(channel *model.Channel, task *model.Task) (string, error)
return "", fmt.Errorf("vertex video url not found")
}
func isTaskProxyContentURL(url string, taskID string) bool {
if strings.TrimSpace(url) == "" || strings.TrimSpace(taskID) == "" {
return false
}
return strings.Contains(url, "/v1/videos/"+taskID+"/content")
}
func getVertexTaskKey(channel *model.Channel, task *model.Task) string {
if task != nil {
if key := strings.TrimSpace(task.PrivateData.Key); key != "" {

View File

@@ -421,6 +421,7 @@ func updateVideoSingleTask(ctx context.Context, adaptor TaskPollingAdaptor, ch *
}
if strings.HasPrefix(taskResult.Url, "data:") {
// data: URI (e.g. Vertex base64 encoded video) — keep in Data, not in ResultURL
task.PrivateData.ResultURL = taskcommon.BuildProxyURL(task.TaskID)
} else if taskResult.Url != "" {
// Direct upstream URL (e.g. Kling, Ali, Doubao, etc.)
task.PrivateData.ResultURL = taskResult.Url