pull/978/head 0.6.3-fix4-alpha
SengokuCola 2025-05-18 21:01:11 +08:00
commit 5b1c13d041
6 changed files with 7 additions and 17 deletions

View File

@ -33,8 +33,6 @@ class APIBotConfig:
gender: str # 性别 gender: str # 性别
appearance: str # 外貌特征描述 appearance: str # 外貌特征描述
# platforms # platforms
platforms: Dict[str, str] # 平台信息 platforms: Dict[str, str] # 平台信息

View File

@ -165,8 +165,6 @@ class BotConfig:
gender: str = "" # 性别 gender: str = "" # 性别
appearance: str = "用几句话描述外貌特征" # 外貌特征 appearance: str = "用几句话描述外貌特征" # 外貌特征
# chat # chat
allow_focus_mode: bool = True # 是否允许专注水群状态 allow_focus_mode: bool = True # 是否允许专注水群状态
@ -365,8 +363,6 @@ class BotConfig:
config.gender = identity_config.get("gender", config.gender) config.gender = identity_config.get("gender", config.gender)
config.appearance = identity_config.get("appearance", config.appearance) config.appearance = identity_config.get("appearance", config.appearance)
def emoji(parent: dict): def emoji(parent: dict):
emoji_config = parent["emoji"] emoji_config = parent["emoji"]
config.EMOJI_CHECK_INTERVAL = emoji_config.get("check_interval", config.EMOJI_CHECK_INTERVAL) config.EMOJI_CHECK_INTERVAL = emoji_config.get("check_interval", config.EMOJI_CHECK_INTERVAL)

View File

@ -161,9 +161,7 @@ class BackgroundTaskManager:
# --- Specific Task Runners --- # # --- Specific Task Runners --- #
async def _run_focus_chat_check_cycle(self, interval: int): async def _run_focus_chat_check_cycle(self, interval: int):
await _run_periodic_loop( await _run_periodic_loop(task_name="Focus Chat Check", interval=interval, task_func=self._focus_chat_check_work)
task_name="Focus Chat Check", interval=interval, task_func=self._focus_chat_check_work
)
async def _run_logging_cycle(self): async def _run_logging_cycle(self):
await _run_periodic_loop( await _run_periodic_loop(

View File

@ -14,6 +14,7 @@ class MaiState(enum.Enum):
NORMAL_CHAT: 正常看手机回复概率较高会进行一些普通聊天和少量的专注水群 NORMAL_CHAT: 正常看手机回复概率较高会进行一些普通聊天和少量的专注水群
FOCUSED_CHAT: 专注水群回复概率极高会进行专注水群和少量的普通聊天 FOCUSED_CHAT: 专注水群回复概率极高会进行专注水群和少量的普通聊天
""" """
NORMAL_CHAT = "正常看手机" NORMAL_CHAT = "正常看手机"
FOCUSED_CHAT = "专心看手机" FOCUSED_CHAT = "专心看手机"

View File

@ -193,8 +193,7 @@ class SubHeartflowManager:
async with self._lock: async with self._lock:
# 筛选出所有FOCUSED状态的子心流 # 筛选出所有FOCUSED状态的子心流
focused_subflows = [ focused_subflows = [
hf for hf in self.subheartflows.values() hf for hf in self.subheartflows.values() if hf.chat_state.chat_status == ChatState.FOCUSED
if hf.chat_state.chat_status == ChatState.FOCUSED
] ]
if not focused_subflows: if not focused_subflows:
@ -211,7 +210,9 @@ class SubHeartflowManager:
# 10%概率随机转回CHAT或者超过时间限制 # 10%概率随机转回CHAT或者超过时间限制
if time_in_state > focus_time_limit or random.random() < 0.2: if time_in_state > focus_time_limit or random.random() < 0.2:
logger.info(f"{log_prefix} {'超过时间限制' if time_in_state > focus_time_limit else '随机'}从专注水群转为普通聊天") logger.info(
f"{log_prefix} {'超过时间限制' if time_in_state > focus_time_limit else '随机'}从专注水群转为普通聊天"
)
await sub_hf.change_chat_state(ChatState.CHAT) await sub_hf.change_chat_state(ChatState.CHAT)
# --- 新增:处理 HFC 无回复回调的专用方法 --- # # --- 新增:处理 HFC 无回复回调的专用方法 --- #
@ -246,9 +247,7 @@ class SubHeartflowManager:
f"[状态转换请求] 尝试将 {stream_name} 转换为 CHAT 后,状态实际为 {final_state.value}" f"[状态转换请求] 尝试将 {stream_name} 转换为 CHAT 后,状态实际为 {final_state.value}"
) )
except Exception as e: except Exception as e:
logger.error( logger.error(f"[状态转换请求] 转换 {stream_name} 到 CHAT 时出错: {e}", exc_info=True)
f"[状态转换请求] 转换 {stream_name} 到 CHAT 时出错: {e}", exc_info=True
)
else: else:
logger.debug(f"[状态转换请求] {stream_name} 已处于 CHAT 状态,无需转换") logger.debug(f"[状态转换请求] {stream_name} 已处于 CHAT 状态,无需转换")

View File

@ -80,8 +80,6 @@ class MainSystem:
self.hippocampus_manager.initialize(global_config=global_config) self.hippocampus_manager.initialize(global_config=global_config)
# await asyncio.sleep(0.5) #防止logger输出飞了 # await asyncio.sleep(0.5) #防止logger输出飞了
# 将bot.py中的chat_bot.message_process消息处理函数注册到api.py的消息处理基类中 # 将bot.py中的chat_bot.message_process消息处理函数注册到api.py的消息处理基类中
self.app.register_message_handler(chat_bot.message_process) self.app.register_message_handler(chat_bot.message_process)