diff --git a/plugins/godcmd/godcmd.py b/plugins/godcmd/godcmd.py index e6c971b..296b9a9 100644 --- a/plugins/godcmd/godcmd.py +++ b/plugins/godcmd/godcmd.py @@ -63,6 +63,11 @@ ADMIN_COMMANDS = { "args": ["插件名", "优先级"], "desc": "设置指定插件的优先级,越大越优先", }, + "reloadp": { + "alias": ["reloadp", "重载插件"], + "args": ["插件名"], + "desc": "重载指定插件配置", + }, "enablep": { "alias": ["enablep", "启用插件"], "args": ["插件名"], @@ -216,6 +221,15 @@ class Godcmd(Plugin): result = "插件" + args[0] + "优先级已设置为" + args[1] else: result = "插件不存在" + elif cmd == "reloadp": + if len(args) != 1: + ok, result = False, "请提供插件名" + else: + ok = PluginManager().reload_plugin(args[0]) + if ok: + result = "插件配置已重载" + else: + result = "插件不存在" elif cmd == "enablep": if len(args) != 1: ok, result = False, "请提供插件名" diff --git a/plugins/plugin_manager.py b/plugins/plugin_manager.py index 107c63b..9fada89 100644 --- a/plugins/plugin_manager.py +++ b/plugins/plugin_manager.py @@ -96,6 +96,16 @@ class PluginManager: self.listening_plugins[event].append(name) self.refresh_order() + def reload_plugin(self, name): + if name in self.instances: + for event in self.listening_plugins: + if name in self.listening_plugins[event]: + self.listening_plugins[event].remove(name) + del self.instances[name] + self.activate_plugins() + return True + return False + def load_plugins(self): self.load_config() self.scan_plugins() diff --git a/plugins/sdwebui/sdwebui.py b/plugins/sdwebui/sdwebui.py index cc07c7a..56842e8 100644 --- a/plugins/sdwebui/sdwebui.py +++ b/plugins/sdwebui/sdwebui.py @@ -78,7 +78,7 @@ class SDWebUI(Plugin): options = {**self.default_options, **rule_options} params["prompt"] = params.get("prompt", "")+f", {prompt}" if len(options) > 0: - logger.info("[SD] cover rule_options={}".format(rule_options)) + logger.info("[SD] cover options={}".format(options)) self.api.set_options(options) logger.info("[SD] params={}".format(params)) result = self.api.txt2img(