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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: inject tenant id in feature handlers (#36654)
Tianlefd059720e576
diff --git a/api/controllers/console/feature.py b/api/controllers/console/feature.pyindex 654991900dd..86ef9619483 100644--- a/api/controllers/console/feature.py+++ b/api/controllers/console/feature.py@@ -2,11 +2,11 @@ from flask_restx import Resourcefrom werkzeug.exceptions import Unauthorizedfrom controllers.common.schema import register_response_schema_models-from libs.login import current_account_with_tenant, current_user, login_required+from libs.login import current_user, login_requiredfrom services.feature_service import FeatureModel, FeatureService, LimitationModel, SystemFeatureModelfrom . import console_ns-from .wraps import account_initialization_required, cloud_utm_record, setup_required+from .wraps import account_initialization_required, cloud_utm_record, setup_required, with_current_tenant_idregister_response_schema_models(console_ns, FeatureModel, LimitationModel, SystemFeatureModel)@@ -24,10 +24,9 @@ class FeatureApi(Resource):@login_required@account_initialization_required@cloud_utm_record- def get(self):+ @with_current_tenant_id+ def get(self, current_tenant_id: str):"""Get feature configuration for current tenant"""- _, current_tenant_id = current_account_with_tenant()-payload = FeatureService.get_features(current_tenant_id,exclude_vector_space=True,@@ -49,10 +48,9 @@ class FeatureVectorSpaceApi(Resource):@login_required@account_initialization_required@cloud_utm_record- def get(self):+ @with_current_tenant_id+ def get(self, current_tenant_id: str):"""Get vector-space usage and limit for current tenant"""- _, current_tenant_id = current_account_with_tenant()-return FeatureService.get_vector_space(current_tenant_id).model_dump()diff --git a/api/tests/unit_tests/controllers/console/test_feature.py b/api/tests/unit_tests/controllers/console/test_feature.pyindex 0339c507776..58ba3f08cb2 100644--- a/api/tests/unit_tests/controllers/console/test_feature.py+++ b/api/tests/unit_tests/controllers/console/test_feature.py@@ -15,11 +15,6 @@ class TestFeatureApi:def test_get_tenant_features_success(self, mocker: MockerFixture):from controllers.console.feature import FeatureApi- mocker.patch(- "controllers.console.feature.current_account_with_tenant",- return_value=("account_id", "tenant_123"),- )-get_features = mocker.patch("controllers.console.feature.FeatureService.get_features")get_features.return_value.model_dump.return_value = {"features": {"feature_a": True},@@ -29,7 +24,7 @@ class TestFeatureApi:api = FeatureApi()raw_get = unwrap(FeatureApi.get)- result = raw_get(api)+ result = raw_get(api, "tenant_123")assert result == {"features": {"feature_a": True}}get_features.assert_called_once_with("tenant_123", exclude_vector_space=True)@@ -39,18 +34,13 @@ class TestFeatureVectorSpaceApi:def test_get_vector_space_success(self, mocker: MockerFixture):from controllers.console.feature import FeatureVectorSpaceApi- mocker.patch(- "controllers.console.feature.current_account_with_tenant",- return_value=("account_id", "tenant_123"),- )-get_vector_space = mocker.patch("controllers.console.feature.FeatureService.get_vector_space")get_vector_space.return_value.model_dump.return_value = {"size": 5120, "limit": 20480}api = FeatureVectorSpaceApi()raw_get = unwrap(FeatureVectorSpaceApi.get)- result = raw_get(api)+ result = raw_get(api, "tenant_123")assert result == {"size": 5120, "limit": 20480}get_vector_space.assert_called_once_with("tenant_123")