Jelajahi Sumber

fix: fail get moel by
multipart/form-data; boundary

feitianbubu 2 bulan lalu
induk
melakukan
95a2d02df9
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      middleware/distributor.go

+ 1 - 1
middleware/distributor.go

@@ -246,7 +246,7 @@ func getModelRequest(c *gin.Context) (*ModelRequest, bool, error) {
 		modelRequest.Model = common.GetStringIfEmpty(modelRequest.Model, "dall-e")
 		modelRequest.Model = common.GetStringIfEmpty(modelRequest.Model, "dall-e")
 	} else if strings.HasPrefix(c.Request.URL.Path, "/v1/images/edits") {
 	} else if strings.HasPrefix(c.Request.URL.Path, "/v1/images/edits") {
 		//modelRequest.Model = common.GetStringIfEmpty(c.PostForm("model"), "gpt-image-1")
 		//modelRequest.Model = common.GetStringIfEmpty(c.PostForm("model"), "gpt-image-1")
-		contentType := c.Request.Header.Get("Content-Type")
+		contentType := c.ContentType()
 		if slices.Contains([]string{gin.MIMEPOSTForm, gin.MIMEMultipartPOSTForm}, contentType) {
 		if slices.Contains([]string{gin.MIMEPOSTForm, gin.MIMEMultipartPOSTForm}, contentType) {
 			modelRequest.Model = c.PostForm("model")
 			modelRequest.Model = c.PostForm("model")
 		}
 		}