Files
AstrBot/model/command/command_rev_chatgpt.py
Soulter 81e8997852 feat: 1. 支持llm网页搜索,实时消息。
2. 加入频道兼容层;支持频道发图
perf: 1. 稳定性优化
2. 精简部分代码结构
2023-08-31 18:34:20 +08:00

44 lines
1.8 KiB
Python

from model.command.command import Command
from model.provider.provider_rev_chatgpt import ProviderRevChatGPT
from model.platform.qq import QQ
class CommandRevChatGPT(Command):
def __init__(self, provider: ProviderRevChatGPT, global_object: dict):
self.provider = provider
self.cached_plugins = {}
self.global_object = global_object
def check_command(self,
message: str,
role: str,
platform: str,
message_obj,
cached_plugins: dict,
qq_platform: QQ):
self.platform = platform
hit, res = super().check_command(message, role, platform, message_obj=message_obj,
cached_plugins=cached_plugins,
qq_platform=qq_platform,
global_object=self.global_object)
if hit:
return True, res
if self.command_start_with(message, "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"):
return True, self.update(message, role)
elif self.command_start_with(message, "keyword"):
return True, self.keyword(message, role)
if self.command_start_with(message, "/"):
return True, (False, "未知指令", "unknown_command")
return False, None
def reset(self):
return False, "此功能暂未开放", "reset"
def help(self, cached_plugins: dict):
return True, super().help_messager(super().general_commands(), self.platform, cached_plugins), "help"