feat: all video preview use videos/:id/content

This commit is contained in:
feitianbubu
2025-11-28 12:39:37 +08:00
parent b47cf4efb3
commit 2a77453e1a
3 changed files with 7 additions and 7 deletions

View File

@@ -117,13 +117,12 @@ func VideoProxy(c *gin.Context) {
return return
} }
req.Header.Set("x-goog-api-key", apiKey) req.Header.Set("x-goog-api-key", apiKey)
case constant.ChannelTypeAli: case constant.ChannelTypeOpenAI, constant.ChannelTypeSora:
// Video URL is directly in task.FailReason
videoURL = task.FailReason
default:
// Default (Sora, etc.): Use original logic
videoURL = fmt.Sprintf("%s/v1/videos/%s/content", baseURL, task.TaskID) videoURL = fmt.Sprintf("%s/v1/videos/%s/content", baseURL, task.TaskID)
req.Header.Set("Authorization", "Bearer "+channel.Key) req.Header.Set("Authorization", "Bearer "+channel.Key)
default:
// Video URL is directly in task.FailReason
videoURL = task.FailReason
} }
req.URL, err = url.Parse(videoURL) req.URL, err = url.Parse(videoURL)

View File

@@ -9,9 +9,9 @@ import (
func SetVideoRouter(router *gin.Engine) { func SetVideoRouter(router *gin.Engine) {
videoV1Router := router.Group("/v1") videoV1Router := router.Group("/v1")
videoV1Router.GET("/videos/:task_id/content", controller.VideoProxy)
videoV1Router.Use(middleware.TokenAuth(), middleware.Distribute()) videoV1Router.Use(middleware.TokenAuth(), middleware.Distribute())
{ {
videoV1Router.GET("/videos/:task_id/content", controller.VideoProxy)
videoV1Router.POST("/video/generations", controller.RelayTask) videoV1Router.POST("/video/generations", controller.RelayTask)
videoV1Router.GET("/video/generations/:task_id", controller.RelayTask) videoV1Router.GET("/video/generations/:task_id", controller.RelayTask)
} }

View File

@@ -363,12 +363,13 @@ export const getTaskLogsColumns = ({
const isSuccess = record.status === 'SUCCESS'; const isSuccess = record.status === 'SUCCESS';
const isUrl = typeof text === 'string' && /^https?:\/\//.test(text); const isUrl = typeof text === 'string' && /^https?:\/\//.test(text);
if (isSuccess && isVideoTask && isUrl) { if (isSuccess && isVideoTask && isUrl) {
const videoUrl = `/v1/videos/${record.task_id}/content`;
return ( return (
<a <a
href='#' href='#'
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
openVideoModal(text); openVideoModal(videoUrl);
}} }}
> >
{t('点击预览视频')} {t('点击预览视频')}