Commit Graph

10 Commits

Author SHA1 Message Date
Windpicker-owo
ac143a1201 迁移:a247be0(ref:彻底合并normal和focus,完全基于planner决定target message) 2025-09-02 16:15:33 +08:00
Windpicker-owo
30e66d5938 Merge branch 'master' of https://github.com/MoFox-Studio/MoFox_Bot 2025-08-31 20:56:35 +08:00
Windpicker-owo
8149731925 修复代码格式和文件名大小写问题 2025-08-31 20:50:17 +08:00
minecraft1024a
d19f211461 refactor(context): 将能量值和睡眠压力状态持久化到数据库
将HFC上下文中的能量值(energy_value)和睡眠压力(sleep_pressure)的状态管理从本地文件存储(local_storage)迁移到主数据库。

这一重构的主要改动包括:
- 在`ChatStreams`数据库模型中添加`energy_value`和`sleep_pressure`字段。
- 更新`ChatStream`类,使其能够加载和保存这两个新字段。
- 移除`HfcContext`中原有的基于`local_storage`的加载和保存逻辑,改为直接通过`ChatStream`实例进行状态读写。
- 在`EnergyManager`中,每当能量或睡眠压力发生变化时,调用`save_context_state()`方法,确保状态能够实时持久化。

此举统一了应用的状态管理方式,提高了数据的可靠性和一致性,并为后续在多实例或分布式环境下部署应用奠定了基础。
2025-08-31 13:32:05 +08:00
minecraft1024a
65fee5458a refactor(energy): 移除is_sleeping方法对wakeup_manager的依赖
将`schedule_manager.is_sleeping`的调用从`is_sleeping(self.context.wakeup_manager)`修改为`is_sleeping()`,以解耦对`wakeup_manager`的直接依赖。

同时,在`napcat_adapter_plugin`中将`enable_plugin`的默认值修改为`False`。
2025-08-29 20:04:05 +08:00
minecraft1024a
a485aaf4ad refactor(config): rename wakeup_system to sleep_system for clarity
This commit refactors the entire "wakeup system" to be named "sleep system". This change provides a more intuitive and accurate name for the functionality, which manages the AI's sleep cycles, sleep pressure, and related behaviors like insomnia and flexible sleep schedules.

The renaming has been applied consistently across all relevant files, including:
- Configuration models (`WakeUpSystemConfig` -> `SleepSystemConfig`)
- Configuration files (`bot_config_template.toml`)
- Core application logic that references these configurations.

Additionally, flexible sleep and pre-sleep notification settings have been moved from the `ScheduleConfig` to the new `SleepSystemConfig` to centralize all sleep-related parameters.
2025-08-29 13:56:24 +08:00
minecraft1024a
ecf2df27fa feat(chat): implement sleep pressure and insomnia system
This commit introduces a new sleep pressure and insomnia system to simulate more realistic character behavior.

Key features include:
- **Sleep Pressure**: A new metric that accumulates with each action the bot takes and decreases during scheduled sleep times.
- **Insomnia Mechanic**: When a sleep period begins, the system checks the current sleep pressure. Low pressure can lead to a higher chance of "insomnia," causing the bot to stay awake. There is also a small chance for random insomnia.
- **Insomnia State**: During insomnia, the bot enters a special state for a configurable duration. It can trigger unique proactive thoughts related to being unable to sleep, and its mood is adjusted accordingly.
- **Configuration**: All parameters, such as insomnia probability, duration, and pressure thresholds, are fully configurable.
2025-08-27 21:02:21 +08:00
minecraft1024a
e3cedd54ff style(chat): 统一 chat_loop 模块 logger 命名并添加业务注释
将各子模块 logger 由 hfc.* 缩减为统一 "hfc"

涉及的子模块:
- cycle_tracker / energy_manager / hfc_utils / proactive_thinker / response_handler
2025-08-21 15:32:57 +08:00
Furina-1013-create
4c51f59c96 为拆分heartFC_chat后的几个文件 添加亿点注释 2025-08-21 14:55:58 +08:00
minecraft1024a
9c3b750328 refactor(chat): 重构HeartFChatting为模块化架构
将原本超长的heartFC_chat.py拆分为6个功能内聚的子模块:
- hfc_context:上下文数据容器
- cycle_tracker:循环状态记录
- energy_manager:能量值独立管理
- proactive_thinker:主动思考逻辑抽离
- cycle_processor:单次循环处理器
- response_handler / normal_mode_handler:响应策略

删除冗余常量、错误样板及旧逻辑;大幅减少类体积;降低耦合度,提升可维护性。
2025-08-21 14:27:12 +08:00