恢复可用性

This commit is contained in:
UnCLAS-Prommer
2025-08-18 11:16:28 +08:00
parent 3481234d2b
commit 5e26414839
13 changed files with 181 additions and 61 deletions

View File

@@ -286,7 +286,8 @@ class HeartFChatting:
filter_command=True,
)
# TODO: 修复!
temp_recent_messages_dict = [msg.__dict__ for msg in recent_messages_dict]
from src.common.data_models import temporarily_transform_class_to_dict
temp_recent_messages_dict = [temporarily_transform_class_to_dict(msg) for msg in recent_messages_dict]
# 统一的消息处理逻辑
should_process,interest_value = await self._should_process_messages(temp_recent_messages_dict)

View File

@@ -353,7 +353,8 @@ class ExpressionLearner:
limit=num,
)
# TODO: 修复!
random_msg: Optional[List[Dict[str, Any]]] = [msg.__dict__ for msg in random_msg_temp] if random_msg_temp else None
from src.common.data_models import temporarily_transform_class_to_dict
random_msg: Optional[List[Dict[str, Any]]] = [temporarily_transform_class_to_dict(msg) for msg in random_msg_temp] if random_msg_temp else None
# print(random_msg)
if not random_msg or random_msg == []:

View File

@@ -71,7 +71,8 @@ class ActionModifier:
limit=min(int(global_config.chat.max_context_size * 0.33), 10),
)
# TODO: 修复!
temp_msg_list_before_now_half = [msg.__dict__ for msg in message_list_before_now_half]
from src.common.data_models import temporarily_transform_class_to_dict
temp_msg_list_before_now_half = [temporarily_transform_class_to_dict(msg) for msg in message_list_before_now_half]
chat_content = build_readable_messages(
temp_msg_list_before_now_half,
replace_bot_name=True,

View File

@@ -281,7 +281,8 @@ class ActionPlanner:
limit=int(global_config.chat.max_context_size * 0.6),
)
# TODO: 修复!
temp_msg_list_before_now = [msg.__dict__ for msg in message_list_before_now]
from src.common.data_models import temporarily_transform_class_to_dict
temp_msg_list_before_now = [temporarily_transform_class_to_dict(msg) for msg in message_list_before_now]
chat_content_block, message_id_list = build_readable_messages_with_id(
messages=temp_msg_list_before_now,
timestamp_mode="normal_no_YMD",

View File

@@ -710,12 +710,13 @@ class DefaultReplyer:
target = replace_user_references_sync(target, chat_stream.platform, replace_bot_name=True)
# TODO: 修复!
from src.common.data_models import temporarily_transform_class_to_dict
message_list_before_now_long = get_raw_msg_before_timestamp_with_chat(
chat_id=chat_id,
timestamp=time.time(),
limit=global_config.chat.max_context_size * 1,
)
temp_msg_list_before_long = [msg.__dict__ for msg in message_list_before_now_long]
temp_msg_list_before_long = [temporarily_transform_class_to_dict(msg) for msg in message_list_before_now_long]
# TODO: 修复!
message_list_before_short = get_raw_msg_before_timestamp_with_chat(
@@ -723,7 +724,7 @@ class DefaultReplyer:
timestamp=time.time(),
limit=int(global_config.chat.max_context_size * 0.33),
)
temp_msg_list_before_short = [msg.__dict__ for msg in message_list_before_short]
temp_msg_list_before_short = [temporarily_transform_class_to_dict(msg) for msg in message_list_before_short]
chat_talking_prompt_short = build_readable_messages(
temp_msg_list_before_short,
@@ -899,7 +900,8 @@ class DefaultReplyer:
limit=min(int(global_config.chat.max_context_size * 0.33), 15),
)
# TODO: 修复!
temp_msg_list_before_now_half = [msg.__dict__ for msg in message_list_before_now_half]
from src.common.data_models import temporarily_transform_class_to_dict
temp_msg_list_before_now_half = [temporarily_transform_class_to_dict(msg) for msg in message_list_before_now_half]
chat_talking_prompt_half = build_readable_messages(
temp_msg_list_before_now_half,
replace_bot_name=True,