Commit 30112005 by Seefs Committed by GitHub

Merge pull request #1994 from feitianbubu/pr/fix-video-model

fix: avoid get model consuming body
parents 3cc60f22 0d0e4f53
...@@ -174,7 +174,16 @@ func getModelRequest(c *gin.Context) (*ModelRequest, bool, error) { ...@@ -174,7 +174,16 @@ func getModelRequest(c *gin.Context) (*ModelRequest, bool, error) {
relayMode := relayconstant.RelayModeUnknown relayMode := relayconstant.RelayModeUnknown
if c.Request.Method == http.MethodPost { if c.Request.Method == http.MethodPost {
relayMode = relayconstant.RelayModeVideoSubmit relayMode = relayconstant.RelayModeVideoSubmit
modelRequest.Model = c.PostForm("model") form, err := common.ParseMultipartFormReusable(c)
if err != nil {
return nil, false, errors.New("无效的video请求, " + err.Error())
}
defer form.RemoveAll()
if form != nil {
if values, ok := form.Value["model"]; ok && len(values) > 0 {
modelRequest.Model = values[0]
}
}
} }
c.Set("relay_mode", relayMode) c.Set("relay_mode", relayMode)
} else if strings.Contains(c.Request.URL.Path, "/v1/video/generations") { } else if strings.Contains(c.Request.URL.Path, "/v1/video/generations") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment