From 2dd44ec69c80a95f87e3d45b1711e25fe3850805 Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 14:30:43 +0800 Subject: [PATCH 1/8] pr#588 --- src/plugins/chat/utils.py | 8 +++++-- .../reasoning_chat/reasoning_chat.py | 22 +++++++++++++++++-- .../think_flow_chat/think_flow_chat.py | 22 +++++++++++++++++-- src/plugins/config/config.py | 8 +++++++ template/bot_config_template.toml | 3 ++- 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/plugins/chat/utils.py b/src/plugins/chat/utils.py index 26bd3a171..7a155cce5 100644 --- a/src/plugins/chat/utils.py +++ b/src/plugins/chat/utils.py @@ -42,11 +42,15 @@ def is_mentioned_bot_in_message(message: MessageRecv) -> bool: """检查消息是否提到了机器人""" keywords = [global_config.BOT_NICKNAME] nicknames = global_config.BOT_ALIAS_NAMES + if f"回复{global_config.BOT_NICKNAME}({global_config.BOT_QQ})的消息,说: " in message.processed_plain_text: + return True + message_content = re.sub(r'\@[\s\S]*?\((\d+)\)','', message.processed_plain_text) + message_content = re.sub(r'回复[\s\S]*?\((\d+)\)的消息,说: ','', message_content) for keyword in keywords: - if keyword in message.processed_plain_text: + if keyword in message_content: return True for nickname in nicknames: - if nickname in message.processed_plain_text: + if nickname in message_content: return True return False diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index 13f055185..0f3d5de31 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -186,7 +186,23 @@ class ReasoningChat: logger.info("触发缓冲,已炸飞消息列") return - is_mentioned = is_mentioned_bot_in_message(message) + # 处理提及 + reply_probability = 0 + is_at = False + is_mentioned = False + if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: + is_at = True + is_mentioned = True + + if is_at and global_config.at_bot_inevitable_reply: + reply_probability = 1 + logger.info("被@,回复概率设置为100%") + else: + if not is_mentioned: + is_mentioned = is_mentioned_bot_in_message(message) + if is_mentioned and global_config.metioned_bot_inevitable_reply: + reply_probability = 1 + logger.info("被提及,回复概率设置为100%") # 计算回复意愿 current_willing = willing_manager.get_willing(chat_stream=chat) @@ -194,7 +210,7 @@ class ReasoningChat: # 意愿激活 timer1 = time.time() - reply_probability = await willing_manager.change_reply_willing_received( + real_reply_probability = await willing_manager.change_reply_willing_received( chat_stream=chat, is_mentioned_bot=is_mentioned, config=global_config, @@ -202,6 +218,8 @@ class ReasoningChat: interested_rate=interested_rate, sender_id=str(message.message_info.user_info.user_id), ) + if reply_probability != 1 or (groupinfo and (groupinfo.group_id not in global_config.talk_allowed_groups)): + reply_probability = real_reply_probability timer2 = time.time() timing_results["意愿激活"] = timer2 - timer1 diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index 9c2eebd94..652e03e30 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -211,7 +211,23 @@ class ThinkFlowChat: logger.info("触发缓冲,已炸飞消息列") return - is_mentioned = is_mentioned_bot_in_message(message) + # 处理提及 + reply_probability = 0 + is_at = False + is_mentioned = False + if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: + is_at = True + is_mentioned = True + + if is_at and global_config.at_bot_inevitable_reply: + reply_probability = 1 + logger.info("被@,回复概率设置为100%") + else: + if not is_mentioned: + is_mentioned = is_mentioned_bot_in_message(message) + if is_mentioned and global_config.metioned_bot_inevitable_reply: + reply_probability = 1 + logger.info("被提及,回复概率设置为100%") # 计算回复意愿 @@ -226,7 +242,7 @@ class ThinkFlowChat: # 意愿激活 timer1 = time.time() - reply_probability = await willing_manager.change_reply_willing_received( + real_reply_probability = await willing_manager.change_reply_willing_received( chat_stream=chat, is_mentioned_bot=is_mentioned, config=global_config, @@ -234,6 +250,8 @@ class ThinkFlowChat: interested_rate=interested_rate, sender_id=str(message.message_info.user_info.user_id), ) + if reply_probability != 1 or (groupinfo and (groupinfo.group_id not in global_config.talk_allowed_groups)): + reply_probability = real_reply_probability timer2 = time.time() timing_results["意愿激活"] = timer2 - timer1 logger.debug(f"意愿激活: {reply_probability}") diff --git a/src/plugins/config/config.py b/src/plugins/config/config.py index 125439374..151653de9 100644 --- a/src/plugins/config/config.py +++ b/src/plugins/config/config.py @@ -195,6 +195,8 @@ class BotConfig: response_interested_rate_amplifier: float = 1.0 # 回复兴趣度放大系数 down_frequency_rate: float = 3 # 降低回复频率的群组回复意愿降低系数 emoji_response_penalty: float = 0.0 # 表情包回复惩罚 + metioned_bot_inevitable_reply: bool = False # 提及 bot 必然回复 + at_bot_inevitable_reply: bool = False # @bot 必然回复 # response response_mode: str = "heart_flow" # 回复策略 @@ -439,6 +441,12 @@ class BotConfig: config.emoji_response_penalty = willing_config.get( "emoji_response_penalty", config.emoji_response_penalty ) + config.metioned_bot_inevitable_reply = willing_config.get( + "metioned_bot_inevitable_reply", config.metioned_bot_inevitable_reply + ) + config.at_bot_inevitable_reply = willing_config.get( + "at_bot_inevitable_reply", config.at_bot_inevitable_reply + ) def model(parent: dict): # 加载模型配置 diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 9e107a5cd..02adac139 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -105,7 +105,8 @@ response_willing_amplifier = 1 # 麦麦回复意愿放大系数,一般为1 response_interested_rate_amplifier = 1 # 麦麦回复兴趣度放大系数,听到记忆里的内容时放大系数 down_frequency_rate = 3 # 降低回复频率的群组回复意愿降低系数 除法 emoji_response_penalty = 0.1 # 表情包回复惩罚系数,设为0为不回复单个表情包,减少单独回复表情包的概率 - +metioned_bot_inevitable_reply = false # 提及 bot 必然回复 +at_bot_inevitable_reply = false # @bot 必然回复 [emoji] max_emoji_num = 120 # 表情包最大数量 From 20fe2262dfec98080c02e5b6c3f03499bfdab797 Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 14:36:13 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=88=91=E5=98=9E=E4=B8=AA=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E6=8B=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat_module/reasoning_chat/reasoning_chat.py | 2 +- src/plugins/chat_module/think_flow_chat/think_flow_chat.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index 0f3d5de31..ad6aa1615 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -190,7 +190,7 @@ class ReasoningChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: + if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: is_at = True is_mentioned = True diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index 652e03e30..337b30c04 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -215,7 +215,7 @@ class ThinkFlowChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: + if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: is_at = True is_mentioned = True From 1ca00d8187ea23a8d8fc9844794637e139c10cc1 Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 14:37:20 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat_module/reasoning_chat/reasoning_chat.py | 2 +- src/plugins/chat_module/think_flow_chat/think_flow_chat.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index ad6aa1615..164117b96 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -190,7 +190,7 @@ class ReasoningChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: + if f"@{global_config.BOT_NICKNAME}(id:{global_config.BOT_QQ})" in message.processed_plain_text: is_at = True is_mentioned = True diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index 337b30c04..de523f32a 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -215,7 +215,7 @@ class ThinkFlowChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}({global_config.BOT_QQ})" in message.processed_plain_text: + if f"@{global_config.BOT_NICKNAME}(id:{global_config.BOT_QQ})" in message.processed_plain_text: is_at = True is_mentioned = True From a3e2604a1c4f3274e1fe77f8e1430ef574c398ef Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 14:57:09 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/utils.py | 4 ++-- src/plugins/chat_module/reasoning_chat/reasoning_chat.py | 2 +- src/plugins/chat_module/think_flow_chat/think_flow_chat.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/chat/utils.py b/src/plugins/chat/utils.py index 7a155cce5..4eae47263 100644 --- a/src/plugins/chat/utils.py +++ b/src/plugins/chat/utils.py @@ -42,9 +42,9 @@ def is_mentioned_bot_in_message(message: MessageRecv) -> bool: """检查消息是否提到了机器人""" keywords = [global_config.BOT_NICKNAME] nicknames = global_config.BOT_ALIAS_NAMES - if f"回复{global_config.BOT_NICKNAME}({global_config.BOT_QQ})的消息,说: " in message.processed_plain_text: + if re.match(f"回复[\s\S]*?\({global_config.BOT_QQ}\)的消息,说:", message.processed_plain_text): return True - message_content = re.sub(r'\@[\s\S]*?\((\d+)\)','', message.processed_plain_text) + message_content = re.sub(r'\@[\s\S]*?((\d+))','', message.processed_plain_text) message_content = re.sub(r'回复[\s\S]*?\((\d+)\)的消息,说: ','', message_content) for keyword in keywords: if keyword in message_content: diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index 164117b96..113d6a1c7 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -190,7 +190,7 @@ class ReasoningChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}(id:{global_config.BOT_QQ})" in message.processed_plain_text: + if re.match(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): is_at = True is_mentioned = True diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index de523f32a..da15ce28f 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -215,7 +215,7 @@ class ThinkFlowChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}(id:{global_config.BOT_QQ})" in message.processed_plain_text: + if re.match(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): is_at = True is_mentioned = True From 99e166a0fb2f0b8a800d985d06537084c83ca3f0 Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 15:07:36 +0800 Subject: [PATCH 5/8] Update src/plugins/chat_module/reasoning_chat/reasoning_chat.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- src/plugins/chat_module/reasoning_chat/reasoning_chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index 113d6a1c7..d2f5d8545 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -190,7 +190,7 @@ class ReasoningChat: reply_probability = 0 is_at = False is_mentioned = False - if re.match(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): + if re.search(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): is_at = True is_mentioned = True From 81f9a99edd51cef6fc26c9258a5c51289c20aca7 Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 15:11:14 +0800 Subject: [PATCH 6/8] modified: src/plugins/chat_module/think_flow_chat/think_flow_chat.py --- src/plugins/chat_module/think_flow_chat/think_flow_chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index da15ce28f..1123c6813 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -215,7 +215,7 @@ class ThinkFlowChat: reply_probability = 0 is_at = False is_mentioned = False - if re.match(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): + if re.search(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): is_at = True is_mentioned = True From 9ed1ff84c7603af5e0153f0c0f1d14f610751e20 Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 15:15:25 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat_module/reasoning_chat/reasoning_chat.py | 2 +- src/plugins/chat_module/think_flow_chat/think_flow_chat.py | 2 +- src/plugins/config/config.py | 6 +++--- template/bot_config_template.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index d2f5d8545..a95358152 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -200,7 +200,7 @@ class ReasoningChat: else: if not is_mentioned: is_mentioned = is_mentioned_bot_in_message(message) - if is_mentioned and global_config.metioned_bot_inevitable_reply: + if is_mentioned and global_config.mentioned_bot_inevitable_reply: reply_probability = 1 logger.info("被提及,回复概率设置为100%") diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index 1123c6813..6cf796e5d 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -225,7 +225,7 @@ class ThinkFlowChat: else: if not is_mentioned: is_mentioned = is_mentioned_bot_in_message(message) - if is_mentioned and global_config.metioned_bot_inevitable_reply: + if is_mentioned and global_config.mentioned_bot_inevitable_reply: reply_probability = 1 logger.info("被提及,回复概率设置为100%") diff --git a/src/plugins/config/config.py b/src/plugins/config/config.py index 151653de9..7fc518a1d 100644 --- a/src/plugins/config/config.py +++ b/src/plugins/config/config.py @@ -195,7 +195,7 @@ class BotConfig: response_interested_rate_amplifier: float = 1.0 # 回复兴趣度放大系数 down_frequency_rate: float = 3 # 降低回复频率的群组回复意愿降低系数 emoji_response_penalty: float = 0.0 # 表情包回复惩罚 - metioned_bot_inevitable_reply: bool = False # 提及 bot 必然回复 + mentioned_bot_inevitable_reply: bool = False # 提及 bot 必然回复 at_bot_inevitable_reply: bool = False # @bot 必然回复 # response @@ -441,8 +441,8 @@ class BotConfig: config.emoji_response_penalty = willing_config.get( "emoji_response_penalty", config.emoji_response_penalty ) - config.metioned_bot_inevitable_reply = willing_config.get( - "metioned_bot_inevitable_reply", config.metioned_bot_inevitable_reply + config.mentioned_bot_inevitable_reply = willing_config.get( + "mentioned_bot_inevitable_reply", config.mentioned_bot_inevitable_reply ) config.at_bot_inevitable_reply = willing_config.get( "at_bot_inevitable_reply", config.at_bot_inevitable_reply diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 02adac139..7832747e2 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -105,7 +105,7 @@ response_willing_amplifier = 1 # 麦麦回复意愿放大系数,一般为1 response_interested_rate_amplifier = 1 # 麦麦回复兴趣度放大系数,听到记忆里的内容时放大系数 down_frequency_rate = 3 # 降低回复频率的群组回复意愿降低系数 除法 emoji_response_penalty = 0.1 # 表情包回复惩罚系数,设为0为不回复单个表情包,减少单独回复表情包的概率 -metioned_bot_inevitable_reply = false # 提及 bot 必然回复 +mentioned_bot_inevitable_reply = false # 提及 bot 必然回复 at_bot_inevitable_reply = false # @bot 必然回复 [emoji] From fda07587a97f5c9431f439680d62312f85c20777 Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 15:26:34 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/utils.py | 43 ++++++++++++++----- .../reasoning_chat/reasoning_chat.py | 17 +------- .../think_flow_chat/think_flow_chat.py | 17 +------- 3 files changed, 34 insertions(+), 43 deletions(-) diff --git a/src/plugins/chat/utils.py b/src/plugins/chat/utils.py index 4eae47263..1b9196e14 100644 --- a/src/plugins/chat/utils.py +++ b/src/plugins/chat/utils.py @@ -42,17 +42,38 @@ def is_mentioned_bot_in_message(message: MessageRecv) -> bool: """检查消息是否提到了机器人""" keywords = [global_config.BOT_NICKNAME] nicknames = global_config.BOT_ALIAS_NAMES - if re.match(f"回复[\s\S]*?\({global_config.BOT_QQ}\)的消息,说:", message.processed_plain_text): - return True - message_content = re.sub(r'\@[\s\S]*?((\d+))','', message.processed_plain_text) - message_content = re.sub(r'回复[\s\S]*?\((\d+)\)的消息,说: ','', message_content) - for keyword in keywords: - if keyword in message_content: - return True - for nickname in nicknames: - if nickname in message_content: - return True - return False + reply_probability = 0 + is_at = False + is_mentioned = False + + # 判断是否被@ + if re.search(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): + is_at = True + is_mentioned = True + + if is_at and global_config.at_bot_inevitable_reply: + reply_probability = 1 + logger.info("被@,回复概率设置为100%") + else: + if not is_mentioned: + + # 判断是否被回复 + if re.match(f"回复[\s\S]*?\({global_config.BOT_QQ}\)的消息,说:", message.processed_plain_text): + is_mentioned = True + + # 判断内容中是否被提及 + message_content = re.sub(r'\@[\s\S]*?((\d+))','', message.processed_plain_text) + message_content = re.sub(r'回复[\s\S]*?\((\d+)\)的消息,说: ','', message_content) + for keyword in keywords: + if keyword in message_content: + is_mentioned = True + for nickname in nicknames: + if nickname in message_content: + is_mentioned = True + if is_mentioned and global_config.mentioned_bot_inevitable_reply: + reply_probability = 1 + logger.info("被提及,回复概率设置为100%") + return is_mentioned, reply_probability async def get_embedding(text, request_type="embedding"): diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index a95358152..aa00992a6 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -187,22 +187,7 @@ class ReasoningChat: return # 处理提及 - reply_probability = 0 - is_at = False - is_mentioned = False - if re.search(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): - is_at = True - is_mentioned = True - - if is_at and global_config.at_bot_inevitable_reply: - reply_probability = 1 - logger.info("被@,回复概率设置为100%") - else: - if not is_mentioned: - is_mentioned = is_mentioned_bot_in_message(message) - if is_mentioned and global_config.mentioned_bot_inevitable_reply: - reply_probability = 1 - logger.info("被提及,回复概率设置为100%") + is_mentioned, reply_probability = is_mentioned_bot_in_message(message) # 计算回复意愿 current_willing = willing_manager.get_willing(chat_stream=chat) diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index 6cf796e5d..c0af9d6b5 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -212,22 +212,7 @@ class ThinkFlowChat: return # 处理提及 - reply_probability = 0 - is_at = False - is_mentioned = False - if re.search(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): - is_at = True - is_mentioned = True - - if is_at and global_config.at_bot_inevitable_reply: - reply_probability = 1 - logger.info("被@,回复概率设置为100%") - else: - if not is_mentioned: - is_mentioned = is_mentioned_bot_in_message(message) - if is_mentioned and global_config.mentioned_bot_inevitable_reply: - reply_probability = 1 - logger.info("被提及,回复概率设置为100%") + is_mentioned, reply_probability = is_mentioned_bot_in_message(message) # 计算回复意愿