mirror of https://github.com/langgenius/dify.git
add uninstalled recommend tools detail (#27537)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
7dc7c8af98
commit
82890fe38e
|
|
@ -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]:
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue