log:修改一些log
This commit is contained in:
@@ -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])}"
|
||||
)
|
||||
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -363,8 +363,8 @@ MODULE_COLORS = {
|
||||
"planner": "\033[36m",
|
||||
"relation": "\033[38;5;139m", # 柔和的紫色,不刺眼
|
||||
# 聊天相关模块
|
||||
"normal_chat": "\033[38;5;81m", # 亮蓝绿色
|
||||
"heartflow": "\033[38;5;175m", # 柔和的粉色,不显眼但保持粉色系
|
||||
"hfc": "\033[38;5;175m", # 柔和的粉色,不显眼但保持粉色系
|
||||
"bc": "\033[38;5;175m", # 柔和的粉色,不显眼但保持粉色系
|
||||
"sub_heartflow": "\033[38;5;207m", # 粉紫色
|
||||
"subheartflow_manager": "\033[38;5;201m", # 深粉色
|
||||
"background_tasks": "\033[38;5;240m", # 灰色
|
||||
@@ -372,8 +372,6 @@ MODULE_COLORS = {
|
||||
"chat_stream": "\033[38;5;51m", # 亮青色
|
||||
"message_storage": "\033[38;5;33m", # 深蓝色
|
||||
"expressor": "\033[38;5;166m", # 橙色
|
||||
# 专注聊天模块
|
||||
"memory_activator": "\033[38;5;117m", # 天蓝色
|
||||
# 插件系统
|
||||
"plugins": "\033[31m", # 红色
|
||||
"plugin_api": "\033[33m", # 黄色
|
||||
|
||||
@@ -148,6 +148,8 @@ class LLMRequest:
|
||||
)
|
||||
|
||||
logger.debug(f"LLM请求总耗时: {time.time() - start_time}")
|
||||
logger.debug(f"LLM生成内容: {response}")
|
||||
|
||||
content = response.content
|
||||
reasoning_content = response.reasoning_content or ""
|
||||
tool_calls = response.tool_calls
|
||||
|
||||
@@ -466,8 +466,8 @@ class Person:
|
||||
<分类1><分类2><分类3>......
|
||||
如果没有相关的分类,请输出<none>"""
|
||||
response, _ = await relation_selection_model.generate_response_async(prompt)
|
||||
print(prompt)
|
||||
print(response)
|
||||
# print(prompt)
|
||||
# print(response)
|
||||
category_list = extract_categories_from_response(response)
|
||||
if "none" not in category_list:
|
||||
for category in category_list:
|
||||
|
||||
@@ -66,8 +66,8 @@ async def generate_with_model(
|
||||
Tuple[bool, str, str, str]: (是否成功, 生成的内容, 推理过程, 模型名称)
|
||||
"""
|
||||
try:
|
||||
model_name_list = model_config.model_list
|
||||
logger.info(f"[LLMAPI] 使用模型集合 {model_name_list} 生成内容")
|
||||
# model_name_list = model_config.model_list
|
||||
# logger.info(f"[LLMAPI] 使用模型集合 {model_name_list} 生成内容")
|
||||
logger.debug(f"[LLMAPI] 完整提示词: {prompt}")
|
||||
|
||||
llm_request = LLMRequest(model_set=model_config, request_type=request_type)
|
||||
|
||||
@@ -100,7 +100,7 @@ async def _send_to_target(
|
||||
anchor_message: Union["MessageRecv", None] = None
|
||||
if reply_message:
|
||||
anchor_message = db_message_to_message_recv(reply_message)
|
||||
logger.info(f"[SendAPI] 找到匹配的回复消息,发送者: {anchor_message.message_info.user_info.user_id}") # type: ignore
|
||||
logger.debug(f"[SendAPI] 找到匹配的回复消息,发送者: {anchor_message.message_info.user_info.user_id}") # type: ignore
|
||||
if anchor_message:
|
||||
anchor_message.update_chat_stream(target_stream)
|
||||
assert anchor_message.message_info.user_info, "用户信息缺失"
|
||||
|
||||
@@ -180,7 +180,6 @@ class ToolExecutor:
|
||||
|
||||
tool_results.append(tool_info)
|
||||
used_tools.append(tool_name)
|
||||
logger.info(f"{self.log_prefix}工具{tool_name}执行成功,类型: {tool_info['type']}")
|
||||
preview = content[:200]
|
||||
logger.debug(f"{self.log_prefix}工具{tool_name}结果内容: {preview}...")
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user