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.

fix(api): hide agent apps from installed apps (#37570)

zyssyz123758bea1a91b9
diff --git a/api/controllers/console/explore/installed_app.py b/api/controllers/console/explore/installed_app.py
index 14837897502..c1fa1378ffa 100644
--- a/api/controllers/console/explore/installed_app.py
+++ b/api/controllers/console/explore/installed_app.py
@@ -73,9 +73,12 @@ def _published_app_filter():
has_published_workflow = exists(select(Workflow.id).where(Workflow.id == App.workflow_id))
has_published_model_config = exists(select(AppModelConfig.id).where(AppModelConfig.id == App.app_model_config_id))
- return or_(
- and_(App.mode.in_(workflow_app_modes), App.workflow_id.isnot(None), has_published_workflow),
- and_(~App.mode.in_(workflow_app_modes), App.app_model_config_id.isnot(None), has_published_model_config),
+ return and_(
+ App.mode != AppMode.AGENT,
+ or_(
+ and_(App.mode.in_(workflow_app_modes), App.workflow_id.isnot(None), has_published_workflow),
+ and_(~App.mode.in_(workflow_app_modes), App.app_model_config_id.isnot(None), has_published_model_config),
+ ),
)
diff --git a/api/tests/unit_tests/controllers/console/explore/test_installed_app.py b/api/tests/unit_tests/controllers/console/explore/test_installed_app.py
index be6275b5cb8..be85082ecd0 100644
--- a/api/tests/unit_tests/controllers/console/explore/test_installed_app.py
+++ b/api/tests/unit_tests/controllers/console/explore/test_installed_app.py
@@ -64,6 +64,7 @@ class TestInstalledAppsListApi:
assert "app_model_configs" in compiled_filter
assert "workflow_id" in compiled_filter
assert "app_model_config_id" in compiled_filter
+ assert "apps.mode != 'agent'" in compiled_filter
def test_get_installed_apps(
self, app: Flask, current_user: MagicMock, tenant_id: str, installed_app: MagicMock