调试一下内容。
This commit is contained in:
@@ -62,7 +62,6 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
|||||||
# 加载配置
|
# 加载配置
|
||||||
config_path = os.path.join(os.path.dirname(__file__), "config.toml")
|
config_path = os.path.join(os.path.dirname(__file__), "config.toml")
|
||||||
self.enable = self._config.get("enable", True)
|
self.enable = self._config.get("enable", True)
|
||||||
self._commands = ["ai介入", "ai对话", "ai自动回复"]
|
|
||||||
|
|
||||||
# 从配置中获取DIFY API密钥
|
# 从配置中获取DIFY API密钥
|
||||||
self.dify_api_key = self._config.get("dify_api_key", "")
|
self.dify_api_key = self._config.get("dify_api_key", "")
|
||||||
@@ -71,7 +70,6 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
|||||||
# 初始化介入机器人
|
# 初始化介入机器人
|
||||||
self.intervention_bot = InterventionBot(config_path)
|
self.intervention_bot = InterventionBot(config_path)
|
||||||
|
|
||||||
self.LOG.info(f"[{self.name}] 插件初始化完成,指令:{self._commands}")
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def start(self) -> bool:
|
def start(self) -> bool:
|
||||||
@@ -98,6 +96,7 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
|||||||
return False
|
return False
|
||||||
# 如果是群消息,且该群启用了自动回复,则处理
|
# 如果是群消息,且该群启用了自动回复,则处理
|
||||||
if roomid:
|
if roomid:
|
||||||
|
self.LOG.debug(f"[{roomid}] 进入AI自动回复逻辑")
|
||||||
# 存储消息
|
# 存储消息
|
||||||
if roomid not in self.group_messages:
|
if roomid not in self.group_messages:
|
||||||
self.group_messages[roomid] = []
|
self.group_messages[roomid] = []
|
||||||
@@ -120,7 +119,7 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
|||||||
messages = [msg["message"] for msg in self.group_messages[roomid]]
|
messages = [msg["message"] for msg in self.group_messages[roomid]]
|
||||||
timestamp = message.get("timestamp", "")
|
timestamp = message.get("timestamp", "")
|
||||||
# 传递完整的聊天记录给should_intervene方法
|
# 传递完整的聊天记录给should_intervene方法
|
||||||
can = self.intervention_bot.should_intervene(timestamp, content, messages, self.group_messages[roomid])
|
can = self.intervention_bot.should_intervene(timestamp, content, messages, self.group_messages[roomid])
|
||||||
if can:
|
if can:
|
||||||
self.LOG.debug(f"[{roomid}] 触发自动回复规则,准备生成回复")
|
self.LOG.debug(f"[{roomid}] 触发自动回复规则,准备生成回复")
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user