better:修改log
This commit is contained in:
@@ -172,7 +172,7 @@ class HeartFCMessageReceiver:
|
||||
return
|
||||
|
||||
# 5. 消息存储
|
||||
print(f"message: {message.message_info.time}")
|
||||
# print(f"message: {message.message_info.time}")
|
||||
await self.storage.store_message(message, chat)
|
||||
|
||||
# 6. 兴趣度计算与更新
|
||||
|
||||
@@ -261,7 +261,7 @@ class ExpressionSelectorProcessor(BaseProcessor):
|
||||
try:
|
||||
content, _ = await self.llm_model.generate_response_async(prompt=prompt)
|
||||
|
||||
logger.info(f"{self.log_prefix} LLM返回结果: {content}")
|
||||
# logger.info(f"{self.log_prefix} LLM返回结果: {content}")
|
||||
|
||||
if not content:
|
||||
logger.warning(f"{self.log_prefix} LLM返回空结果")
|
||||
|
||||
@@ -223,7 +223,7 @@ class RelationshipProcessor(BaseProcessor):
|
||||
last_segment["message_count"] = self._count_messages_in_timerange(
|
||||
last_segment["start_time"], last_segment["end_time"]
|
||||
)
|
||||
logger.info(f"{self.log_prefix} 延伸用户 {person_id} 的消息段: {last_segment}")
|
||||
logger.debug(f"{self.log_prefix} 延伸用户 {person_id} 的消息段: {last_segment}")
|
||||
else:
|
||||
# 超过10条消息,结束当前消息段并创建新的
|
||||
# 结束当前消息段:延伸到原消息段最后一条消息后5条消息的时间
|
||||
@@ -617,13 +617,22 @@ class RelationshipProcessor(BaseProcessor):
|
||||
if self.info_fetched_cache:
|
||||
for person_id in self.info_fetched_cache:
|
||||
person_infos_str = ""
|
||||
unknown_info_types = [] # 收集所有unknow的信息类型
|
||||
person_name = ""
|
||||
|
||||
for info_type in self.info_fetched_cache[person_id]:
|
||||
person_name = self.info_fetched_cache[person_id][info_type]["person_name"]
|
||||
if not self.info_fetched_cache[person_id][info_type]["unknow"]:
|
||||
info_content = self.info_fetched_cache[person_id][info_type]["info"]
|
||||
person_infos_str += f"[{info_type}]:{info_content};"
|
||||
else:
|
||||
person_infos_str += f"你不了解{person_name}有关[{info_type}]的信息,不要胡乱回答,你可以直接说你不知道,或者你忘记了;"
|
||||
unknown_info_types.append(info_type)
|
||||
|
||||
# 如果有unknow的信息类型,合并输出
|
||||
if unknown_info_types:
|
||||
unknown_types_str = "、".join(unknown_info_types)
|
||||
person_infos_str += f"你不了解{person_name}有关[{unknown_types_str}]的信息,不要胡乱回答,你可以直接说你不知道,或者你忘记了;"
|
||||
|
||||
if person_infos_str:
|
||||
persons_infos_str += f"你对 {person_name} 的了解:{person_infos_str}\n"
|
||||
|
||||
@@ -718,7 +727,7 @@ class RelationshipProcessor(BaseProcessor):
|
||||
for person_id, info_type, start_time in instant_tasks:
|
||||
# 检查缓存中是否已存在且未过期的信息
|
||||
if person_id in self.info_fetched_cache and info_type in self.info_fetched_cache[person_id]:
|
||||
logger.info(f"{self.log_prefix} 用户 {person_id} 的 {info_type} 信息已存在且未过期,跳过调取。")
|
||||
logger.debug(f"{self.log_prefix} 用户 {person_id} 的 {info_type} 信息已存在且未过期,跳过调取。")
|
||||
continue
|
||||
|
||||
task = asyncio.create_task(self._fetch_single_info_instant(person_id, info_type, start_time))
|
||||
|
||||
@@ -27,10 +27,7 @@ def init_prompt():
|
||||
{name_block}
|
||||
请你根据以上聊天记录,思考聊天记录中是否有人提到你自己相关的信息,或者有人询问你的相关信息。
|
||||
|
||||
数据库中包含以下关键词的信息:
|
||||
{available_keywords}
|
||||
|
||||
请从上述关键词中选择你需要查询的关键词来回答聊天中的问题。如果需要多个关键词,请用逗号隔开。
|
||||
请选择你需要查询的关键词来回答聊天中的问题。如果需要多个关键词,请用逗号隔开。
|
||||
如果聊天中没有涉及任何关于你的问题,请输出none。
|
||||
|
||||
现在请输出你要查询的关键词,注意只输出关键词就好,不要输出其他内容:
|
||||
@@ -134,7 +131,7 @@ class SelfProcessor(BaseProcessor):
|
||||
try:
|
||||
keyword, _ = await self.llm_model.generate_response_async(prompt=prompt)
|
||||
|
||||
print(f"prompt: {prompt}\nkeyword: {keyword}")
|
||||
# print(f"prompt: {prompt}\nkeyword: {keyword}")
|
||||
|
||||
if not keyword:
|
||||
logger.warning(f"{self.log_prefix} LLM返回空结果,自我识别失败。")
|
||||
|
||||
@@ -175,7 +175,7 @@ class ChattingObservation(Observation):
|
||||
limit_mode="latest",
|
||||
)
|
||||
|
||||
print(f"new_messages_list: {new_messages_list}")
|
||||
# print(f"new_messages_list: {new_messages_list}")
|
||||
|
||||
last_obs_time_mark = self.last_observe_time
|
||||
if new_messages_list:
|
||||
|
||||
@@ -262,7 +262,7 @@ class RelationshipManager:
|
||||
for original_name, mapped_name in name_mapping.items():
|
||||
points = points.replace(mapped_name, original_name)
|
||||
|
||||
logger.info(f"prompt: {prompt}")
|
||||
# logger.info(f"prompt: {prompt}")
|
||||
# logger.info(f"points: {points}")
|
||||
|
||||
if not points:
|
||||
@@ -287,7 +287,7 @@ class RelationshipManager:
|
||||
logger_str = f"了解了有关{person_name}的新印象:\n"
|
||||
for point in points_list:
|
||||
logger_str += f"{point[0]},重要性:{point[1]}\n\n"
|
||||
logger.info("logger_str")
|
||||
logger.info(logger_str)
|
||||
|
||||
except json.JSONDecodeError:
|
||||
logger.error(f"解析points JSON失败: {points}")
|
||||
@@ -486,7 +486,7 @@ class RelationshipManager:
|
||||
await person_info_manager.update_one_field(person_id, "know_since", timestamp)
|
||||
await person_info_manager.update_one_field(person_id, "last_know", timestamp)
|
||||
|
||||
logger.info(f"印象更新完成 for {person_name}")
|
||||
logger.info(f"{person_name} 的印象更新完成")
|
||||
|
||||
def build_focus_readable_messages(self, messages: list, target_person_id: str = None) -> str:
|
||||
"""格式化消息,处理所有消息内容"""
|
||||
|
||||
Reference in New Issue
Block a user