feat:添加名称等待兜底;添加提及必回;移除subplan模型;

pull/1220/head
SengokuCola 2025-09-12 00:06:45 +08:00
parent bfe4943b18
commit 298a74da64
6 changed files with 33 additions and 25 deletions

View File

@ -199,7 +199,7 @@ class HeartFChatting:
# !处理no_reply_until_call逻辑
if self.no_reply_until_call:
for message in recent_messages_list:
if message.is_mentioned or message.is_at:
if message.is_mentioned or message.is_at or len(recent_messages_list) >= 8 or time.time() - self.last_read_time > 600:
self.no_reply_until_call = False
break
# 没有提到,继续保持沉默
@ -333,6 +333,31 @@ class HeartFChatting:
loop_start_time=self.last_read_time,
available_actions=available_actions,
)
# !此处使at或者提及必定回复
metioned_message = None
for message in recent_messages_list:
if (message.is_mentioned or message.is_at) and global_config.chat.mentioned_bot_reply:
metioned_message = message
has_reply = False
for action in action_to_use_info:
if action.action_type == "reply":
has_reply =True
break
if not has_reply and metioned_message:
action_to_use_info.append(
ActionPlannerInfo(
action_type="reply",
reasoning="有人提到了你,进行回复",
action_data={},
action_message=metioned_message,
available_actions=available_actions,
)
)
# 3. 并行执行所有动作
action_tasks = [
@ -350,18 +375,15 @@ class HeartFChatting:
reply_text_from_reply = ""
action_success = False
action_reply_text = ""
action_command = ""
for i, result in enumerate(results):
if isinstance(result, BaseException):
logger.error(f"{self.log_prefix} 动作执行异常: {result}")
continue
_cur_action = action_to_use_info[i]
if result["action_type"] != "reply":
action_success = result["success"]
action_reply_text = result["reply_text"]
action_command = result.get("command", "")
elif result["action_type"] == "reply":
if result["success"]:
reply_loop_info = result["loop_info"]
@ -377,7 +399,6 @@ class HeartFChatting:
loop_info["loop_action_info"].update(
{
"action_taken": action_success,
"command": action_command,
"taken_time": time.time(),
}
)
@ -391,7 +412,6 @@ class HeartFChatting:
"loop_action_info": {
"action_taken": action_success,
"reply_text": action_reply_text,
"command": action_command,
"taken_time": time.time(),
},
}

View File

@ -71,14 +71,6 @@ no_reply_until_call
"action": "no_reply_until_call",
}}
wait_time
动作描述
沉默等待时间等待一段时间后回复
{{
"action": "wait_time",
"time":"等待时间",
}}
{action_options_text}
请选择合适的action并说明触发action的消息id和选择该action的原因消息id格式:m+数字
@ -175,7 +167,7 @@ class ActionPlanner:
try:
action = action_json.get("action", "no_action")
reasoning = action_json.get("reason", "未提供原因")
action_data = {key: value for key, value in action_json.items() if key not in ["action", "reasoning"]}
action_data = {key: value for key, value in action_json.items() if key not in ["action", "reason"]}
# 非no_action动作需要target_message_id
target_message = None

View File

@ -117,9 +117,6 @@ class ModelTaskConfig(ConfigBase):
planner: TaskConfig
"""规划模型配置"""
planner_small: TaskConfig
"""副规划模型配置"""
embedding: TaskConfig
"""嵌入模型配置"""

View File

@ -72,6 +72,9 @@ class ChatConfig(ConfigBase):
planner_size: float = 1.5
"""副规划器大小越小麦麦的动作执行能力越精细但是消耗更多token调大可以缓解429类错误"""
mentioned_bot_reply: bool = True
"""是否启用提及必回复"""
at_bot_inevitable_reply: float = 1
"""@bot 必然回复1为100%回复0为不额外增幅"""

View File

@ -50,7 +50,8 @@ expression_groups = [
[chat] #麦麦的聊天设置
talk_value = 1.5
talk_value = 1
mentioned_bot_reply = true # 是否启用提及必回复
max_context_size = 20 # 上下文长度
[relationship]

View File

@ -1,5 +1,5 @@
[inner]
version = "1.5.0"
version = "1.6.0"
# 配置文件版本号迭代规则同bot_config.toml
@ -113,11 +113,6 @@ model_list = ["siliconflow-deepseek-v3"]
temperature = 0.3
max_tokens = 800
[model_task_config.planner_small] #副决策:负责决定麦麦该做什么的模型
model_list = ["qwen3-30b"]
temperature = 0.3
max_tokens = 800
[model_task_config.emotion] #负责麦麦的情绪变化
model_list = ["qwen3-30b"]
temperature = 0.7