This commit is contained in:
SengokuCola
2025-07-16 00:22:07 +08:00
parent 037f0c5216
commit d67cffd953
6 changed files with 12 additions and 14 deletions

View File

@@ -13,7 +13,6 @@ from src.chat.utils.prompt_builder import Prompt, global_prompt_manager
from src.chat.utils.chat_message_builder import (
build_readable_actions,
get_actions_by_timestamp_with_chat,
build_readable_messages,
build_readable_messages_with_id,
get_raw_msg_before_timestamp_with_chat,
)
@@ -108,6 +107,7 @@ class ActionPlanner:
reasoning = "规划器初始化默认"
action_data = {}
current_available_actions: Dict[str, ActionInfo] = {}
target_message = None # 初始化target_message变量
try:
is_group_chat = True
@@ -202,8 +202,6 @@ class ActionPlanner:
target_message = self.find_message_by_id(target_message_id, message_id_list)
else:
logger.warning(f"{self.log_prefix}FOCUS模式下动作'{action}'缺少target_message_id")
else:
target_message = None
if action == "no_action":
reasoning = "normal决定不使用额外动作"
@@ -293,6 +291,7 @@ class ActionPlanner:
- 如果你刚刚进行了回复,不要对同一个话题重复回应
{
"action": "reply",
"target_message_id":"触发action的消息id",
"reason":"回复的原因"
}

View File

@@ -185,8 +185,6 @@ class DefaultReplyer:
prompt = None
if available_actions is None:
available_actions = {}
if reply_data is None:
reply_data = {}
try:
if not reply_data:
reply_data = {

View File

@@ -252,7 +252,7 @@ def _build_readable_messages_internal(
pic_id_mapping: Optional[Dict[str, str]] = None,
pic_counter: int = 1,
show_pic: bool = True,
message_id_list: List[Dict[str, Any]] = [],
message_id_list: List[Dict[str, Any]] = None,
) -> Tuple[str, List[Tuple[float, str, str]], Dict[str, str], int]:
"""
内部辅助函数,构建可读消息字符串和原始消息详情列表。
@@ -697,7 +697,7 @@ def build_readable_messages(
truncate: bool = False,
show_actions: bool = False,
show_pic: bool = True,
message_id_list: List[Dict[str, Any]] = [],
message_id_list: List[Dict[str, Any]] = None,
) -> str: # sourcery skip: extract-method
"""
将消息列表转换为可读的文本格式。