fix(quota_manager): retrieve workspace_id from api_key_auth context

- Add logic to resolve the workspace ID derived from the API key authentication context.
This commit is contained in:
wwq
2026-04-23 00:14:29 +08:00
parent b9cfc47e1e
commit eaa66ba71a

View File

@@ -37,6 +37,11 @@ def _get_workspace_id_from_kwargs(kwargs: dict):
if workspace_id:
return workspace_id
# 从 api_key_auth.workspace_id 获取API Key 认证场景)
api_key_auth = kwargs.get("api_key_auth")
if api_key_auth and hasattr(api_key_auth, 'workspace_id'):
return api_key_auth.workspace_id
# 从 user.current_workspace_id 获取
user = _get_user_from_kwargs(kwargs)
if user: