diff --git a/interest_monitor_gui.py b/interest_monitor_gui.py index 97536f701..0dd2eeed6 100644 --- a/interest_monitor_gui.py +++ b/interest_monitor_gui.py @@ -214,7 +214,8 @@ class InterestMonitorApp: interest_level = subflow_entry.get("interest_level") # 获取 group_name,如果不存在则回退到 stream_id group_name = subflow_entry.get("group_name", stream_id) - reply_probability = subflow_entry.get("reply_probability") # 获取概率值 + # reply_probability = subflow_entry.get("reply_probability") # 获取概率值 # <-- 注释掉旧行 + start_hfc_probability = subflow_entry.get("start_hfc_probability") # <-- 添加新行,读取新字段 # *** 检查必要的字段 *** # 注意:时间戳已在顶层检查过 @@ -252,10 +253,12 @@ class InterestMonitorApp: new_stream_history[stream_id].append((entry_timestamp, interest_level_float)) # 添加概率数据点 (如果存在且有效) - if reply_probability is not None: + # if reply_probability is not None: # <-- 注释掉旧判断 + if start_hfc_probability is not None: # <-- 修改判断条件 try: # 尝试将概率转换为浮点数 - probability_float = float(reply_probability) + # probability_float = float(reply_probability) # <-- 注释掉旧转换 + probability_float = float(start_hfc_probability) # <-- 使用新变量 new_probability_history[stream_id].append((entry_timestamp, probability_float)) except (TypeError, ValueError): # 如果概率值无效,可以跳过或记录一个默认值,这里跳过 @@ -410,13 +413,13 @@ class InterestMonitorApp: # 设置子图标题和标签 self.ax_single_interest.set_title("兴趣度") - self.ax_single_interest.set_ylabel("兴趣度") - self.ax_single_interest.grid(True) self.ax_single_interest.set_ylim(0, 10) # 固定 Y 轴范围 0-10 - self.ax_single_probability.set_title("回复评估概率") + # self.ax_single_probability.set_title("回复评估概率") # <-- 注释掉旧标题 + self.ax_single_probability.set_title("HFC 启动概率") # <-- 修改标题 self.ax_single_probability.set_xlabel("时间") - self.ax_single_probability.set_ylabel("概率") + # self.ax_single_probability.set_ylabel("概率") # <-- 注释掉旧标签 + self.ax_single_probability.set_ylabel("HFC 概率") # <-- 修改 Y 轴标签 self.ax_single_probability.grid(True) self.ax_single_probability.set_ylim(0, 1.05) # 固定 Y 轴范围 0-1 self.ax_single_probability.xaxis.set_major_formatter(mdates.DateFormatter("%H:%M:%S")) diff --git a/src/heart_flow/interest_logger.py b/src/heart_flow/interest_logger.py index 866ae4e01..05a7da39d 100644 --- a/src/heart_flow/interest_logger.py +++ b/src/heart_flow/interest_logger.py @@ -136,10 +136,8 @@ class InterestLogger: "sub_mind": state.get("current_mind", "未知"), "sub_chat_state": state.get("chat_state", "未知"), "interest_level": interest_state.get("interest_level", 0.0), - "reply_probability": interest_state.get("current_reply_probability", 0.0), + "start_hfc_probability": interest_state.get("start_hfc_probability", 0.0), "is_above_threshold": interest_state.get("is_above_threshold", False), - "last_active_time": state.get("last_active_time", 0.0), - "last_interaction_time": interest_state.get("last_interaction_time", 0.0), } subflow_details.append(subflow_entry) diff --git a/src/heart_flow/mai_state_manager.py b/src/heart_flow/mai_state_manager.py index 5048ff080..1d309512a 100644 --- a/src/heart_flow/mai_state_manager.py +++ b/src/heart_flow/mai_state_manager.py @@ -13,6 +13,11 @@ mai_state_config = LogConfig( logger = get_module_logger("mai_state_manager", config=mai_state_config) + +enable_unlimited_hfc_chat = False + + + class MaiState(enum.Enum): """ 聊天状态: @@ -28,6 +33,11 @@ class MaiState(enum.Enum): FOCUSED_CHAT = "专心聊天" def get_normal_chat_max_num(self): + # 调试用 + if enable_unlimited_hfc_chat: + return 1000 + + if self == MaiState.OFFLINE: return 0 elif self == MaiState.PEEKING: @@ -38,6 +48,10 @@ class MaiState(enum.Enum): return 2 def get_focused_chat_max_num(self): + # 调试用 + if enable_unlimited_hfc_chat: + return 1000 + if self == MaiState.OFFLINE: return 0 elif self == MaiState.PEEKING: @@ -125,11 +139,11 @@ class MaiStateManager: if current_status == MaiState.OFFLINE: logger.info("当前[离线],没看手机,思考要不要上线看看......") elif current_status == MaiState.PEEKING: - logger.info("当前[在窥屏],思考要不要继续聊下去......") + logger.info("当前[看一眼],思考要不要继续聊下去......") elif current_status == MaiState.NORMAL_CHAT: - logger.info("当前在[随便看]思考要不要继续聊下去......") + logger.info("当前在[正常聊天]思考要不要继续聊下去......") elif current_status == MaiState.FOCUSED_CHAT: - logger.info("当前在[专心看]思考要不要继续聊下去......") + logger.info("当前在[专心聊天]思考要不要继续聊下去......") # 1. 麦麦每分钟都有概率离线 if time_since_last_min_check >= 60: diff --git a/src/heart_flow/sub_heartflow.py b/src/heart_flow/sub_heartflow.py index d590fb195..68400e837 100644 --- a/src/heart_flow/sub_heartflow.py +++ b/src/heart_flow/sub_heartflow.py @@ -176,10 +176,8 @@ class InterestChatting: interest = self.interest_level # 直接使用属性值 return { "interest_level": round(interest, 2), - "last_update_time": self.last_update_time, - "current_reply_probability": round(self.current_reply_probability, 4), + "start_hfc_probability": round(self.start_hfc_probability, 4), "is_above_threshold": self.is_above_threshold, - "last_interaction_time": self.last_interaction_time, } async def should_evaluate_reply(self) -> bool: