From 6e39965c56501539c95f553359154b53910adf85 Mon Sep 17 00:00:00 2001
From: SengokuCola <1026294844@qq.com>
Date: Wed, 28 May 2025 22:24:08 +0800
Subject: [PATCH] =?UTF-8?q?better=EF=BC=9A=E4=BC=98=E5=8C=96logger?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/chat/emoji_system/emoji_manager.py | 2 +-
src/chat/heart_flow/background_tasks.py | 2 -
src/chat/heart_flow/sub_heartflow.py | 15 ++----
src/chat/message_receive/message_sender.py | 5 +-
src/chat/normal_chat/normal_chat.py | 54 +++++++++++++------
src/chat/normal_chat/normal_chat_generator.py | 12 ++---
src/chat/utils/info_catcher.py | 10 ++--
src/common/logger.py | 36 +++++++------
src/common/logger_manager.py | 8 +--
src/main.py | 4 +-
src/manager/async_task_manager.py | 2 +-
src/person_info/person_info.py | 14 ++---
src/person_info/relationship_manager.py | 4 +-
13 files changed, 93 insertions(+), 75 deletions(-)
diff --git a/src/chat/emoji_system/emoji_manager.py b/src/chat/emoji_system/emoji_manager.py
index 964721e42..df697155f 100644
--- a/src/chat/emoji_system/emoji_manager.py
+++ b/src/chat/emoji_system/emoji_manager.py
@@ -635,7 +635,7 @@ class EmojiManager:
"""获取所有表情包并初始化为MaiEmoji类对象,更新 self.emoji_objects"""
try:
self._ensure_db()
- logger.info("[数据库] 开始加载所有表情包记录 (Peewee)...")
+ logger.debug("[数据库] 开始加载所有表情包记录 (Peewee)...")
emoji_peewee_instances = Emoji.select()
emoji_objects, load_errors = _to_emoji_objects(emoji_peewee_instances)
diff --git a/src/chat/heart_flow/background_tasks.py b/src/chat/heart_flow/background_tasks.py
index 4bacfd0a0..066f930b9 100644
--- a/src/chat/heart_flow/background_tasks.py
+++ b/src/chat/heart_flow/background_tasks.py
@@ -87,8 +87,6 @@ class BackgroundTaskManager:
),
]
)
- else:
- logger.info("聊天模式为 normal,跳过启动清理任务、私聊激活任务和专注评估任务")
# 统一启动所有任务
for task_func, log_level, log_msg, task_attr_name in task_configs:
diff --git a/src/chat/heart_flow/sub_heartflow.py b/src/chat/heart_flow/sub_heartflow.py
index c95f606b1..d60baa79e 100644
--- a/src/chat/heart_flow/sub_heartflow.py
+++ b/src/chat/heart_flow/sub_heartflow.py
@@ -78,18 +78,13 @@ class SubHeartflow:
logger.debug(
f"SubHeartflow {self.chat_id} initialized: is_group={self.is_group_chat}, target_info={self.chat_target_info}"
)
- # --- End using utility function ---
-
- # Initialize interest system (existing logic)
- # await self.interest_chatting.initialize()
- # logger.debug(f"{self.log_prefix} InterestChatting 实例已初始化。")
# 根据配置决定初始状态
if global_config.chat.chat_mode == "focus":
- logger.info(f"{self.log_prefix} 配置为 focus 模式,将直接尝试进入 FOCUSED 状态。")
+ logger.debug(f"{self.log_prefix} 配置为 focus 模式,将直接尝试进入 FOCUSED 状态。")
await self.change_chat_state(ChatState.FOCUSED)
else: # "auto" 或其他模式保持原有逻辑或默认为 NORMAL
- logger.info(f"{self.log_prefix} 配置为 auto 或其他模式,将尝试进入 NORMAL 状态。")
+ logger.debug(f"{self.log_prefix} 配置为 auto 或其他模式,将尝试进入 NORMAL 状态。")
await self.change_chat_state(ChatState.NORMAL)
def update_last_chat_state_time(self):
@@ -281,9 +276,9 @@ class SubHeartflow:
self.update_last_chat_state_time()
self.history_chat_state.append((current_state, self.chat_state_last_time))
- logger.info(
- f"{log_prefix} 麦麦的聊天状态从 {current_state.value} (持续了 {int(self.chat_state_last_time)} 秒) 变更为 {new_state.value}"
- )
+ # logger.info(
+ # f"{log_prefix} 麦麦的聊天状态从 {current_state.value} (持续了 {int(self.chat_state_last_time)} 秒) 变更为 {new_state.value}"
+ # )
self.chat_state.chat_status = new_state
self.chat_state_last_time = 0
diff --git a/src/chat/message_receive/message_sender.py b/src/chat/message_receive/message_sender.py
index cf5877989..364a5b6c2 100644
--- a/src/chat/message_receive/message_sender.py
+++ b/src/chat/message_receive/message_sender.py
@@ -223,8 +223,9 @@ class MessageManager:
# f"[message.apply_set_reply_logic:{message.apply_set_reply_logic},message.is_head:{message.is_head},thinking_messages_count:{thinking_messages_count},thinking_messages_length:{thinking_messages_length},message.is_private_message():{message.is_private_message()}]"
# )
if (
- message.apply_set_reply_logic # 检查标记
- and message.is_head
+ # message.apply_set_reply_logic # 检查标记
+ # and message.is_head
+ message.is_head
and (thinking_messages_count > 3 or thinking_messages_length > 200)
and not message.is_private_message()
):
diff --git a/src/chat/normal_chat/normal_chat.py b/src/chat/normal_chat/normal_chat.py
index dc4da2eaf..fba63aa48 100644
--- a/src/chat/normal_chat/normal_chat.py
+++ b/src/chat/normal_chat/normal_chat.py
@@ -39,6 +39,8 @@ class NormalChat:
self.chat_target_info: Optional[dict] = None
self.willing_amplifier = 1
+ self.start_time = time.time()
+
# Other sync initializations
self.gpt = NormalChatGenerator()
@@ -56,6 +58,8 @@ class NormalChat:
self._disabled = False # 增加停用标志
+
+
async def initialize(self):
"""异步初始化,获取聊天类型和目标信息。"""
if self._initialized:
@@ -64,7 +68,7 @@ class NormalChat:
self.is_group_chat, self.chat_target_info = await get_chat_type_and_target_info(self.stream_id)
self.stream_name = chat_manager.get_stream_name(self.stream_id) or self.stream_id
self._initialized = True
- logger.info(f"[{self.stream_name}] NormalChat 实例 initialize 完成 (异步部分)。")
+ logger.debug(f"[{self.stream_name}] NormalChat 初始化完成 (异步部分)。")
# 改为实例方法
async def _create_thinking_message(self, message: MessageRecv, timestamp: Optional[float] = None) -> str:
@@ -208,7 +212,11 @@ class NormalChat:
for msg_id, (message, interest_value, is_mentioned) in items_to_process:
try:
# 处理消息
- self.adjust_reply_frequency()
+ if time.time() - self.start_time > 600:
+ self.adjust_reply_frequency(duration=600/60)
+ else:
+ self.adjust_reply_frequency(duration=(time.time() - self.start_time)/60)
+
await self.normal_response(
message=message,
@@ -256,7 +264,7 @@ class NormalChat:
logger.info(
f"[{mes_name}]"
f"{message.message_info.user_info.user_nickname}:" # 使用 self.chat_stream
- f"{message.processed_plain_text}[回复概率:{reply_probability * 100:.1f}%]"
+ f"{message.processed_plain_text}[兴趣:{interested_rate:.2f}][回复概率:{reply_probability * 100:.1f}%]"
)
do_reply = False
response_set = None # 初始化 response_set
@@ -304,7 +312,7 @@ class NormalChat:
willing_manager.delete(message.message_info.message_id)
return # 不执行后续步骤
- logger.info(f"[{self.stream_name}] 回复内容: {response_set}")
+ # logger.info(f"[{self.stream_name}] 回复内容: {response_set}")
if self._disabled:
logger.info(f"[{self.stream_name}] 已停用,忽略 normal_response。")
@@ -357,7 +365,7 @@ class NormalChat:
trigger_msg = message.processed_plain_text
response_msg = " ".join(response_set)
logger.info(
- f"[{self.stream_name}] 触发消息: {trigger_msg[:20]}... | 推理消息: {response_msg[:20]}... | 性能计时: {timing_str}"
+ f"[{self.stream_name}]回复消息: {trigger_msg[:30]}... | 回复内容: {response_msg[:30]}... | 计时: {timing_str}"
)
elif not do_reply:
# 不回复处理
@@ -376,7 +384,7 @@ class NormalChat:
self._disabled = False # 启动时重置停用标志
if self._chat_task is None or self._chat_task.done():
- logger.info(f"[{self.stream_name}] 开始处理兴趣消息...")
+ # logger.info(f"[{self.stream_name}] 开始处理兴趣消息...")
polling_task = asyncio.create_task(self._reply_interested_message())
polling_task.add_done_callback(lambda t: self._handle_task_completion(t))
self._chat_task = polling_task
@@ -483,21 +491,33 @@ class NormalChat:
调整回复频率
"""
# 获取最近30分钟内的消息统计
- print(f"willing_amplifier: {self.willing_amplifier}")
+
stats = get_recent_message_stats(minutes=duration, chat_id=self.stream_id)
bot_reply_count = stats["bot_reply_count"]
- print(f"[{self.stream_name}] 最近{duration}分钟内回复数量: {bot_reply_count}")
+
total_message_count = stats["total_message_count"]
- print(f"[{self.stream_name}] 最近{duration}分钟内消息总数: {total_message_count}")
+ if total_message_count == 0:
+ return
+ logger.debug(f"[{self.stream_name}]({self.willing_amplifier}) 最近{duration}分钟 回复数量: {bot_reply_count},消息总数: {total_message_count}")
# 计算回复频率
_reply_frequency = bot_reply_count / total_message_count
-
+
+ differ = global_config.normal_chat.talk_frequency - (bot_reply_count / duration)
+
# 如果回复频率低于0.5,增加回复概率
- if bot_reply_count / duration < global_config.normal_chat.talk_frequency:
- # differ = global_config.normal_chat.talk_frequency - reply_frequency
- logger.info(f"[{self.stream_name}] 回复频率低于{global_config.normal_chat.talk_frequency},增加回复概率")
- self.willing_amplifier += 0.1
- else:
- logger.info(f"[{self.stream_name}] 回复频率高于{global_config.normal_chat.talk_frequency},减少回复概率")
- self.willing_amplifier -= 0.1
+ if differ > 0.1:
+ mapped = 1 + (differ - 0.1) * 4 / 0.9
+ mapped = max(1, min(5, mapped))
+ logger.info(f"[{self.stream_name}] 回复频率低于{global_config.normal_chat.talk_frequency},增加回复概率,differ={differ:.3f},映射值={mapped:.2f}")
+ self.willing_amplifier += mapped * 0.1 # 你可以根据实际需要调整系数
+ elif differ < -0.1:
+ mapped = 1 - (differ + 0.1) * 4 / 0.9
+ mapped = max(1, min(5, mapped))
+ logger.info(f"[{self.stream_name}] 回复频率高于{global_config.normal_chat.talk_frequency},减少回复概率,differ={differ:.3f},映射值={mapped:.2f}")
+ self.willing_amplifier -= mapped * 0.1
+
+ if self.willing_amplifier > 5:
+ self.willing_amplifier = 5
+ elif self.willing_amplifier < 0.1:
+ self.willing_amplifier = 0.1
diff --git a/src/chat/normal_chat/normal_chat_generator.py b/src/chat/normal_chat/normal_chat_generator.py
index 2ad1a1975..28df6f189 100644
--- a/src/chat/normal_chat/normal_chat_generator.py
+++ b/src/chat/normal_chat/normal_chat_generator.py
@@ -11,7 +11,7 @@ from src.chat.utils.info_catcher import info_catcher_manager
from src.person_info.person_info import person_info_manager
-logger = get_logger("llm")
+logger = get_logger("normal_chat_response")
class NormalChatGenerator:
@@ -40,25 +40,25 @@ class NormalChatGenerator:
"""根据当前模型类型选择对应的生成函数"""
# 从global_config中获取模型概率值并选择模型
if random.random() < global_config.normal_chat.normal_chat_first_probability:
- self.current_model_type = "深深地"
current_model = self.model_reasoning
+ self.current_model_name = current_model.model_name
else:
- self.current_model_type = "浅浅的"
current_model = self.model_normal
+ self.current_model_name = current_model.model_name
logger.info(
- f"{self.current_model_type}思考:{message.processed_plain_text[:30] + '...' if len(message.processed_plain_text) > 30 else message.processed_plain_text}"
+ f"{self.current_model_name}思考:{message.processed_plain_text[:30] + '...' if len(message.processed_plain_text) > 30 else message.processed_plain_text}"
) # noqa: E501
model_response = await self._generate_response_with_model(message, current_model, thinking_id)
if model_response:
- logger.info(f"{global_config.bot.nickname}的回复是:{model_response}")
+ logger.debug(f"{global_config.bot.nickname}的原始回复是:{model_response}")
model_response = await self._process_response(model_response)
return model_response
else:
- logger.info(f"{self.current_model_type}思考,失败")
+ logger.info(f"{self.current_model_name}思考,失败")
return None
async def _generate_response_with_model(self, message: MessageThinking, model: LLMRequest, thinking_id: str):
diff --git a/src/chat/utils/info_catcher.py b/src/chat/utils/info_catcher.py
index bbc85dd47..27bf2b8cb 100644
--- a/src/chat/utils/info_catcher.py
+++ b/src/chat/utils/info_catcher.py
@@ -100,7 +100,7 @@ class InfoCatcher:
time_end = message_end.message_info.time
chat_id = message_start.chat_stream.stream_id
- print(f"查询参数: time_start={time_start}, time_end={time_end}, chat_id={chat_id}")
+ # print(f"查询参数: time_start={time_start}, time_end={time_end}, chat_id={chat_id}")
messages_between_query = (
Messages.select()
@@ -109,10 +109,10 @@ class InfoCatcher:
)
result = list(messages_between_query)
- print(f"查询结果数量: {len(result)}")
- if result:
- print(f"第一条消息时间: {result[0].time}")
- print(f"最后一条消息时间: {result[-1].time}")
+ # print(f"查询结果数量: {len(result)}")
+ # if result:
+ # print(f"第一条消息时间: {result[0].time}")
+ # print(f"最后一条消息时间: {result[-1].time}")
return result
except Exception as e:
print(f"获取消息时出错: {str(e)}")
diff --git a/src/common/logger.py b/src/common/logger.py
index 7258d6193..905fb0ef5 100644
--- a/src/common/logger.py
+++ b/src/common/logger.py
@@ -225,19 +225,19 @@ SCHEDULE_STYLE_CONFIG = {
},
}
-LLM_STYLE_CONFIG = {
+NORMAL_CHAT_RESPONSE_STYLE_CONFIG = {
"advanced": {
"console_format": (
"{time:YYYY-MM-DD HH:mm:ss} | "
"{level: <8} | "
- "麦麦组织语言 | "
+ "普通聊天回复 | "
"{message}"
),
- "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 麦麦组织语言 | {message}",
+ "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 普通聊天回复 | {message}",
},
"simple": {
- "console_format": "{time:HH:mm:ss} | 麦麦组织语言 | {message}",
- "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 麦麦组织语言 | {message}",
+ "console_format": "{time:HH:mm:ss} | 普通聊天回复 | {message}",
+ "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 普通聊天回复 | {message}",
},
}
@@ -282,14 +282,14 @@ NORMAL_CHAT_STYLE_CONFIG = {
"console_format": (
"{time:YYYY-MM-DD HH:mm:ss} | "
"{level: <8} | "
- "一般水群 | "
+ "普通水群 | "
"{message}"
),
- "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 一般水群 | {message}",
+ "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 普通水群 | {message}",
},
"simple": {
- "console_format": "{time:HH:mm:ss} | 一般水群 | {message}", # noqa: E501
- "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 一般水群 | {message}",
+ "console_format": "{time:HH:mm:ss} | 普通水群 | {message}", # noqa: E501
+ "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 普通水群 | {message}",
},
}
@@ -310,6 +310,8 @@ FOCUS_CHAT_STYLE_CONFIG = {
},
}
+
+
REMOTE_STYLE_CONFIG = {
"advanced": {
"console_format": (
@@ -530,19 +532,19 @@ EMOJI_STYLE_CONFIG = {
},
}
-MAI_STATE_CONFIG = {
+STATISTIC_STYLE_CONFIG = {
"advanced": {
"console_format": (
"{time:YYYY-MM-DD HH:mm:ss} | "
"{level: <8} | "
- "麦麦状态 | "
+ "麦麦统计 | "
"{message}"
),
- "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 麦麦状态 | {message}",
+ "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 麦麦统计 | {message}",
},
"simple": {
- "console_format": "{time:HH:mm:ss} | 麦麦状态 | {message} ", # noqa: E501
- "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 麦麦状态 | {message}",
+ "console_format": "{time:HH:mm:ss} | 麦麦统计 | {message} ", # noqa: E501
+ "file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 麦麦统计 | {message}",
},
}
@@ -906,7 +908,9 @@ MEMORY_STYLE_CONFIG = MEMORY_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else MEMORY
CHAT_STREAM_STYLE_CONFIG = CHAT_STREAM_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else CHAT_STREAM_STYLE_CONFIG["advanced"]
TOPIC_STYLE_CONFIG = TOPIC_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else TOPIC_STYLE_CONFIG["advanced"]
SENDER_STYLE_CONFIG = SENDER_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else SENDER_STYLE_CONFIG["advanced"]
-LLM_STYLE_CONFIG = LLM_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else LLM_STYLE_CONFIG["advanced"]
+NORMAL_CHAT_RESPONSE_STYLE_CONFIG = (
+ NORMAL_CHAT_RESPONSE_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else NORMAL_CHAT_RESPONSE_STYLE_CONFIG["advanced"]
+)
CHAT_STYLE_CONFIG = CHAT_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else CHAT_STYLE_CONFIG["advanced"]
MOOD_STYLE_CONFIG = MOOD_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else MOOD_STYLE_CONFIG["advanced"]
RELATION_STYLE_CONFIG = RELATION_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else RELATION_STYLE_CONFIG["advanced"]
@@ -919,7 +923,7 @@ SUB_HEARTFLOW_MIND_STYLE_CONFIG = (
SUB_HEARTFLOW_MIND_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else SUB_HEARTFLOW_MIND_STYLE_CONFIG["advanced"]
)
WILLING_STYLE_CONFIG = WILLING_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else WILLING_STYLE_CONFIG["advanced"]
-MAI_STATE_CONFIG = MAI_STATE_CONFIG["simple"] if SIMPLE_OUTPUT else MAI_STATE_CONFIG["advanced"]
+STATISTIC_STYLE_CONFIG = STATISTIC_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else STATISTIC_STYLE_CONFIG["advanced"]
CONFIG_STYLE_CONFIG = CONFIG_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else CONFIG_STYLE_CONFIG["advanced"]
TOOL_USE_STYLE_CONFIG = TOOL_USE_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else TOOL_USE_STYLE_CONFIG["advanced"]
PFC_STYLE_CONFIG = PFC_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else PFC_STYLE_CONFIG["advanced"]
diff --git a/src/common/logger_manager.py b/src/common/logger_manager.py
index 523059313..185944881 100644
--- a/src/common/logger_manager.py
+++ b/src/common/logger_manager.py
@@ -9,7 +9,6 @@ from src.common.logger import (
RELATION_STYLE_CONFIG,
CONFIG_STYLE_CONFIG,
HEARTFLOW_STYLE_CONFIG,
- LLM_STYLE_CONFIG,
CHAT_STYLE_CONFIG,
EMOJI_STYLE_CONFIG,
SUB_HEARTFLOW_STYLE_CONFIG,
@@ -20,7 +19,7 @@ from src.common.logger import (
PERSON_INFO_STYLE_CONFIG,
WILLING_STYLE_CONFIG,
PFC_ACTION_PLANNER_STYLE_CONFIG,
- MAI_STATE_CONFIG,
+ STATISTIC_STYLE_CONFIG,
NORMAL_CHAT_STYLE_CONFIG,
FOCUS_CHAT_STYLE_CONFIG,
LPMM_STYLE_CONFIG,
@@ -47,6 +46,7 @@ from src.common.logger import (
INIT_STYLE_CONFIG,
INTEREST_CHAT_STYLE_CONFIG,
API_SERVER_STYLE_CONFIG,
+ NORMAL_CHAT_RESPONSE_STYLE_CONFIG,
)
# 可根据实际需要补充更多模块配置
@@ -60,7 +60,7 @@ MODULE_LOGGER_CONFIGS = {
"relation": RELATION_STYLE_CONFIG, # 关系
"config": CONFIG_STYLE_CONFIG, # 配置
"heartflow": HEARTFLOW_STYLE_CONFIG, # 麦麦大脑袋
- "llm": LLM_STYLE_CONFIG, # 麦麦组织语言
+ "normal_chat_response": NORMAL_CHAT_RESPONSE_STYLE_CONFIG, # 麦麦组织语言
"chat": CHAT_STYLE_CONFIG, # 见闻
"emoji": EMOJI_STYLE_CONFIG, # 表情包
"sub_heartflow": SUB_HEARTFLOW_STYLE_CONFIG, # 麦麦水群
@@ -71,7 +71,7 @@ MODULE_LOGGER_CONFIGS = {
"person_info": PERSON_INFO_STYLE_CONFIG, # 人物信息
"willing": WILLING_STYLE_CONFIG, # 意愿
"pfc_action_planner": PFC_ACTION_PLANNER_STYLE_CONFIG, # PFC私聊规划
- "mai_state": MAI_STATE_CONFIG, # 麦麦状态
+ "statistic": STATISTIC_STYLE_CONFIG, # 麦麦统计
"lpmm": LPMM_STYLE_CONFIG, # LPMM
"hfc": HFC_STYLE_CONFIG, # HFC
"observation": OBSERVATION_STYLE_CONFIG, # 聊天观察
diff --git a/src/main.py b/src/main.py
index d55d74f0f..a7dd406cc 100644
--- a/src/main.py
+++ b/src/main.py
@@ -45,7 +45,7 @@ class MainSystem:
# 其他初始化任务
await asyncio.gather(self._init_components())
- logger.success("系统初始化完成")
+ logger.debug("系统初始化完成")
async def _init_components(self):
"""初始化其他组件"""
@@ -73,7 +73,7 @@ class MainSystem:
await async_task_manager.add_task(MoodPrintTask())
# 检查并清除person_info冗余字段,启动个人习惯推断
- await person_info_manager.del_all_undefined_field()
+ # await person_info_manager.del_all_undefined_field()
asyncio.create_task(person_info_manager.personal_habit_deduction())
# 启动愿望管理器
diff --git a/src/manager/async_task_manager.py b/src/manager/async_task_manager.py
index 720e918a9..e198d0e10 100644
--- a/src/manager/async_task_manager.py
+++ b/src/manager/async_task_manager.py
@@ -103,7 +103,7 @@ class AsyncTaskManager:
) # 添加完成回调函数-用户自定义,或默认的FallBack
self.tasks[task.task_name] = task_inst # 将任务添加到任务列表
- logger.info(f"已启动任务 '{task.task_name}'")
+ logger.debug(f"已启动任务 '{task.task_name}'")
def get_tasks_status(self) -> Dict[str, Dict[str, str]]:
"""
diff --git a/src/person_info/person_info.py b/src/person_info/person_info.py
index 80edc4db0..b06820786 100644
--- a/src/person_info/person_info.py
+++ b/src/person_info/person_info.py
@@ -425,13 +425,13 @@ class PersonInfoManager:
return result
- @staticmethod
- async def del_all_undefined_field():
- """删除所有项里的未定义字段 - 对于Peewee (SQL),此操作通常不适用,因为模式是固定的。"""
- logger.info(
- "del_all_undefined_field: 对于使用Peewee的SQL数据库,此操作通常不适用或不需要,因为表结构是预定义的。"
- )
- return
+ # @staticmethod
+ # async def del_all_undefined_field():
+ # """删除所有项里的未定义字段 - 对于Peewee (SQL),此操作通常不适用,因为模式是固定的。"""
+ # logger.info(
+ # "del_all_undefined_field: 对于使用Peewee的SQL数据库,此操作通常不适用或不需要,因为表结构是预定义的。"
+ # )
+ # return
@staticmethod
async def get_specific_value_list(
diff --git a/src/person_info/relationship_manager.py b/src/person_info/relationship_manager.py
index 37f75955f..6e9a4cb91 100644
--- a/src/person_info/relationship_manager.py
+++ b/src/person_info/relationship_manager.py
@@ -56,14 +56,14 @@ class RelationshipManager:
self.positive_feedback_value = 0
if abs(self.positive_feedback_value) > 1:
- logger.info(f"触发mood变更增益,当前增益系数:{self.gain_coefficient[abs(self.positive_feedback_value)]}")
+ logger.debug(f"触发mood变更增益,当前增益系数:{self.gain_coefficient[abs(self.positive_feedback_value)]}")
def mood_feedback(self, value):
"""情绪反馈"""
mood_manager = self.mood_manager
mood_gain = mood_manager.current_mood.valence**2 * math.copysign(1, value * mood_manager.current_mood.valence)
value += value * mood_gain
- logger.info(f"当前relationship增益系数:{mood_gain:.3f}")
+ logger.debug(f"当前relationship增益系数:{mood_gain:.3f}")
return value
def feedback_to_mood(self, mood_value):