diff --git a/api/configs/feature/__init__.py b/api/configs/feature/__init__.py index 0c8b7f3b491..e03f627d2bb 100644 --- a/api/configs/feature/__init__.py +++ b/api/configs/feature/__init__.py @@ -937,6 +937,11 @@ class WorkflowConfig(BaseSettings): default=600, ) + WORKFLOW_COPILOT_ENABLED: bool = Field( + description="Expose the workflow copilot feature (console routes + UI flag).", + default=False, + ) + class WorkflowNodeExecutionConfig(BaseSettings): """ diff --git a/api/services/entities/feature_entities.py b/api/services/entities/feature_entities.py index 666943a5276..4ae89de64df 100644 --- a/api/services/entities/feature_entities.py +++ b/api/services/entities/feature_entities.py @@ -162,6 +162,7 @@ class FeatureModel(FeatureResponseModel): model_load_balancing_enabled: bool = False dataset_operator_enabled: bool = False webapp_copyright_enabled: bool = False + workflow_copilot_enabled: bool = False workspace_members: LicenseLimitationModel = LicenseLimitationModel(enabled=False, size=0, limit=0) is_allow_transfer_workspace: bool = True trigger_event: Quota = Quota(usage=0, limit=3000, reset_date=0) diff --git a/api/services/feature_service.py b/api/services/feature_service.py index b32387ffea0..f2599b80f55 100644 --- a/api/services/feature_service.py +++ b/api/services/feature_service.py @@ -196,6 +196,7 @@ class FeatureService: features.model_load_balancing_enabled = dify_config.MODEL_LB_ENABLED features.dataset_operator_enabled = dify_config.DATASET_OPERATOR_ENABLED features.education.enabled = dify_config.EDUCATION_ENABLED + features.workflow_copilot_enabled = dify_config.WORKFLOW_COPILOT_ENABLED @classmethod def _fulfill_params_from_workspace_info(cls, features: feature_entities.FeatureModel, tenant_id: str): diff --git a/api/tests/unit_tests/services/test_feature_service_workflow_copilot.py b/api/tests/unit_tests/services/test_feature_service_workflow_copilot.py new file mode 100644 index 00000000000..c6243829a58 --- /dev/null +++ b/api/tests/unit_tests/services/test_feature_service_workflow_copilot.py @@ -0,0 +1,20 @@ +import pytest + +from services import feature_service as feature_service_module +from services.feature_service import FeatureService + + +def test_workflow_copilot_flag_follows_config_true(monkeypatch: pytest.MonkeyPatch): + monkeypatch.setattr(feature_service_module.dify_config, "WORKFLOW_COPILOT_ENABLED", True) + + features = FeatureService.get_features("tenant-1") + + assert features.workflow_copilot_enabled is True + + +def test_workflow_copilot_flag_defaults_false(monkeypatch: pytest.MonkeyPatch): + monkeypatch.setattr(feature_service_module.dify_config, "WORKFLOW_COPILOT_ENABLED", False) + + features = FeatureService.get_features("tenant-1") + + assert features.workflow_copilot_enabled is False