fix:修复奇异意愿顺序和命名错误问题

This commit is contained in:
SengokuCola
2025-07-16 18:34:38 +08:00
parent 29161dc839
commit d06abc87e2
3 changed files with 16 additions and 9 deletions

View File

@@ -237,7 +237,7 @@ class HeartFChatting:
self.energy_value *= 1.1 / factor
logger.info(f"{self.log_prefix} 麦麦进行了思考,能量值按倍数增加,当前能量值:{self.energy_value}")
else:
self.energy_value += 10 / global_config.chat.focus_value
self.energy_value += 0.1 / global_config.chat.focus_value
logger.info(f"{self.log_prefix} 麦麦没有进行思考,能量值线性增加,当前能量值:{self.energy_value}")
logger.debug(f"{self.log_prefix} 当前能量值:{self.energy_value}")
@@ -465,19 +465,21 @@ class HeartFChatting:
is_mentioned = message_data.get("is_mentioned", False)
interested_rate = message_data.get("interest_value", 0.0) * self.willing_amplifier
self.willing_manager.setup(message_data, self.chat_stream)
reply_probability = await self.willing_manager.get_reply_probability(message_data.get("message_id", ""))
reply_probability = (
1.0 if is_mentioned and global_config.normal_chat.mentioned_bot_inevitable_reply else 0.0
) # 如果被提及且开启了提及必回复则基础概率为1否则需要意愿判断
# 意愿管理器设置当前message信息
self.willing_manager.setup(message_data, self.chat_stream)
# 获取回复概率
# 仅在未被提及或基础概率不为1时查询意愿概率
if reply_probability < 1: # 简化逻辑,如果未提及 (reply_probability 为 0),则获取意愿概率
# is_willing = True
reply_probability = await self.willing_manager.get_reply_probability(message_data.get("message_id", ""))
additional_config = message_data.get("additional_config", {})
if additional_config and "maimcore_reply_probability_gain" in additional_config:
reply_probability += additional_config["maimcore_reply_probability_gain"]
@@ -493,7 +495,9 @@ class HeartFChatting:
talk_frequency = global_config.chat.get_current_talk_frequency(self.stream_id)
reply_probability = talk_frequency * reply_probability
if reply_probability > 0.1:
logger.info(f"[{mes_name}] 当前聊天频率: {talk_frequency:.2f},兴趣值: {interested_rate:.2f},回复概率: {reply_probability * 100:.1f}%")
if reply_probability > 0.05:
logger.info(
f"[{mes_name}]"
f"{message_data.get('user_nickname')}:"

View File

@@ -15,6 +15,7 @@ class ClassicalWillingManager(BaseWillingManager):
await asyncio.sleep(1)
for chat_id in self.chat_reply_willing:
self.chat_reply_willing[chat_id] = max(0.0, self.chat_reply_willing[chat_id] * 0.9)
print(f"[{chat_id}] 回复意愿衰减: {self.chat_reply_willing[chat_id]}")
async def async_task_starter(self):
if self._decay_task is None:
@@ -25,10 +26,12 @@ class ClassicalWillingManager(BaseWillingManager):
chat_id = willing_info.chat_id
current_willing = self.chat_reply_willing.get(chat_id, 0)
print(f"[{chat_id}] 回复意愿: {current_willing}")
interested_rate = willing_info.interested_rate * global_config.normal_chat.response_interested_rate_amplifier
if interested_rate > 0.4:
current_willing += interested_rate - 0.3
if interested_rate > 0.2:
current_willing += interested_rate - 0.2
if willing_info.is_mentioned_bot:
current_willing += 1 if current_willing < 1.0 else 0.05

View File

@@ -105,7 +105,7 @@ class BaseWillingManager(ABC):
is_mentioned_bot=message.get("is_mentioned_bot", False),
is_emoji=message.get("is_emoji", False),
is_picid=message.get("is_picid", False),
interested_rate=message.get("interested_rate", 0),
interested_rate=message.get("interested_value", 0),
)
def delete(self, message_id: str):