@@ -9,6 +9,5 @@ | |||||
"conversation_max_tokens": 1000, | "conversation_max_tokens": 1000, | ||||
"speech_recognition": false, | "speech_recognition": false, | ||||
"character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。", | "character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。", | ||||
"expires_in_seconds": 3600, | |||||
"plugins": ["role", "hello", "sdwebui", "godcmd", "dungeon", "banwords"] | |||||
"expires_in_seconds": 3600 | |||||
} | } |
@@ -38,7 +38,7 @@ class Banwords(Plugin): | |||||
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context | self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context | ||||
logger.info("[Banwords] inited") | logger.info("[Banwords] inited") | ||||
except Exception as e: | except Exception as e: | ||||
logger.error("Banwords init failed: %s" % e) | |||||
logger.warn("Banwords init failed: %s" % e) | |||||
@@ -59,10 +59,14 @@ class PluginManager: | |||||
if os.path.isdir(plugin_path): | if os.path.isdir(plugin_path): | ||||
# 判断插件是否包含同名.py文件 | # 判断插件是否包含同名.py文件 | ||||
main_module_path = os.path.join(plugin_path, plugin_name+".py") | main_module_path = os.path.join(plugin_path, plugin_name+".py") | ||||
if os.path.isfile(main_module_path) and conf().get("plugins") and plugin_name in conf().get("plugins"): | |||||
if os.path.isfile(main_module_path): | |||||
# 导入插件 | # 导入插件 | ||||
import_path = "{}.{}.{}".format(plugins_dir, plugin_name, plugin_name) | import_path = "{}.{}.{}".format(plugins_dir, plugin_name, plugin_name) | ||||
main_module = importlib.import_module(import_path) | |||||
try: | |||||
main_module = importlib.import_module(import_path) | |||||
except Exception as e: | |||||
logger.warn("Failed to import plugin %s: %s" % (plugin_name, e)) | |||||
continue | |||||
pconf = self.pconf | pconf = self.pconf | ||||
new_plugins = [] | new_plugins = [] | ||||
modified = False | modified = False | ||||
@@ -116,7 +116,7 @@ class Role(Plugin): | |||||
e_context.action = EventAction.CONTINUE | e_context.action = EventAction.CONTINUE | ||||
def get_help_text(self): | def get_help_text(self): | ||||
help_text = "输入\"$角色 (角色名)\"或\"$role (角色名)\"为我设定角色吧,#reset 可以清除设定的角色。\n目前可用角色列表:\n" | |||||
help_text = "输入\"$角色 (角色名)\"或\"$role (角色名)\"为我设定角色吧,#reset 可以清除设定的角色。\n\n目前可用角色列表:\n" | |||||
for role in self.roles: | for role in self.roles: | ||||
help_text += f"[{role}]: {self.roles[role]['remark']}\n" | help_text += f"[{role}]: {self.roles[role]['remark']}\n" | ||||
return help_text | return help_text |