mirror of
https://github.com/langgenius/dify.git
synced 2026-06-18 07:41:09 +08:00
fix(api): hide agent apps from installed apps (#37570)
This commit is contained in:
parent
3b0f6aef8e
commit
758bea1a91
@ -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),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user