This commit is contained in:
Seefs
2025-10-31 15:29:17 +08:00
committed by GitHub
parent fc56f45628
commit 9629c8a771
6 changed files with 278 additions and 14 deletions

View File

@@ -92,8 +92,30 @@ func VideoProxy(c *gin.Context) {
}
if channel.Type == constant.ChannelTypeGemini {
videoURL = fmt.Sprintf("%s&key=%s", c.Query("url"), channel.Key)
req.Header.Set("x-goog-api-key", channel.Key)
apiKey := task.PrivateData.Key
if apiKey == "" {
logger.LogError(c.Request.Context(), fmt.Sprintf("Missing stored API key for Gemini task %s", taskID))
c.JSON(http.StatusInternalServerError, gin.H{
"error": gin.H{
"message": "API key not stored for task",
"type": "server_error",
},
})
return
}
videoURL, err = getGeminiVideoURL(channel, task, apiKey)
if err != nil {
logger.LogError(c.Request.Context(), fmt.Sprintf("Failed to resolve Gemini video URL for task %s: %s", taskID, err.Error()))
c.JSON(http.StatusBadGateway, gin.H{
"error": gin.H{
"message": "Failed to resolve Gemini video URL",
"type": "server_error",
},
})
return
}
req.Header.Set("x-goog-api-key", apiKey)
} else {
// Default (Sora, etc.): Use original logic
videoURL = fmt.Sprintf("%s/v1/videos/%s/content", baseURL, task.TaskID)