mirror of
https://github.com/langgenius/dify.git
synced 2026-01-03 21:17:09 +00:00
Merge branch 'fix/chore-fix' into dev/plugin-deploy
This commit is contained in:
@@ -661,12 +661,13 @@ def migrate_data_for_plugin():
|
||||
|
||||
|
||||
@click.command("extract-plugins", help="Extract plugins.")
|
||||
def extract_plugins():
|
||||
@click.option("--output_file", prompt=True, help="The file to store the extracted plugins.")
|
||||
def extract_plugins(output_file: str):
|
||||
"""
|
||||
Extract plugins.
|
||||
"""
|
||||
click.echo(click.style("Starting extract plugins.", fg="white"))
|
||||
|
||||
PluginMigration.extract_plugins()
|
||||
PluginMigration.extract_plugins(output_file)
|
||||
|
||||
click.echo(click.style("Extract plugins completed.", fg="green"))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Sequence
|
||||
|
||||
@@ -21,7 +22,7 @@ excluded_providers = ["time", "audio", "code", "webscraper"]
|
||||
|
||||
class PluginMigration:
|
||||
@classmethod
|
||||
def extract_plugins(cls) -> None:
|
||||
def extract_plugins(cls, filepath: str) -> None:
|
||||
"""
|
||||
Migrate plugin.
|
||||
"""
|
||||
@@ -94,7 +95,9 @@ class PluginMigration:
|
||||
|
||||
for tenant_id in tenants:
|
||||
plugins = cls.extract_installed_plugin_ids(tenant_id)
|
||||
print(plugins)
|
||||
# append to file, it's a jsonl file
|
||||
with open(filepath, "a") as f:
|
||||
f.write(json.dumps({"tenant_id": tenant_id, "plugins": plugins}) + "\n")
|
||||
|
||||
handled_tenant_count += len(tenants)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user