fix: resolve cherry-pick conflicts and restore compilation
- Restore gateway_cache.go to upstream (no lua embeds) - Restore payment_order.go to upstream (use out_trade_no lookup) - Restore payment_fulfillment.go to upstream (same reason) - Add FeaturesConfig field and IsWebSearchEmulationEnabled to Channel - Add applyAccountStatsCost wrapper function - Add SettingKeyWebSearchEmulationConfig constant - Add WebSearchEmulationEnabled to SystemSettings - Add notify code rate limiting methods to EmailCache interface - Remove AllowUserRefund references (ent schema not present) - Fix duplicate import in payment_handler.go - Fix wire_gen.go argument mismatches
This commit is contained in:
@@ -227,3 +227,24 @@ func calculateTokenStatsCost(pricing *ChannelModelPricing, tokens UsageTokens) *
|
||||
}
|
||||
return &cost
|
||||
}
|
||||
|
||||
// applyAccountStatsCost resolves the account stats cost for a usage log entry.
|
||||
// It resolves the upstream model (falling back to the requested model) and calls
|
||||
// the 4-level priority chain via resolveAccountStatsCost.
|
||||
func applyAccountStatsCost(
|
||||
ctx context.Context,
|
||||
usageLog *UsageLog,
|
||||
cs *ChannelService, bs *BillingService,
|
||||
accountID int64, groupID int64,
|
||||
upstreamModel, requestedModel string,
|
||||
tokens UsageTokens,
|
||||
totalCost float64,
|
||||
) {
|
||||
model := upstreamModel
|
||||
if model == "" {
|
||||
model = requestedModel
|
||||
}
|
||||
usageLog.AccountStatsCost = resolveAccountStatsCost(
|
||||
ctx, cs, bs, accountID, groupID, model, tokens, 1, totalCost,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user