mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 04:15:55 +08:00
fix: add install count
This commit is contained in:
parent
8cc4c109d0
commit
bf39e314d8
@ -27,3 +27,9 @@ def batch_fetch_plugin_manifests(plugin_ids: list[str]) -> Sequence[MarketplaceP
|
|||||||
response = requests.post(url, json={"plugin_ids": plugin_ids})
|
response = requests.post(url, json={"plugin_ids": plugin_ids})
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return [MarketplacePluginDeclaration(**plugin) for plugin in response.json()["data"]["plugins"]]
|
return [MarketplacePluginDeclaration(**plugin) for plugin in response.json()["data"]["plugins"]]
|
||||||
|
|
||||||
|
|
||||||
|
def record_install_plugin_event(plugin_unique_identifier: str):
|
||||||
|
url = str(URL(str(dify_config.MARKETPLACE_API_URL)) / "api/v1/stats/plugins/install_count")
|
||||||
|
response = requests.post(url, json={"unique_identifier": plugin_unique_identifier})
|
||||||
|
response.raise_for_status()
|
||||||
|
@ -144,7 +144,8 @@ class PluginService:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
manager.fetch_plugin_manifest(tenant_id, new_plugin_unique_identifier)
|
manager.fetch_plugin_manifest(tenant_id, new_plugin_unique_identifier)
|
||||||
# already downloaded, skip
|
# already downloaded, skip, and record install event
|
||||||
|
marketplace.record_install_plugin_event(new_plugin_unique_identifier)
|
||||||
except Exception:
|
except Exception:
|
||||||
# plugin not installed, download and upload pkg
|
# plugin not installed, download and upload pkg
|
||||||
pkg = download_plugin_pkg(new_plugin_unique_identifier)
|
pkg = download_plugin_pkg(new_plugin_unique_identifier)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user