refactor(relay): rename RelayTask to RelayTaskFetch and update routing

- Renamed RelayTask function to RelayTaskFetch for clarity.
- Updated routing in relay-router.go and video-router.go to use RelayTaskFetch for fetch operations.
- Enhanced error handling in RelayTaskFetch function.
- Adjusted task data conversion in TaskAdaptor to include task ID.
This commit is contained in:
CaIon
2026-02-21 23:05:58 +08:00
parent 809ba92089
commit a920d1f925
4 changed files with 28 additions and 18 deletions

View File

@@ -174,8 +174,8 @@ func SetRelayRouter(router *gin.Engine) {
relaySunoRouter.Use(middleware.TokenAuth(), middleware.Distribute())
{
relaySunoRouter.POST("/submit/:action", controller.RelayTask)
relaySunoRouter.POST("/fetch", controller.RelayTask)
relaySunoRouter.GET("/fetch/:id", controller.RelayTask)
relaySunoRouter.POST("/fetch", controller.RelayTaskFetch)
relaySunoRouter.GET("/fetch/:id", controller.RelayTaskFetch)
}
relayGeminiRouter := router.Group("/v1beta")

View File

@@ -19,14 +19,14 @@ func SetVideoRouter(router *gin.Engine) {
videoV1Router.Use(middleware.TokenAuth(), middleware.Distribute())
{
videoV1Router.POST("/video/generations", controller.RelayTask)
videoV1Router.GET("/video/generations/:task_id", controller.RelayTask)
videoV1Router.GET("/video/generations/:task_id", controller.RelayTaskFetch)
videoV1Router.POST("/videos/:video_id/remix", controller.RelayTask)
}
// openai compatible API video routes
// docs: https://platform.openai.com/docs/api-reference/videos/create
{
videoV1Router.POST("/videos", controller.RelayTask)
videoV1Router.GET("/videos/:task_id", controller.RelayTask)
videoV1Router.GET("/videos/:task_id", controller.RelayTaskFetch)
}
klingV1Router := router.Group("/kling/v1")
@@ -34,8 +34,8 @@ func SetVideoRouter(router *gin.Engine) {
{
klingV1Router.POST("/videos/text2video", controller.RelayTask)
klingV1Router.POST("/videos/image2video", controller.RelayTask)
klingV1Router.GET("/videos/text2video/:task_id", controller.RelayTask)
klingV1Router.GET("/videos/image2video/:task_id", controller.RelayTask)
klingV1Router.GET("/videos/text2video/:task_id", controller.RelayTaskFetch)
klingV1Router.GET("/videos/image2video/:task_id", controller.RelayTaskFetch)
}
// Jimeng official API routes - direct mapping to official API format