فهرست منبع

Comment out price data adjustment logic

Comment out code that modifies price data based on image count.
测试发现,如果是接入阿里百炼平台的qwen-image-2.0系列模型,这边计费的时候会出现 0.2*n*倍率*n的情况,最前面的0.2*n会直接显示为模型价格。
例如:
日志详情	模型价格 $0.600000,专属倍率 0.3
其他详情	大小 1080*1920, 品质 standard, 生成数量 3, 其他倍率 n: 3.000000
计费过程	模型价格:$0.600000 * 专属倍率:0.3 = $0.180000
刘泓宾 1 ماه پیش
والد
کامیت
53aeee4ff7
1فایلهای تغییر یافته به همراه9 افزوده شده و 8 حذف شده
  1. 9 8
      relay/channel/ali/image.go

+ 9 - 8
relay/channel/ali/image.go

@@ -55,9 +55,9 @@ func oaiImage2AliImageRequest(info *relaycommon.RelayInfo, request dto.ImageRequ
 	}
 
 	// 检查n参数
-	if imageRequest.Parameters.N != 0 {
-		info.PriceData.AddOtherRatio("n", float64(imageRequest.Parameters.N))
-	}
+	// if imageRequest.Parameters.N != 0 {
+	// 	info.PriceData.AddOtherRatio("n", float64(imageRequest.Parameters.N))
+	// }
 
 	// 同步图片模型和异步图片模型请求格式不一样
 	if isSync {
@@ -329,11 +329,12 @@ func aliImageHandler(a *Adaptor, c *gin.Context, resp *http.Response, info *rela
 
 	imageResponses := responseAli2OpenAIImage(c, aliResponse, originRespBody, info, responseFormat)
 	// 可能生成多张图片,修正计费数量n
-	if aliResponse.Usage.ImageCount != 0 {
-		info.PriceData.AddOtherRatio("n", float64(aliResponse.Usage.ImageCount))
-	} else if len(imageResponses.Data) != 0 {
-		info.PriceData.AddOtherRatio("n", float64(len(imageResponses.Data)))
-	}
+	// 注释掉,否则会导致多次扣费用
+	// if aliResponse.Usage.ImageCount != 0 {
+	// 	info.PriceData.AddOtherRatio("n", float64(aliResponse.Usage.ImageCount))
+	// } else if len(imageResponses.Data) != 0 {
+	// 	info.PriceData.AddOtherRatio("n", float64(len(imageResponses.Data)))
+	// }
 	jsonResponse, err := common.Marshal(imageResponses)
 	if err != nil {
 		return types.NewError(err, types.ErrorCodeBadResponseBody), nil