应该是把私聊必回加回来了喵?

This commit is contained in:
ikun-11451
2025-11-30 21:51:09 +08:00
parent dd12c441a9
commit 46359a8933
3 changed files with 20 additions and 5 deletions

View File

@@ -134,6 +134,7 @@ class ChatConfig(ValidatedConfigBase):
thinking_timeout: int = Field(default=40, description="思考超时时间") thinking_timeout: int = Field(default=40, description="思考超时时间")
mentioned_bot_inevitable_reply: bool = Field(default=False, description="提到机器人的必然回复") mentioned_bot_inevitable_reply: bool = Field(default=False, description="提到机器人的必然回复")
at_bot_inevitable_reply: bool = Field(default=False, description="@机器人的必然回复") at_bot_inevitable_reply: bool = Field(default=False, description="@机器人的必然回复")
private_chat_inevitable_reply: bool = Field(default=False, description="私聊必然回复")
allow_reply_self: bool = Field(default=False, description="是否允许回复自己说的话") allow_reply_self: bool = Field(default=False, description="是否允许回复自己说的话")
timestamp_display_mode: Literal["normal", "normal_no_YMD", "relative"] = Field( timestamp_display_mode: Literal["normal", "normal_no_YMD", "relative"] = Field(
default="normal_no_YMD", description="时间戳显示模式" default="normal_no_YMD", description="时间戳显示模式"

View File

@@ -13,7 +13,7 @@ from src.chat.message_receive.storage import MessageStorage
from src.common.logger import get_logger from src.common.logger import get_logger
from src.config.config import global_config from src.config.config import global_config
from src.mood.mood_manager import mood_manager from src.mood.mood_manager import mood_manager
from src.plugin_system.base.component_types import ChatMode from src.plugin_system.base.component_types import ChatMode, ChatType
from src.plugins.built_in.affinity_flow_chatter.planner.plan_executor import ChatterPlanExecutor from src.plugins.built_in.affinity_flow_chatter.planner.plan_executor import ChatterPlanExecutor
from src.plugins.built_in.affinity_flow_chatter.planner.plan_filter import ChatterPlanFilter from src.plugins.built_in.affinity_flow_chatter.planner.plan_filter import ChatterPlanFilter
from src.plugins.built_in.affinity_flow_chatter.planner.plan_generator import ChatterPlanGenerator from src.plugins.built_in.affinity_flow_chatter.planner.plan_generator import ChatterPlanGenerator
@@ -201,6 +201,10 @@ class ChatterActionPlanner:
reply_not_available = True reply_not_available = True
aggregate_should_act = False aggregate_should_act = False
# 检查私聊必回配置
is_private_chat = context and context.chat_type == ChatType.PRIVATE
force_reply = is_private_chat and global_config.chat.private_chat_inevitable_reply
if unread_messages: if unread_messages:
# 直接使用消息中已计算的标志,无需重复计算兴趣值 # 直接使用消息中已计算的标志,无需重复计算兴趣值
for message in unread_messages: for message in unread_messages:
@@ -219,9 +223,11 @@ class ChatterActionPlanner:
f"should_reply={message_should_reply}, should_act={message_should_act}" f"should_reply={message_should_reply}, should_act={message_should_act}"
) )
if message_should_reply: if message_should_reply or force_reply:
aggregate_should_act = True aggregate_should_act = True
reply_not_available = False reply_not_available = False
if force_reply:
logger.info(f"Focus模式 - 私聊必回已启用,强制回复消息 {message.message_id}")
break break
if message_should_act: if message_should_act:
@@ -394,11 +400,18 @@ class ChatterActionPlanner:
should_reply = False should_reply = False
target_message = None target_message = None
# 检查私聊必回配置
is_private_chat = context and context.chat_type == ChatType.PRIVATE
force_reply = is_private_chat and global_config.chat.private_chat_inevitable_reply
for message in unread_messages: for message in unread_messages:
message_should_reply = getattr(message, "should_reply", False) message_should_reply = getattr(message, "should_reply", False)
if message_should_reply: if message_should_reply or force_reply:
should_reply = True should_reply = True
target_message = message target_message = message
if force_reply:
logger.info(f"Normal模式 - 私聊必回已启用,强制回复消息 {message.message_id}")
else:
logger.info(f"Normal模式 - 消息 {message.message_id} 达到reply阈值准备回复") logger.info(f"Normal模式 - 消息 {message.message_id} 达到reply阈值准备回复")
break break

View File

@@ -1,5 +1,5 @@
[inner] [inner]
version = "7.9.1" version = "7.9.2"
#----以下是给开发人员阅读的如果你只是部署了MoFox-Bot不需要阅读---- #----以下是给开发人员阅读的如果你只是部署了MoFox-Bot不需要阅读----
#如果你想要修改配置文件请递增version的值 #如果你想要修改配置文件请递增version的值
@@ -171,6 +171,7 @@ learning_strength = 0.5
[chat] #MoFox-Bot的聊天通用设置 [chat] #MoFox-Bot的聊天通用设置
allow_reply_self = false # 是否允许回复自己说的话 allow_reply_self = false # 是否允许回复自己说的话
private_chat_inevitable_reply = false # 私聊必然回复
max_context_size = 25 # 上下文长度 max_context_size = 25 # 上下文长度
thinking_timeout = 40 # MoFox-Bot一次回复最长思考规划时间超过这个时间的思考会放弃往往是api反应太慢 thinking_timeout = 40 # MoFox-Bot一次回复最长思考规划时间超过这个时间的思考会放弃往往是api反应太慢