From affe5ed30b86e45ba271af9502435d5e686bc414 Mon Sep 17 00:00:00 2001 From: YBoy Date: Fri, 3 Apr 2026 04:23:32 +0200 Subject: [PATCH] =?UTF-8?q?refactor(api):=20type=20get=5Fknowledge=5Frate?= =?UTF-8?q?=5Flimit=20with=20KnowledgeRateLimitD=E2=80=A6=20(#34483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/services/billing_service.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/services/billing_service.py b/api/services/billing_service.py index 3c3e4aa6d2..c3ce48b6bc 100644 --- a/api/services/billing_service.py +++ b/api/services/billing_service.py @@ -32,6 +32,11 @@ class SubscriptionPlan(TypedDict): expiration_date: int +class KnowledgeRateLimitDict(TypedDict): + limit: int + subscription_plan: str + + class BillingService: base_url = os.environ.get("BILLING_API_URL", "BILLING_API_URL") secret_key = os.environ.get("BILLING_API_SECRET_KEY", "BILLING_API_SECRET_KEY") @@ -58,7 +63,7 @@ class BillingService: return usage_info @classmethod - def get_knowledge_rate_limit(cls, tenant_id: str): + def get_knowledge_rate_limit(cls, tenant_id: str) -> KnowledgeRateLimitDict: params = {"tenant_id": tenant_id} knowledge_rate_limit = cls._send_request("GET", "/subscription/knowledge-rate-limit", params=params)