mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
add uninstalled recommend tools detail
This commit is contained in:
parent
dc1a380888
commit
21f7ccf67d
@ -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"]]
|
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 len(plugin_ids) == 0:
|
||||||
|
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()
|
||||||
|
|
||||||
|
return response.json()["data"]["plugins"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def batch_fetch_plugin_manifests_ignore_deserialization_error(
|
def batch_fetch_plugin_manifests_ignore_deserialization_error(
|
||||||
plugin_ids: list[str],
|
plugin_ids: list[str],
|
||||||
) -> Sequence[MarketplacePluginDeclaration]:
|
) -> Sequence[MarketplacePluginDeclaration]:
|
||||||
|
|||||||
@ -1297,8 +1297,8 @@ class RagPipelineService:
|
|||||||
)
|
)
|
||||||
providers_map = {provider.plugin_id: provider.to_dict() for provider in providers}
|
providers_map = {provider.plugin_id: provider.to_dict() for provider in providers}
|
||||||
|
|
||||||
plugin_manifests = marketplace.batch_fetch_plugin_manifests(plugin_ids)
|
plugin_manifests = marketplace.batch_fetch_plugin_by_ids(plugin_ids)
|
||||||
plugin_manifests_map = {manifest.plugin_id: manifest for manifest in plugin_manifests}
|
plugin_manifests_map = {manifest["plugin_id"]: manifest for manifest in plugin_manifests}
|
||||||
|
|
||||||
installed_plugin_list = []
|
installed_plugin_list = []
|
||||||
uninstalled_plugin_list = []
|
uninstalled_plugin_list = []
|
||||||
@ -1308,14 +1308,7 @@ class RagPipelineService:
|
|||||||
else:
|
else:
|
||||||
plugin_manifest = plugin_manifests_map.get(plugin_id)
|
plugin_manifest = plugin_manifests_map.get(plugin_id)
|
||||||
if plugin_manifest:
|
if plugin_manifest:
|
||||||
uninstalled_plugin_list.append(
|
uninstalled_plugin_list.append(plugin_manifest)
|
||||||
{
|
|
||||||
"plugin_id": plugin_id,
|
|
||||||
"name": plugin_manifest.name,
|
|
||||||
"icon": plugin_manifest.icon,
|
|
||||||
"plugin_unique_identifier": plugin_manifest.latest_package_identifier,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build recommended plugins list
|
# Build recommended plugins list
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user