From 0bba90b48cb011ef50f8d043ef22de78d5c17239 Mon Sep 17 00:00:00 2001 From: meng_xi_pan Date: Wed, 16 Apr 2025 10:31:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=9D=E5=A7=8B=E8=A1=B0?= =?UTF-8?q?=E5=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/willing/mode_mxp.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/willing/mode_mxp.py b/src/plugins/willing/mode_mxp.py index f2df94288..f063f6f24 100644 --- a/src/plugins/willing/mode_mxp.py +++ b/src/plugins/willing/mode_mxp.py @@ -75,8 +75,6 @@ class MxpWillingManager(BaseWillingManager): self.chat_bot_message_time[w_info.chat_id].append(current_time) if len(self.chat_bot_message_time[w_info.chat_id]) == int(self.fatigue_messages_triggered_num): time_interval = 60 - (current_time - self.chat_bot_message_time[w_info.chat_id].pop(0)) - if w_info.chat_id not in self.chat_fatigue_punishment_list: - self.chat_fatigue_punishment_list[w_info.chat_id] = [] self.chat_fatigue_punishment_list[w_info.chat_id].append([current_time, time_interval * 2]) async def after_generate_reply_handle(self, message_id: str): @@ -99,7 +97,7 @@ class MxpWillingManager(BaseWillingManager): async with self.lock: w_info = self.ongoing_messages[message_id] if w_info.is_mentioned_bot: - self.chat_person_reply_willing[w_info.chat_id][w_info.person_id] += 0.2 + self.chat_person_reply_willing[w_info.chat_id][w_info.person_id] += self.mention_willing_gain / 2.5 if ( w_info.chat_id in self.last_response_person and self.last_response_person[w_info.chat_id][0] == w_info.person_id @@ -216,12 +214,17 @@ class MxpWillingManager(BaseWillingManager): self.ongoing_messages[message.message_info.message_id].person_id, self.chat_reply_willing[chat.stream_id] ) + current_time = time.time() if chat.stream_id not in self.chat_new_message_time: self.chat_new_message_time[chat.stream_id] = [] - self.chat_new_message_time[chat.stream_id].append(time.time()) + self.chat_new_message_time[chat.stream_id].append(current_time) if len(self.chat_new_message_time[chat.stream_id]) > self.number_of_message_storage: self.chat_new_message_time[chat.stream_id].pop(0) + if chat.stream_id not in self.chat_fatigue_punishment_list: + self.chat_fatigue_punishment_list[chat.stream_id] = [current_time, + self.number_of_message_storage * self.basic_maximum_willing / self.expected_replies_per_min * 60] + def _willing_to_probability(self, willing: float) -> float: """意愿值转化为概率""" willing = max(0, willing)