perf: 升级插件协议簇

This commit is contained in:
Soulter
2023-05-15 20:03:17 +08:00
parent 9f36e5ae05
commit 9c284b84b1
6 changed files with 60 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ import util.plugin_util as putil
import shutil
import importlib
from util import general_utils as gu
from model.platform.qq import QQ
PLATFORM_QQCHAN = 'qqchan'
PLATFORM_GOCQ = 'gocq'
@@ -34,12 +34,12 @@ class Command:
except BaseException as e:
raise e
def check_command(self, message, role, platform, message_obj, cached_plugins: dict):
def check_command(self, message, role, platform, message_obj, cached_plugins: dict, qq_platform: QQ):
# 插件
for k, v in cached_plugins.items():
try:
hit, res = v["clsobj"].run(message, role, platform, message_obj)
hit, res = v["clsobj"].run(message, role, platform, message_obj, qq_platform)
if hit:
return True, res
except BaseException as e:

View File

@@ -1,6 +1,7 @@
from model.command.command import Command
from model.provider.provider_openai_official import ProviderOpenAIOfficial
from cores.qqbot.personality import personalities
from model.platform.qq import QQ
class CommandOpenAIOfficial(Command):
def __init__(self, provider: ProviderOpenAIOfficial):
@@ -14,8 +15,9 @@ class CommandOpenAIOfficial(Command):
role: str,
platform: str,
message_obj,
cached_plugins: dict):
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins)
cached_plugins: dict,
qq_platform: QQ):
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins, qq_platform=qq_platform)
if hit:
return True, res
if self.command_start_with(message, "reset", "重置"):

View File

@@ -1,5 +1,6 @@
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):
@@ -11,8 +12,9 @@ class CommandRevChatGPT(Command):
role: str,
platform: str,
message_obj,
cached_plugins: dict):
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins)
cached_plugins: dict,
qq_platform: QQ):
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins, qq_platform=qq_platform)
if hit:
return True, res
if self.command_start_with(message, "help", "帮助"):

View File

@@ -1,6 +1,8 @@
from model.command.command import Command
from model.provider.provider_rev_edgegpt import ProviderRevEdgeGPT
import asyncio
from model.platform.qq import QQ
class CommandRevEdgeGPT(Command):
def __init__(self, provider: ProviderRevEdgeGPT):
self.provider = provider
@@ -13,8 +15,9 @@ class CommandRevEdgeGPT(Command):
role: str,
platform: str,
message_obj,
cached_plugins: dict):
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins)
cached_plugins: dict,
qq_platform: QQ):
hit, res = super().check_command(message, role, platform, message_obj=message_obj, cached_plugins=cached_plugins, qq_platform=qq_platform)
if hit:
return True, res
if self.command_start_with(message, "reset"):