From 817aa78d0394d062e10423e0910acd063f3b524d Mon Sep 17 00:00:00 2001 From: wwq Date: Mon, 20 Apr 2026 18:34:18 +0800 Subject: [PATCH] fix(rate_limit): differentiate between tenant plan and API Key QPS limit errors - Add logic to detect tenant plan QPS limits and return a specific error message when triggered. - Simplify boolean check in model activation quota validation. --- api/app/services/api_key_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/app/services/api_key_service.py b/api/app/services/api_key_service.py index 5595e93f..53aad5ce 100644 --- a/api/app/services/api_key_service.py +++ b/api/app/services/api_key_service.py @@ -388,7 +388,7 @@ class RateLimiterService: if not qps_ok: # 判断是套餐限额触发还是 api_key 自身限额触发 if tenant_limit and effective_limit == tenant_limit and api_key.rate_limit > tenant_limit: - error_msg = "Tenant QPS limit exceeded" + error_msg = "Tenant limit exceeded" else: error_msg = "QPS limit exceeded" return False, error_msg, {