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:
@@ -145,15 +145,13 @@ func composeTieredTextQuota(relayInfo *relaycommon.RelayInfo, summary textQuotaS
|
||||
|
||||
if tieredResult != nil {
|
||||
if snap := relayInfo.TieredBillingSnapshot; snap != nil {
|
||||
return int(decimal.NewFromFloat(tieredResult.ActualQuotaBeforeGroup).
|
||||
return decimalToQuota(decimal.NewFromFloat(tieredResult.ActualQuotaBeforeGroup).
|
||||
Mul(decimal.NewFromFloat(snap.GroupRatio)).
|
||||
Add(summary.ToolCallSurchargeQuota).
|
||||
Round(0).
|
||||
IntPart())
|
||||
Add(summary.ToolCallSurchargeQuota))
|
||||
}
|
||||
}
|
||||
|
||||
return tieredQuota + int(summary.ToolCallSurchargeQuota.Round(0).IntPart())
|
||||
return tieredQuota + decimalToQuota(summary.ToolCallSurchargeQuota)
|
||||
}
|
||||
|
||||
func calculateTextQuotaSummary(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, usage *dto.Usage) textQuotaSummary {
|
||||
|
||||
Reference in New Issue
Block a user