修复relationship_build
This commit is contained in:
@@ -127,20 +127,20 @@ class InstantMemory:
|
||||
from json_repair import repair_json
|
||||
|
||||
prompt = f"""
|
||||
请根据以下发言内容,判断是否需要提取记忆
|
||||
{target}
|
||||
请用json格式输出,包含以下字段:
|
||||
其中,time的要求是:
|
||||
可以选择具体日期时间,格式为YYYY-MM-DD HH:MM:SS,或者大致时间,格式为YYYY-MM-DD
|
||||
可以选择相对时间,例如:今天,昨天,前天,5天前,1个月前
|
||||
可以选择留空进行模糊搜索
|
||||
{{
|
||||
"need_memory": 1,
|
||||
"keywords": "希望获取的记忆关键词,用/划分",
|
||||
"time": "希望获取的记忆大致时间"
|
||||
}}
|
||||
请只输出json格式,不要输出其他多余内容
|
||||
"""
|
||||
请根据以下发言内容,判断是否需要提取记忆
|
||||
{target}
|
||||
请用json格式输出,包含以下字段:
|
||||
其中,time的要求是:
|
||||
可以选择具体日期时间,格式为YYYY-MM-DD HH:MM:SS,或者大致时间,格式为YYYY-MM-DD
|
||||
可以选择相对时间,例如:今天,昨天,前天,5天前,1个月前
|
||||
可以选择留空进行模糊搜索
|
||||
{{
|
||||
"need_memory": 1,
|
||||
"keywords": "希望获取的记忆关键词,用/划分",
|
||||
"time": "希望获取的记忆大致时间"
|
||||
}}
|
||||
请只输出json格式,不要输出其他多余内容
|
||||
"""
|
||||
try:
|
||||
response, _ = await self.summary_model.generate_response_async(prompt, temperature=0.5)
|
||||
if global_config.debug.show_prompt:
|
||||
|
||||
@@ -586,7 +586,10 @@ async def build_readable_messages_with_list(
|
||||
允许通过参数控制格式化行为。
|
||||
"""
|
||||
formatted_string, details_list, pic_id_mapping, _ = _build_readable_messages_internal(
|
||||
convert_DatabaseMessages_to_MessageAndActionModel(messages), replace_bot_name, timestamp_mode, truncate
|
||||
[MessageAndActionModel.from_DatabaseMessages(msg) for msg in messages],
|
||||
replace_bot_name,
|
||||
timestamp_mode,
|
||||
truncate,
|
||||
)
|
||||
|
||||
if pic_mapping_info := build_pic_mapping_info(pic_id_mapping):
|
||||
@@ -653,19 +656,7 @@ def build_readable_messages(
|
||||
if not messages:
|
||||
return ""
|
||||
|
||||
copy_messages: List[MessageAndActionModel] = [
|
||||
MessageAndActionModel(
|
||||
msg.time,
|
||||
msg.user_info.user_id,
|
||||
msg.user_info.platform,
|
||||
msg.user_info.user_nickname,
|
||||
msg.user_info.user_cardname,
|
||||
msg.processed_plain_text,
|
||||
msg.display_message,
|
||||
msg.chat_info.platform,
|
||||
)
|
||||
for msg in messages
|
||||
]
|
||||
copy_messages: List[MessageAndActionModel] = [MessageAndActionModel.from_DatabaseMessages(msg) for msg in messages]
|
||||
|
||||
if show_actions and copy_messages:
|
||||
# 获取所有消息的时间范围
|
||||
@@ -924,22 +915,3 @@ async def get_person_id_list(messages: List[Dict[str, Any]]) -> List[str]:
|
||||
person_ids_set.add(person_id)
|
||||
|
||||
return list(person_ids_set) # 将集合转换为列表返回
|
||||
|
||||
|
||||
def convert_DatabaseMessages_to_MessageAndActionModel(message: List[DatabaseMessages]) -> List[MessageAndActionModel]:
|
||||
"""
|
||||
将 DatabaseMessages 列表转换为 MessageAndActionModel 列表。
|
||||
"""
|
||||
return [
|
||||
MessageAndActionModel(
|
||||
time=msg.time,
|
||||
user_id=msg.user_info.user_id,
|
||||
user_platform=msg.user_info.platform,
|
||||
user_nickname=msg.user_info.user_nickname,
|
||||
user_cardname=msg.user_info.user_cardname,
|
||||
processed_plain_text=msg.processed_plain_text,
|
||||
display_message=msg.display_message,
|
||||
chat_info_platform=msg.chat_info.platform,
|
||||
)
|
||||
for msg in message
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user