移除chat_message_builder

This commit is contained in:
UnCLAS-Prommer
2026-03-11 22:28:13 +08:00
committed by DrSmoothl
parent d01abd893d
commit f17b85c1bd
8 changed files with 209 additions and 1093 deletions

View File

@@ -0,0 +1,32 @@
from typing import TYPE_CHECKING, List
from src.common.utils.math_utils import translate_timestamp_to_human_readable, TimestampMode
if TYPE_CHECKING:
from src.common.data_models.action_record_data_model import MaiActionRecord
class ActionUtils:
@staticmethod
def build_readable_action_records(action_records: List["MaiActionRecord"], timestamp_mode: str | TimestampMode):
"""
将动作列表转换为可读的文本格式。
格式: `在`time`,你使用了`action_name`,具体内容是:`action_prompt_display`
Args:
action_records: 动作记录字典列表。
timestamp_mode: 时间戳模式。
Returns:
格式化的动作字符串。
"""
if not action_records:
return ""
output_lines = []
for record in action_records:
timestamp_str = translate_timestamp_to_human_readable(record.timestamp.timestamp(), mode=timestamp_mode)
line = f"{timestamp_str},你使用了{record.action_name},具体内容是:{record.action_display_prompt}"
output_lines.append(line)
return "\n".join(output_lines)