fix(gateway): normalize model alias billing identity

This commit is contained in:
2026-05-28 01:19:28 +08:00
parent f5c69b9852
commit 2aeb47d6a5
4 changed files with 185 additions and 16 deletions
+8 -3
View File
@@ -687,11 +687,16 @@ func (s *Store) SettleTaskBilling(ctx context.Context, task GatewayTask) error {
if currency == "" || currency == "mixed" {
currency = "resource"
}
modelIdentity := taskBillingModelIdentity(task)
metadataMap := map[string]any{
"taskId": task.ID,
"kind": task.Kind,
"model": task.Model,
"resolvedModel": task.ResolvedModel,
"model": modelIdentity.Model,
"requestedModel": modelIdentity.RequestedModel,
"resolvedModel": modelIdentity.ResolvedModel,
"modelName": modelIdentity.ModelName,
"modelAlias": modelIdentity.ModelAlias,
"providerModel": modelIdentity.ProviderModelName,
"billings": task.Billings,
"billingSummary": task.BillingSummary,
}
@@ -814,7 +819,7 @@ func roundMoney(value float64) float64 {
func taskBillingString(value any) string {
if text, ok := value.(string); ok {
return text
return strings.TrimSpace(text)
}
return ""
}