fix:非提及不回复

pull/1354/head
SengokuCola 2025-11-09 20:44:00 +08:00
parent 9191756412
commit acf316281b
2 changed files with 37 additions and 27 deletions

View File

@ -518,8 +518,9 @@ class HeartFChatting:
)
reply_result = None
# 过滤掉planner返回的reply动作如果存在
action_to_use_info = [action for action in action_to_use_info if action.action_type != "reply"]
# 只在提及情况下过滤掉planner返回的reply动作提及时已有独立回复生成
if force_reply_message:
action_to_use_info = [action for action in action_to_use_info if action.action_type != "reply"]
logger.info(
f"{self.log_prefix} 决定执行{len(action_to_use_info)}个动作: {' '.join([a.action_type for a in action_to_use_info])}"

View File

@ -37,41 +37,54 @@ def init_prompt():
"""
{time_block}
{name_block}
兴趣{interest}{chat_context_description}
你的兴趣{interest}
{chat_context_description}以下是具体的聊天内容
**聊天内容**
{chat_content_block}
**可用动作**
reply - 回复消息可回复被呼叫但未回应的消息或自然延续话题不回复自己的消息和纯表情包
{{
"action": "reply",
"target_message_id":"消息id(m+数字)",
"reason":"原因"
}}
**可选的action**
reply
动作描述
1.你可以选择呼叫了你的名字但是你没有做出回应的消息进行回复
2.你可以自然的顺着正在进行的聊天内容进行回复或自然的提出一个问题
3.不要回复你自己发送的消息
4.不要单独对表情包进行回复
{{"action":"reply", "target_message_id":"消息id(m+数字)", "reason":"原因"}}
no_reply - 保持沉默控制发言频率
{{
"action": "no_reply"
}}
no_reply
动作描述
保持沉默不回复直到有新消息
控制聊天频率不要太过频繁的发言
{{"action":"no_reply"}}
no_reply_until_call - 保持沉默直到被直接呼叫话题不相关或频繁no_reply时使用
{{
"action": "no_reply_until_call"
}}
no_reply_until_call
动作描述
保持沉默直到有人直接叫你的名字
当前话题不感兴趣时使用或有人不喜欢你的发言时使用
当你频繁选择no_reply时使用表示话题暂时与你无关
{{"action":"no_reply_until_call"}}
{action_options_text}
**历史记录**
**你之前的action执行和思考记录**
{actions_before_now_block}
**要求**
请选择**可选的**且符合使用条件的action并说明触发action的消息id(消息id格式:m+数字)
不要回复你自己发送的消息
先输出你的选择思考理由再输出你选择的action理由是一段平文本不要分点精简
**动作选择要求**
请你根据聊天内容,用户的最新消息和以下标准选择合适的动作:
{plan_style}
{moderation_prompt}
先输出思考理由平文本精简再输出JSON格式的动作消息id格式m+数字可输出多个动作
请选择所有符合使用要求的action动作用json格式输出如果输出多个json每个json都要单独用```json包裹你可以重复使用同一个动作或不同动作:
**示例**
// 理由文本
```json
{{"action":"动作名", "target_message_id":"m123", "reason":"原因"}}
```
```json
{{"action":"动作名", "target_message_id":"m456", "reason":"原因"}}
```""",
"planner_prompt",
)
@ -82,11 +95,7 @@ no_reply_until_call - 保持沉默直到被直接呼叫(话题不相关或频
动作描述{action_description}
使用条件{parallel_text}
{action_require}
{{
"action": "{action_name}",{action_parameters},
"target_message_id":"触发action的消息id",
"reason":"触发action的原因"
}}
{{"action":"{action_name}",{action_parameters}, "target_message_id":"消息id(m+数字)", "reason":"原因"}}
""",
"action_prompt",
)