mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-13 07:40:56 +00:00
fix(billing): extend quantity validation and saturating conversions to remaining paths
Bound max-tokens fields across all relay format validators, saturate tiered-expression rounding and audio/tool/task token conversions, and route legacy remix ratios through the guarded setter.
This commit is contained in:
+2
-2
@@ -54,7 +54,7 @@ func calculateAudioQuota(info QuotaInfo) int {
|
||||
groupRatio := decimal.NewFromFloat(info.GroupRatio)
|
||||
|
||||
quota := modelPrice.Mul(quotaPerUnit).Mul(groupRatio)
|
||||
return int(quota.IntPart())
|
||||
return decimalToQuota(quota)
|
||||
}
|
||||
|
||||
completionRatio := decimal.NewFromFloat(ratio_setting.GetCompletionRatio(info.ModelName))
|
||||
@@ -83,7 +83,7 @@ func calculateAudioQuota(info QuotaInfo) int {
|
||||
quota = decimal.NewFromInt(1)
|
||||
}
|
||||
|
||||
return int(quota.Round(0).IntPart())
|
||||
return decimalToQuota(quota)
|
||||
}
|
||||
|
||||
func PreWssConsumeQuota(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, usage *dto.RealtimeUsage) error {
|
||||
|
||||
Reference in New Issue
Block a user