From 5156ca9cecc3ddad0b3d68d40b8df6326de46280 Mon Sep 17 00:00:00 2001 From: zenfun Date: Mon, 29 Dec 2025 23:39:04 +0800 Subject: [PATCH] feat(model): add request statistics fields to ProviderGroup and APIKey --- internal/model/provider_group.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/model/provider_group.go b/internal/model/provider_group.go index dd3f406..00add9e 100644 --- a/internal/model/provider_group.go +++ b/internal/model/provider_group.go @@ -18,6 +18,11 @@ type ProviderGroup struct { HeadersProfile string `gorm:"size:64" json:"headers_profile,omitempty"` Models string `json:"models"` // comma-separated list of supported models Status string `gorm:"size:50;default:'active'" json:"status"` + TotalRequests int64 `gorm:"default:0" json:"total_requests"` + SuccessRequests int64 `gorm:"default:0" json:"success_requests"` + FailureRequests int64 `gorm:"default:0" json:"failure_requests"` + SuccessRate float64 `gorm:"default:0" json:"success_rate"` + FailureRate float64 `gorm:"default:0" json:"failure_rate"` } // APIKey represents a credential within a provider group. @@ -35,4 +40,9 @@ type APIKey struct { AutoBan bool `gorm:"default:true" json:"auto_ban"` BanReason string `gorm:"size:255" json:"ban_reason"` BanUntil *time.Time `json:"ban_until"` + TotalRequests int64 `gorm:"default:0" json:"total_requests"` + SuccessRequests int64 `gorm:"default:0" json:"success_requests"` + FailureRequests int64 `gorm:"default:0" json:"failure_requests"` + SuccessRate float64 `gorm:"default:0" json:"success_rate"` + FailureRate float64 `gorm:"default:0" json:"failure_rate"` }