新增mood与relation的相互反馈
This commit is contained in:
@@ -5,6 +5,7 @@ from dataclasses import dataclass
|
||||
|
||||
from ..config.config import global_config
|
||||
from src.common.logger import get_module_logger, LogConfig, MOOD_STYLE_CONFIG
|
||||
from ..person_info.relationship_manager import relationship_manager
|
||||
|
||||
mood_config = LogConfig(
|
||||
# 使用海马体专用样式
|
||||
@@ -55,15 +56,15 @@ class MoodManager:
|
||||
|
||||
# 情绪词映射表 (valence, arousal)
|
||||
self.emotion_map = {
|
||||
"开心": (0.8, 0.6), # 高愉悦度,中等唤醒度
|
||||
"愤怒": (-0.7, 0.7), # 负愉悦度,高唤醒度
|
||||
"悲伤": (-0.6, 0.3), # 负愉悦度,低唤醒度
|
||||
"惊讶": (0.2, 0.8), # 中等愉悦度,高唤醒度
|
||||
"害羞": (0.5, 0.2), # 中等愉悦度,低唤醒度
|
||||
"平静": (0.0, 0.5), # 中性愉悦度,中等唤醒度
|
||||
"恐惧": (-0.7, 0.6), # 负愉悦度,高唤醒度
|
||||
"厌恶": (-0.4, 0.4), # 负愉悦度,低唤醒度
|
||||
"困惑": (0.0, 0.6), # 中性愉悦度,高唤醒度
|
||||
"开心": (0.21, 0.6),
|
||||
"害羞": (0.15, 0.2),
|
||||
"愤怒": (-0.24, 0.8),
|
||||
"恐惧": (-0.21, 0.7),
|
||||
"悲伤": (-0.21, 0.3),
|
||||
"厌恶": (-0.12, 0.4),
|
||||
"惊讶": (0.06, 0.7),
|
||||
"困惑": (0.0, 0.6),
|
||||
"平静": (0.03, 0.5),
|
||||
}
|
||||
|
||||
# 情绪文本映射表
|
||||
@@ -93,7 +94,7 @@ class MoodManager:
|
||||
cls._instance = MoodManager()
|
||||
return cls._instance
|
||||
|
||||
def start_mood_update(self, update_interval: float = 1.0) -> None:
|
||||
def start_mood_update(self, update_interval: float = 5.0) -> None:
|
||||
"""
|
||||
启动情绪更新线程
|
||||
:param update_interval: 更新间隔(秒)
|
||||
@@ -232,6 +233,8 @@ class MoodManager:
|
||||
|
||||
valence_change, arousal_change = self.emotion_map[emotion]
|
||||
|
||||
valence_change *= relationship_manager.gain_coefficient[relationship_manager.positive_feedback_value]
|
||||
|
||||
# 应用情绪强度
|
||||
valence_change *= intensity
|
||||
arousal_change *= intensity
|
||||
@@ -245,3 +248,4 @@ class MoodManager:
|
||||
self.current_mood.arousal = max(0.0, min(1.0, self.current_mood.arousal))
|
||||
|
||||
self._update_mood_text()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user