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

This commit is contained in:
zyssyz123 2026-06-17 14:47:39 +08:00 committed by GitHub
parent 3b0f6aef8e
commit 758bea1a91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -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),
),
)

View File

@ -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