log:修改一些log

This commit is contained in:
SengokuCola
2025-09-25 19:07:35 +08:00
parent 1ddedc1dc6
commit 20013a1a2c
13 changed files with 43 additions and 722 deletions

View File

@@ -492,7 +492,7 @@ class BrainPlanner:
action.action_data = action.action_data or {}
action.action_data["loop_start_time"] = loop_start_time
logger.info(
logger.debug(
f"{self.log_prefix}规划器决定执行{len(actions)}个动作: {' '.join([a.action_type for a in actions])}"
)

View File

@@ -154,13 +154,16 @@ class HeartFChatting:
# 记录循环信息和计时器结果
timer_strings = []
for name, elapsed in cycle_timers.items():
formatted_time = f"{elapsed * 1000:.2f}毫秒" if elapsed < 1 else f"{elapsed:.2f}"
if elapsed < 0.1:
# 不显示小于0.1秒的计时器
continue
formatted_time = f"{elapsed:.2f}"
timer_strings.append(f"{name}: {formatted_time}")
logger.info(
f"{self.log_prefix}{self._current_cycle_detail.cycle_id}次思考,"
f"耗时: {self._current_cycle_detail.end_time - self._current_cycle_detail.start_time:.1f}" # type: ignore
+ (f"\n详情: {'; '.join(timer_strings)}" if timer_strings else "")
f"耗时: {self._current_cycle_detail.end_time - self._current_cycle_detail.start_time:.1f};" # type: ignore
+ (f"详情: {'; '.join(timer_strings)}" if timer_strings else "")
)
async def _loopbody(self): # sourcery skip: hoist-if-from-if
@@ -346,8 +349,8 @@ class HeartFChatting:
)
logger.info(
f"{self.log_prefix}决定执行{len(action_to_use_info)}个动作: {' '.join([a.action_type for a in action_to_use_info])}"
)
f"{self.log_prefix} 决定执行{len(action_to_use_info)}个动作: {' '.join([a.action_type for a in action_to_use_info])}"
)
# 3. 并行执行所有动作
action_tasks = [

View File

@@ -215,29 +215,30 @@ class DefaultReplyer:
traceback.print_exc()
return False, llm_response
async def build_relation_info(self, chat_content: str, sender: str, person_list: List[Person]):
if not global_config.relationship.enable_relationship:
return ""
#移动到 relation插件中构建
# async def build_relation_info(self, chat_content: str, sender: str, person_list: List[Person]):
# if not global_config.relationship.enable_relationship:
# return ""
if not sender:
return ""
# if not sender:
# return ""
if sender == global_config.bot.nickname:
return ""
# if sender == global_config.bot.nickname:
# return ""
# 获取用户ID
person = Person(person_name=sender)
if not is_person_known(person_name=sender):
logger.warning(f"未找到用户 {sender} 的ID跳过信息提取")
return f"你完全不认识{sender}不理解ta的相关信息。"
# # 获取用户ID
# person = Person(person_name=sender)
# if not is_person_known(person_name=sender):
# logger.warning(f"未找到用户 {sender} 的ID跳过信息提取")
# return f"你完全不认识{sender}不理解ta的相关信息。"
sender_relation = await person.build_relationship(chat_content)
others_relation = ""
for person in person_list:
person_relation = await person.build_relationship()
others_relation += person_relation
# sender_relation = await person.build_relationship(chat_content)
# others_relation = ""
# for person in person_list:
# person_relation = await person.build_relationship()
# others_relation += person_relation
return f"{sender_relation}\n{others_relation}"
# return f"{sender_relation}\n{others_relation}"
async def build_expression_habits(self, chat_history: str, target: str) -> Tuple[str, List[int]]:
# sourcery skip: for-append-to-extend
@@ -680,8 +681,8 @@ class DefaultReplyer:
if person.is_known:
person_list_short.append(person)
for person in person_list_short:
print(person.person_name)
# for person in person_list_short:
# print(person.person_name)
chat_talking_prompt_short = build_readable_messages(
message_list_before_short,
@@ -956,7 +957,7 @@ class DefaultReplyer:
prompt
)
logger.debug(f"replyer生成内容: {content}")
logger.info(f"使用{model_name}生成回复内容: {content}")
return content, reasoning_content, model_name, tool_calls
async def get_prompt_info(self, message: str, sender: str, target: str):

View File

@@ -563,8 +563,8 @@ class PrivateReplyer:
if person.is_known:
person_list_short.append(person)
for person in person_list_short:
print(person.person_name)
# for person in person_list_short:
# print(person.person_name)
chat_talking_prompt_short = build_readable_messages(
message_list_before_short,
@@ -829,7 +829,7 @@ class PrivateReplyer:
prompt
)
logger.debug(f"replyer生成内容: {content}")
logger.info(f"使用 {model_name} 生成回复内容: {content}")
return content, reasoning_content, model_name, tool_calls
async def get_prompt_info(self, message: str, sender: str, target: str):