mirror of https://github.com/Mai-with-u/MaiBot.git
feat:优化think_mode,修复表情包选取bug
parent
52acf0c167
commit
b73a748f52
|
|
@ -47,8 +47,7 @@ reply
|
|||
2.你可以自然的顺着正在进行的聊天内容进行回复或自然的提出一个问题
|
||||
3.不要选择回复你自己发送的消息
|
||||
4.不要单独对表情包进行回复
|
||||
5.think_level表示思考深度,0表示该回复不需要思考和回忆,1表示该回复需要进行回忆和思考
|
||||
{{"action":"reply", "think_level":数值等级(0或1), "target_messamge_id":"消息id(m+数字)"}}
|
||||
{reply_action_example}
|
||||
|
||||
no_reply
|
||||
动作描述:
|
||||
|
|
@ -415,6 +414,12 @@ class ActionPlanner:
|
|||
)
|
||||
name_block = f"你的名字是{bot_name}{bot_nickname},请注意哪些是你自己的发言。"
|
||||
|
||||
# 根据 think_mode 配置决定 reply action 的示例 JSON
|
||||
if global_config.chat.think_mode == "classic":
|
||||
reply_action_example = '{{"action":"reply", "target_messamge_id":"消息id(m+数字)"}}'
|
||||
else:
|
||||
reply_action_example = '5.think_level表示思考深度,0表示该回复不需要思考和回忆,1表示该回复需要进行回忆和思考\n{{"action":"reply", "think_level":数值等级(0或1), "target_messamge_id":"消息id(m+数字)"}}'
|
||||
|
||||
planner_prompt_template = await global_prompt_manager.get_prompt_async("planner_prompt")
|
||||
prompt = planner_prompt_template.format(
|
||||
time_block=time_block,
|
||||
|
|
@ -426,16 +431,9 @@ class ActionPlanner:
|
|||
name_block=name_block,
|
||||
interest=interest,
|
||||
plan_style=global_config.personality.plan_style,
|
||||
reply_action_example=reply_action_example,
|
||||
)
|
||||
|
||||
# 如果 think_mode 为 "default",移除 think_level 相关说明(第 50-51 行)
|
||||
if global_config.chat.think_mode == "default":
|
||||
# 移除 "5.think_level表示思考深度..." 这一行(包括可能的换行符)
|
||||
prompt = re.sub(r'5\.think_level表示思考深度,0表示该回复不需要思考和回忆,1表示该回复需要进行回忆和思考\s*\n?', '', prompt)
|
||||
# 移除 JSON 示例中的 think_level 参数(注意格式化后是单大括号)
|
||||
prompt = re.sub(r',\s*"think_level":数值等级\(0或1\)', '', prompt)
|
||||
prompt = re.sub(r'"think_level":数值等级\(0或1\),\s*', '', prompt)
|
||||
|
||||
return prompt, message_id_list
|
||||
except Exception as e:
|
||||
logger.error(f"构建 Planner 提示词时出错: {e}")
|
||||
|
|
|
|||
|
|
@ -108,10 +108,10 @@ class ChatConfig(ConfigBase):
|
|||
时间区间支持跨夜,例如 "23:00-02:00"。
|
||||
"""
|
||||
|
||||
think_mode: Literal["default", "deep", "dynamic"] = "default"
|
||||
think_mode: Literal["classic", "deep", "dynamic"] = "classic"
|
||||
"""
|
||||
思考模式配置
|
||||
- default: 默认think_level为0(轻量回复,不需要思考和回忆)
|
||||
- classic: 默认think_level为0(轻量回复,不需要思考和回忆)
|
||||
- deep: 默认think_level为1(深度回复,需要进行回忆和思考)
|
||||
- dynamic: think_level由planner动态给出(根据planner返回的think_level决定)
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class EmojiAction(BaseAction):
|
|||
try:
|
||||
# 1. 获取发送表情的原因
|
||||
# reason = self.action_data.get("reason", "表达当前情绪")
|
||||
reason = self.reasoning
|
||||
reason = self.action_reasoning
|
||||
|
||||
# 2. 随机获取20个表情包
|
||||
sampled_emojis = await emoji_api.get_random(30)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ talk_value = 1 # 聊天频率,越小越沉默,范围0-1
|
|||
mentioned_bot_reply = true # 是否启用提及必回复
|
||||
max_context_size = 30 # 上下文长度
|
||||
planner_smooth = 3 # 规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐1-5,0为关闭,必须大于等于0
|
||||
think_mode = "dynamic" # 思考模式,可选:default(默认浅度思考和回复)、deep(会进行比较长的,深度回复)、dynamic(动态选择两种模式)
|
||||
think_mode = "dynamic" # 思考模式,可选:classic(默认浅度思考和回复)、deep(会进行比较长的,深度回复)、dynamic(动态选择两种模式)
|
||||
|
||||
enable_talk_value_rules = true # 是否启用动态发言频率规则
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue