feat: support plugin max package size

This commit is contained in:
Yeuoly
2024-10-17 18:44:16 +08:00
parent fa7215cfea
commit 7754431a34
7 changed files with 186 additions and 6 deletions

View File

@ -5,12 +5,11 @@ from core.helper.download import download_with_size_limit
def get_plugin_pkg_url(plugin_unique_identifier: str):
return (
URL(str(dify_config.MARKETPLACE_API_URL))
/ "api/v1/plugins/download"
).with_query(unique_identifier=plugin_unique_identifier)
return (URL(str(dify_config.MARKETPLACE_API_URL)) / "api/v1/plugins/download").with_query(
unique_identifier=plugin_unique_identifier
)
def download_plugin_pkg(plugin_unique_identifier: str):
url = str(get_plugin_pkg_url(plugin_unique_identifier))
return download_with_size_limit(url, 15 * 1024 * 1024)
return download_with_size_limit(url, dify_config.PLUGIN_MAX_PACKAGE_SIZE)