refactor(chat): 重构主动思考逻辑并将其集成到主聊天循环

将原有的 `ProactiveThinker` 类中的逻辑直接整合进 `HeartFChatting` 类中。此举简化了整体架构,减少了类之间的耦合,并使得主动思考的触发机制与主聊天循环的状态管理更加统一。

主要变更:
- 删除了独立的 `proactive_thinker.py` 文件。
- 将主动思考的监控循环、条件检查、动态间隔计算等功能实现为 `HeartFChatting` 的私有方法。
- 引入了 `ProactiveTriggerEvent` 事件,使触发源更加明确。
- 调整了相关模块的导入路径和配置项的调用方式,以适应新的结构。
This commit is contained in:
minecraft1024a
2025-09-05 20:30:35 +08:00
parent fc68958c8f
commit 488e959577
6 changed files with 255 additions and 367 deletions

View File

@@ -11,6 +11,7 @@ from src.chat.chat_loop.hfc_utils import CycleDetail
if TYPE_CHECKING:
from .wakeup_manager import WakeUpManager
from .energy_manager import EnergyManager
from .heartFC_chat import HeartFChatting
class HfcContext:
@@ -69,7 +70,7 @@ class HfcContext:
# breaking形式下的累积兴趣值
self.breaking_accumulated_interest = 0.0
# 引用HeartFChatting实例以便其他组件可以调用其方法
self.chat_instance = None
self.chat_instance: Optional["HeartFChatting"] = None
def save_context_state(self):
"""将当前状态保存到聊天流"""