fix:Fixed the problem of plugin installation failure caused by inconsistent plugin IDs, such as LM Studio

pull/22156/head
Garden12138 11 months ago
parent 809a0ab6bf
commit 3c4d57bb9d

@ -353,26 +353,30 @@ class PluginService:
manager = PluginInstaller()
# collect actual plugin_unique_identifiers
actual_plugin_unique_identifiers = []
metas = []
# check if already downloaded
for plugin_unique_identifier in plugin_unique_identifiers:
try:
manager.fetch_plugin_manifest(tenant_id, plugin_unique_identifier)
# already downloaded, skip
actual_plugin_unique_identifiers.append(plugin_unique_identifier)
metas.append({"plugin_unique_identifier": plugin_unique_identifier})
except Exception:
# plugin not installed, download and upload pkg
pkg = download_plugin_pkg(plugin_unique_identifier)
manager.upload_pkg(tenant_id, pkg, verify_signature)
upload_result = manager.upload_pkg(tenant_id, pkg, verify_signature)
# use upload_result plugin_unique_identifier
actual_plugin_unique_identifiers.append(upload_result.unique_identifier)
metas.append({"plugin_unique_identifier": upload_result.unique_identifier})
return manager.install_from_identifiers(
tenant_id,
plugin_unique_identifiers,
actual_plugin_unique_identifiers,
PluginInstallationSource.Marketplace,
[
{
"plugin_unique_identifier": plugin_unique_identifier,
}
for plugin_unique_identifier in plugin_unique_identifiers
],
metas,
)
@staticmethod

Loading…
Cancel
Save