Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(api): type get_knowledge_rate_limit with KnowledgeRateLimitD… (#34483)

YBoyaffe5ed30b86
diff --git a/api/services/billing_service.py b/api/services/billing_service.py
index 3c3e4aa6d25..c3ce48b6bc2 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)