fix: bugfixes
This commit is contained in:
@@ -300,7 +300,7 @@ class Command:
|
||||
"plugin": "插件安装、卸载和重载"
|
||||
}
|
||||
|
||||
def help_messager(self, commands: dict, platform: str):
|
||||
def help_messager(self, commands: dict, platform: str, cached_plugins: dict = None):
|
||||
try:
|
||||
resp = requests.get("https://soulter.top/channelbot/notice.json").text
|
||||
notice = json.loads(resp)["notice"]
|
||||
@@ -311,10 +311,11 @@ class Command:
|
||||
for key, value in commands.items():
|
||||
msg += key + ": " + value + "\n"
|
||||
# plugins
|
||||
plugin_list_info = "\n".join([f"{k}: \n名称: {v['info']['name']}\n简介: {v['info']['desc']}\n" for k, v in cached_plugins.items()])
|
||||
if plugin_list_info.strip() != "":
|
||||
msg += "\n【插件列表】\n"
|
||||
msg += plugin_list_info
|
||||
if cached_plugins != None:
|
||||
plugin_list_info = "\n".join([f"{k}: \n名称: {v['info']['name']}\n简介: {v['info']['desc']}\n" for k, v in cached_plugins.items()])
|
||||
if plugin_list_info.strip() != "":
|
||||
msg += "\n【插件列表】\n"
|
||||
msg += plugin_list_info
|
||||
msg += notice
|
||||
|
||||
if platform == gu.PLATFORM_GOCQ:
|
||||
|
||||
@@ -36,7 +36,7 @@ class CommandOpenAIOfficial(Command):
|
||||
elif self.command_start_with(message, "count"):
|
||||
return True, self.count()
|
||||
elif self.command_start_with(message, "help", "帮助"):
|
||||
return True, self.help()
|
||||
return True, self.help(cached_plugins)
|
||||
elif self.command_start_with(message, "unset"):
|
||||
return True, self.unset(session_id)
|
||||
elif self.command_start_with(message, "set"):
|
||||
@@ -55,7 +55,7 @@ class CommandOpenAIOfficial(Command):
|
||||
|
||||
return False, None
|
||||
|
||||
def help(self):
|
||||
def help(self, cached_plugins):
|
||||
commands = super().general_commands()
|
||||
commands['画'] = '画画'
|
||||
commands['key'] = '添加OpenAI key'
|
||||
@@ -63,9 +63,9 @@ class CommandOpenAIOfficial(Command):
|
||||
commands['gpt'] = '查看gpt配置信息'
|
||||
commands['status'] = '查看key使用状态'
|
||||
commands['token'] = '查看本轮会话token'
|
||||
return True, super().help_messager(commands, self.platform), "help"
|
||||
return True, super().help_messager(commands, self.platform, cached_plugins), "help"
|
||||
|
||||
|
||||
|
||||
def reset(self, session_id: str):
|
||||
if self.provider is None:
|
||||
return False, "未启动OpenAI ChatGPT语言模型.", "reset"
|
||||
|
||||
@@ -19,7 +19,7 @@ class CommandRevChatGPT(Command):
|
||||
if hit:
|
||||
return True, res
|
||||
if self.command_start_with(message, "help", "帮助"):
|
||||
return True, self.help()
|
||||
return True, self.help(cached_plugins)
|
||||
elif self.command_start_with(message, "reset"):
|
||||
return True, self.reset()
|
||||
elif self.command_start_with(message, "update"):
|
||||
@@ -34,5 +34,6 @@ class CommandRevChatGPT(Command):
|
||||
def reset(self):
|
||||
return False, "此功能暂未开放", "reset"
|
||||
|
||||
def help(self):
|
||||
return True, super().help_messager(super().general_commands(), self.platform), "help"
|
||||
|
||||
def help(self, cached_plugins: dict):
|
||||
return True, super().help_messager(super().general_commands(), self.platform, cached_plugins), "help"
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandRevEdgeGPT(Command):
|
||||
if self.command_start_with(message, "reset"):
|
||||
return True, self.reset(loop)
|
||||
elif self.command_start_with(message, "help"):
|
||||
return True, self.help()
|
||||
return True, self.help(cached_plugins)
|
||||
elif self.command_start_with(message, "update"):
|
||||
return True, self.update(message, role)
|
||||
elif self.command_start_with(message, "keyword"):
|
||||
@@ -44,6 +44,6 @@ class CommandRevEdgeGPT(Command):
|
||||
else:
|
||||
return res, "重置失败", "reset"
|
||||
|
||||
def help(self):
|
||||
return True, super().help_messager(super().general_commands(), self.platform), "help"
|
||||
def help(self, cached_plugins: dict):
|
||||
return True, super().help_messager(super().general_commands(), self.platform, cached_plugins), "help"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user