mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 02:25:00 +00:00
fix: preserve explicit zero values in native relay requests
This commit is contained in:
@@ -113,11 +113,15 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type
|
||||
return newAPIError
|
||||
}
|
||||
|
||||
imageN := uint(1)
|
||||
if request.N != nil {
|
||||
imageN = *request.N
|
||||
}
|
||||
if usage.(*dto.Usage).TotalTokens == 0 {
|
||||
usage.(*dto.Usage).TotalTokens = int(request.N)
|
||||
usage.(*dto.Usage).TotalTokens = int(imageN)
|
||||
}
|
||||
if usage.(*dto.Usage).PromptTokens == 0 {
|
||||
usage.(*dto.Usage).PromptTokens = int(request.N)
|
||||
usage.(*dto.Usage).PromptTokens = int(imageN)
|
||||
}
|
||||
|
||||
quality := "standard"
|
||||
@@ -133,8 +137,8 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type
|
||||
if len(quality) > 0 {
|
||||
logContent = append(logContent, fmt.Sprintf("品质 %s", quality))
|
||||
}
|
||||
if request.N > 0 {
|
||||
logContent = append(logContent, fmt.Sprintf("生成数量 %d", request.N))
|
||||
if imageN > 0 {
|
||||
logContent = append(logContent, fmt.Sprintf("生成数量 %d", imageN))
|
||||
}
|
||||
|
||||
postConsumeQuota(c, info, usage.(*dto.Usage), logContent...)
|
||||
|
||||
Reference in New Issue
Block a user