fix:彻底修复傻逼willing问题
This commit is contained in:
@@ -462,28 +462,22 @@ 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信息
|
||||
|
||||
|
||||
# 获取回复概率
|
||||
# 仅在未被提及或基础概率不为1时查询意愿概率
|
||||
if reply_probability < 1: # 简化逻辑,如果未提及 (reply_probability 为 0),则获取意愿概率
|
||||
# is_willing = True
|
||||
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"]
|
||||
reply_probability = min(max(reply_probability, 0), 1) # 确保概率在 0-1 之间
|
||||
|
||||
talk_frequency = global_config.chat.get_current_talk_frequency(self.stream_id)
|
||||
reply_probability = talk_frequency * reply_probability
|
||||
|
||||
# 处理表情包
|
||||
if message_data.get("is_emoji") or message_data.get("is_picid"):
|
||||
@@ -491,9 +485,6 @@ class HeartFChatting:
|
||||
|
||||
# 打印消息信息
|
||||
mes_name = self.chat_stream.group_info.group_name if self.chat_stream.group_info else "私聊"
|
||||
|
||||
talk_frequency = global_config.chat.get_current_talk_frequency(self.stream_id)
|
||||
reply_probability = talk_frequency * reply_probability
|
||||
|
||||
logger.info(f"[{mes_name}] 当前聊天频率: {talk_frequency:.2f},兴趣值: {interested_rate:.2f},回复概率: {reply_probability * 100:.1f}%")
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ 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:
|
||||
@@ -29,16 +28,22 @@ class ClassicalWillingManager(BaseWillingManager):
|
||||
print(f"[{chat_id}] 回复意愿: {current_willing}")
|
||||
|
||||
interested_rate = willing_info.interested_rate * global_config.normal_chat.response_interested_rate_amplifier
|
||||
|
||||
print(f"[{chat_id}] 兴趣值: {interested_rate}")
|
||||
|
||||
if interested_rate > 0.2:
|
||||
current_willing += interested_rate - 0.2
|
||||
|
||||
if willing_info.is_mentioned_bot:
|
||||
if willing_info.is_mentioned_bot and global_config.normal_chat.mentioned_bot_inevitable_reply and current_willing < 2:
|
||||
current_willing += 1 if current_willing < 1.0 else 0.05
|
||||
|
||||
self.chat_reply_willing[chat_id] = min(current_willing, 3.0)
|
||||
|
||||
return min(max((current_willing - 0.5), 0.01) * 2, 1)
|
||||
self.chat_reply_willing[chat_id] = min(current_willing, 1.0)
|
||||
|
||||
reply_probability = min(max((current_willing - 0.5), 0.01) * 2, 1)
|
||||
|
||||
print(f"[{chat_id}] 回复概率: {reply_probability}")
|
||||
|
||||
return reply_probability
|
||||
|
||||
async def before_generate_reply_handle(self, message_id):
|
||||
chat_id = self.ongoing_messages[message_id].chat_id
|
||||
|
||||
@@ -102,13 +102,11 @@ class BaseWillingManager(ABC):
|
||||
chat_id=chat.stream_id,
|
||||
person_id=person_id,
|
||||
group_info=chat.group_info,
|
||||
is_mentioned_bot=message.get("is_mentioned_bot", False),
|
||||
is_mentioned_bot=message.get("is_mentioned", False),
|
||||
is_emoji=message.get("is_emoji", False),
|
||||
is_picid=message.get("is_picid", False),
|
||||
interested_rate=message.get("interest_value", 0),
|
||||
)
|
||||
print(f"[{chat.stream_id}] 兴趣值: {message.get('interest_value', 0)}")
|
||||
print(self.ongoing_messages)
|
||||
|
||||
def delete(self, message_id: str):
|
||||
del_message = self.ongoing_messages.pop(message_id, None)
|
||||
|
||||
Reference in New Issue
Block a user