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.

add uninstalled recommend tools detail (#27537)

Jyong82890fe38e65
diff --git a/api/core/helper/marketplace.py b/api/core/helper/marketplace.py
index bddb864a95e..b2286d39ed3 100644
--- a/api/core/helper/marketplace.py
+++ b/api/core/helper/marketplace.py
@@ -29,6 +29,18 @@ def batch_fetch_plugin_manifests(plugin_ids: list[str]) -> Sequence[MarketplaceP
return [MarketplacePluginDeclaration.model_validate(plugin) for plugin in response.json()["data"]["plugins"]]
+def batch_fetch_plugin_by_ids(plugin_ids: list[str]) -> list[dict]:
+ if not plugin_ids:
+ return []
+
+ url = str(marketplace_api_url / "api/v1/plugins/batch")
+ response = httpx.post(url, json={"plugin_ids": plugin_ids}, headers={"X-Dify-Version": dify_config.project.version})
+ response.raise_for_status()
+
+ data = response.json()
+ return data.get("data", {}).get("plugins", [])
+
+
def batch_fetch_plugin_manifests_ignore_deserialization_error(
plugin_ids: list[str],
) -> Sequence[MarketplacePluginDeclaration]:
diff --git a/api/services/rag_pipeline/rag_pipeline.py b/api/services/rag_pipeline/rag_pipeline.py
index 50dec458a93..fed7a25e21a 100644
--- a/api/services/rag_pipeline/rag_pipeline.py
+++ b/api/services/rag_pipeline/rag_pipeline.py
@@ -1265,8 +1265,8 @@ class RagPipelineService:
)
providers_map = {provider.plugin_id: provider.to_dict() for provider in providers}
- plugin_manifests = marketplace.batch_fetch_plugin_manifests(plugin_ids)
- plugin_manifests_map = {manifest.plugin_id: manifest for manifest in plugin_manifests}
+ plugin_manifests = marketplace.batch_fetch_plugin_by_ids(plugin_ids)
+ plugin_manifests_map = {manifest["plugin_id"]: manifest for manifest in plugin_manifests}
installed_plugin_list = []
uninstalled_plugin_list = []
@@ -1276,14 +1276,7 @@ class RagPipelineService:
else:
plugin_manifest = plugin_manifests_map.get(plugin_id)
if plugin_manifest:
- uninstalled_plugin_list.append(
- {
- "plugin_id": plugin_id,
- "name": plugin_manifest.name,
- "icon": plugin_manifest.icon,
- "plugin_unique_identifier": plugin_manifest.latest_package_identifier,
- }
- )
+ uninstalled_plugin_list.append(plugin_manifest)
# Build recommended plugins list
return {