From 1673de73ba16d899a3d6c7df3cc5cc6c5e6b3813 Mon Sep 17 00:00:00 2001 From: 6vision Date: Thu, 25 Jul 2024 22:58:57 +0800 Subject: [PATCH 1/2] Role plugin supports more bots. --- plugins/role/role.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/role/role.py b/plugins/role/role.py index c75aa90..0f514d7 100644 --- a/plugins/role/role.py +++ b/plugins/role/role.py @@ -99,7 +99,8 @@ class Role(Plugin): if e_context["context"].type != ContextType.TEXT: return btype = Bridge().get_bot_type("chat") - if btype not in [const.OPEN_AI, const.CHATGPT, const.CHATGPTONAZURE, const.LINKAI]: + if btype not in [const.OPEN_AI, const.CHATGPT, const.CHATGPTONAZURE, const.QWEN_DASHSCOPE, const.XUNFEI, const.BAIDU, const.ZHIPU_AI, const.MOONSHOT, const.MiniMax]: + logger.warn(f'不支持的bot: {btype}') return bot = Bridge().get_bot("chat") content = e_context["context"].content[:] From b544a4c95411d31c62a2bdcd6679969bb201a8ec Mon Sep 17 00:00:00 2001 From: 6vision Date: Mon, 29 Jul 2024 20:14:41 +0800 Subject: [PATCH 2/2] fix: Use default expiration time for ExpiredDict if not set in config --- channel/dingtalk/dingtalk_channel.py | 2 +- channel/wechat/wechat_channel.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/channel/dingtalk/dingtalk_channel.py b/channel/dingtalk/dingtalk_channel.py index 9128d95..6c99e5f 100644 --- a/channel/dingtalk/dingtalk_channel.py +++ b/channel/dingtalk/dingtalk_channel.py @@ -100,7 +100,7 @@ class DingTalkChanel(ChatChannel, dingtalk_stream.ChatbotHandler): super(dingtalk_stream.ChatbotHandler, self).__init__() self.logger = self.setup_logger() # 历史消息id暂存,用于幂等控制 - self.receivedMsgs = ExpiredDict(conf().get("expires_in_seconds")) + self.receivedMsgs = ExpiredDict(conf().get("expires_in_seconds", 3600)) logger.info("[DingTalk] client_id={}, client_secret={} ".format( self.dingtalk_client_id, self.dingtalk_client_secret)) # 无需群校验和前缀 diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index 870b487..414f9bb 100644 --- a/channel/wechat/wechat_channel.py +++ b/channel/wechat/wechat_channel.py @@ -109,7 +109,7 @@ class WechatChannel(ChatChannel): def __init__(self): super().__init__() - self.receivedMsgs = ExpiredDict(conf().get("expires_in_seconds")) + self.receivedMsgs = ExpiredDict(conf().get("expires_in_seconds", 3600)) self.auto_login_times = 0 def startup(self):