fix(chat): 修复睡眠和情绪系统中的空值和逻辑问题

修复了两个问题:
1.  在睡眠状态下,如果没有设置起床时间,且当天也无法从日程中获取新的起床时间,程序会错误地继续执行后续的唤醒判断逻辑,而不是直接返回并继续睡眠。
2.  在更新情绪状态时,如果消息的`interest_value`为`None`,会导致类型错误。已增加空值检查,将其默认处理为 0.0。
This commit is contained in:
minecraft1024a
2025-10-17 20:04:12 +08:00
parent 02a54fd3c9
commit 9e39d28e80
2 changed files with 15 additions and 12 deletions

View File

@@ -584,6 +584,8 @@ class ChatBot:
if global_config.mood.enable_mood:
# 获取兴趣度用于情绪更新
interest_rate = getattr(message, "interest_value", 0.0)
if interest_rate is None:
interest_rate = 0.0
logger.debug(f"开始更新情绪状态,兴趣度: {interest_rate:.2f}")
# 获取当前聊天的情绪对象并更新情绪状态