diff --git a/controller/billing.go b/controller/billing.go index e5560c22..ac99e887 100644 --- a/controller/billing.go +++ b/controller/billing.go @@ -48,6 +48,9 @@ func GetUsage(c *gin.Context) { return } amount := float64(quota) + if common.DisplayInCurrencyEnabled { + amount /= common.QuotaPerUnit + } usage := OpenAIUsageResponse{ Object: "list", TotalUsage: amount, diff --git a/model/cache.go b/model/cache.go index 4ca60496..cf7cf4f7 100644 --- a/model/cache.go +++ b/model/cache.go @@ -33,6 +33,7 @@ func CacheGetTokenByKey(key string) (*Token, error) { if err != nil { common.SysError("Redis set token error: " + err.Error()) } + return &token, nil } err = json.Unmarshal([]byte(tokenObjectString), &token) return &token, err @@ -94,6 +95,7 @@ func CacheGetRandomSatisfiedChannel(group string, model string) (*Channel, error if !common.RedisEnabled { return GetRandomSatisfiedChannel(group, model) } + return GetRandomSatisfiedChannel(group, model) // TODO: implement this return nil, nil }