Commit 0d3dde78 by Xyfacai

fix(image): 只有 dalle模型才受 size、quality 影响价格

parent 9f957da5
......@@ -145,6 +145,9 @@ func ImageHelper(c *gin.Context) (newAPIError *types.NewAPIError) {
} else {
sizeRatio := 1.0
qualityRatio := 1.0
if strings.HasPrefix(imageRequest.Model, "dall-e") {
// Size
if imageRequest.Size == "256x256" {
sizeRatio = 0.4
......@@ -156,13 +159,13 @@ func ImageHelper(c *gin.Context) (newAPIError *types.NewAPIError) {
sizeRatio = 2
}
qualityRatio := 1.0
if imageRequest.Model == "dall-e-3" && imageRequest.Quality == "hd" {
qualityRatio = 2.0
if imageRequest.Size == "1024x1792" || imageRequest.Size == "1792x1024" {
qualityRatio = 1.5
}
}
}
// reset model price
priceData.ModelPrice *= sizeRatio * qualityRatio * float64(imageRequest.N)
......
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