mirror of https://github.com/langgenius/dify.git
Merge branch 'feat/add-preinstall-improve' into deploy/dev
This commit is contained in:
commit
6087a80455
|
|
@ -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 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(
|
||||
plugin_ids: list[str],
|
||||
) -> Sequence[MarketplacePluginDeclaration]:
|
||||
|
|
|
|||
|
|
@ -1297,8 +1297,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 = []
|
||||
|
|
@ -1308,14 +1308,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