feat: video action to constant

This commit is contained in:
skynono
2025-06-27 22:43:01 +08:00
parent 0a04a76c71
commit 59a1f4c900
6 changed files with 21 additions and 10 deletions

View File

@@ -3,9 +3,11 @@ package middleware
import (
"bytes"
"encoding/json"
"github.com/gin-gonic/gin"
"io"
"one-api/common"
"one-api/constant"
"github.com/gin-gonic/gin"
)
func KlingRequestConvert() func(c *gin.Context) {
@@ -35,7 +37,7 @@ func KlingRequestConvert() func(c *gin.Context) {
c.Request.Body = io.NopCloser(bytes.NewBuffer(jsonData))
c.Request.URL.Path = "/v1/video/generations"
if image := originalReq["image"]; image == "" {
c.Set("action", "textGenerate")
c.Set("action", constant.TaskActionTextGenerate)
}
// We have to reset the request body for the next handlers