1111from tqdm import tqdm
1212import shutil
1313import threading
14+ import storage_db
1415
1516if sys .platform == "win32" :
1617 storage_folder = os .path .join (os .getenv ('APPDATA' ),"DeepMake" )
@@ -78,8 +79,9 @@ class Plugin():
7879 Generic plugin class
7980 """
8081
81- def __init__ (self , arguments = {}):
82- self .plugin_name = "default"
82+ def __init__ (self , arguments = {}, plugin_name = "default" ):
83+ self .plugin_name = plugin_name
84+ self .db = storage_db .storage_db ()
8385 if arguments == {}:
8486 self .plugin = {}
8587 self .config = {}
@@ -88,7 +90,9 @@ def __init__(self, arguments={}):
8890 self .plugin = arguments .plugin
8991 self .config = arguments .config
9092 self .endpoints = arguments .endpoints
91-
93+ config = self .db .retrieve_data (f"plugin_config.{ self .plugin_name } " )
94+ if config :
95+ self .config = config
9296
9397 # Create a plugin-specific storage path
9498 self .plugin_storage_path = os .path .join (storage_folder , self .plugin_name )
@@ -103,10 +107,9 @@ def get_config(self):
103107
104108 def set_config (self , update : dict ):
105109 self .config .update (update ) # TODO: Validate config dict are all valid keys
106- if "model_name" in update or "scheduler" in update or "loras" in update or "inverters" in update :
110+ self .db .store_data (f"plugin_config.{ self .plugin_name } " , self .config )
111+ if "model_name" in update :
107112 self .set_model ()
108- # if response["status"] == "Failed":
109- # return response
110113 return self .config
111114
112115 def progress_callback (self , progress , stage ):
0 commit comments