mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-19 09:38:39 +00:00
feat: add image handling to image request for form-data
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package helper
|
package helper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
@@ -150,6 +151,9 @@ func GetAndValidOpenAIImageRequest(c *gin.Context, relayMode int) (*dto.ImageReq
|
|||||||
imageRequest.N = uint(common.String2Int(formData.Get("n")))
|
imageRequest.N = uint(common.String2Int(formData.Get("n")))
|
||||||
imageRequest.Quality = formData.Get("quality")
|
imageRequest.Quality = formData.Get("quality")
|
||||||
imageRequest.Size = formData.Get("size")
|
imageRequest.Size = formData.Get("size")
|
||||||
|
if imageValue := formData.Get("image"); imageValue != "" {
|
||||||
|
imageRequest.Image, _ = json.Marshal(imageValue)
|
||||||
|
}
|
||||||
|
|
||||||
if imageRequest.Model == "gpt-image-1" {
|
if imageRequest.Model == "gpt-image-1" {
|
||||||
if imageRequest.Quality == "" {
|
if imageRequest.Quality == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user