This commit is contained in:
Bakadax
2025-04-06 14:30:43 +08:00
parent 594c30ab74
commit 2dd44ec69c
5 changed files with 56 additions and 7 deletions

View File

@@ -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

View File

@@ -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}")