From 94ba3dd024022be9cf01c7181d24f2979c3c93b4 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sun, 25 Jun 2023 10:39:22 +0800 Subject: [PATCH 1/3] chore: billing api now will return a large number if unlimited quota is set --- controller/billing.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controller/billing.go b/controller/billing.go index 7bc63425..559d5e67 100644 --- a/controller/billing.go +++ b/controller/billing.go @@ -32,6 +32,9 @@ func GetSubscription(c *gin.Context) { if common.DisplayInCurrencyEnabled { amount /= common.QuotaPerUnit } + if token.UnlimitedQuota { + amount = 99999999.9999 + } subscription := OpenAISubscriptionResponse{ Object: "billing_subscription", HasPaymentMethod: true, From 6b1a24d650586bd500b06a2a7964b1572d5361b0 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sun, 25 Jun 2023 10:40:54 +0800 Subject: [PATCH 2/3] fix: check if token is nil before using it --- controller/billing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/billing.go b/controller/billing.go index 559d5e67..da1ef13d 100644 --- a/controller/billing.go +++ b/controller/billing.go @@ -32,7 +32,7 @@ func GetSubscription(c *gin.Context) { if common.DisplayInCurrencyEnabled { amount /= common.QuotaPerUnit } - if token.UnlimitedQuota { + if token != nil && token.UnlimitedQuota { amount = 99999999.9999 } subscription := OpenAISubscriptionResponse{ From 4a6a7f463592f67b923d8025e736cdf1c7249431 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sun, 25 Jun 2023 10:52:46 +0800 Subject: [PATCH 3/3] chore: update the number that representing the unlimited quota --- controller/billing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/billing.go b/controller/billing.go index da1ef13d..a45253ab 100644 --- a/controller/billing.go +++ b/controller/billing.go @@ -33,7 +33,7 @@ func GetSubscription(c *gin.Context) { amount /= common.QuotaPerUnit } if token != nil && token.UnlimitedQuota { - amount = 99999999.9999 + amount = 100000000 } subscription := OpenAISubscriptionResponse{ Object: "billing_subscription",