From def7e7a000b12af903e915b9d3adf0e078261c32 Mon Sep 17 00:00:00 2001 From: meng_xi_pan Date: Wed, 16 Apr 2025 11:29:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=BA=A7=E7=94=9F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/willing/mode_mxp.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugins/willing/mode_mxp.py b/src/plugins/willing/mode_mxp.py index f063f6f24..82b5850ae 100644 --- a/src/plugins/willing/mode_mxp.py +++ b/src/plugins/willing/mode_mxp.py @@ -85,9 +85,9 @@ class MxpWillingManager(BaseWillingManager): rel_level = self._get_relationship_level_num(rel_value) self.chat_person_reply_willing[w_info.chat_id][w_info.person_id] += rel_level * 0.05 - now_chat_new_person = self.last_response_person.get(w_info.chat_id, ["", 0]) + now_chat_new_person = self.last_response_person.get(w_info.chat_id, [w_info.person_id, 0]) if now_chat_new_person[0] == w_info.person_id: - if now_chat_new_person[1] < 2: + if now_chat_new_person[1] < 3: now_chat_new_person[1] += 1 else: self.last_response_person[w_info.chat_id] = [w_info.person_id, 0] @@ -101,9 +101,10 @@ class MxpWillingManager(BaseWillingManager): if ( w_info.chat_id in self.last_response_person and self.last_response_person[w_info.chat_id][0] == w_info.person_id + and self.last_response_person[w_info.chat_id][1] ): self.chat_person_reply_willing[w_info.chat_id][w_info.person_id] += self.single_chat_gain * ( - 2 * self.last_response_person[w_info.chat_id][1] + 1 + 2 * self.last_response_person[w_info.chat_id][1] - 1 ) now_chat_new_person = self.last_response_person.get(w_info.chat_id, ["", 0]) if now_chat_new_person[0] != w_info.person_id: @@ -133,16 +134,17 @@ class MxpWillingManager(BaseWillingManager): rel_value = await w_info.person_info_manager.get_value(w_info.person_id, "relationship_value") rel_level = self._get_relationship_level_num(rel_value) current_willing += rel_level * 0.1 - if self.is_debug: + if self.is_debug and rel_level != 0: self.logger.debug(f"关系增益:{rel_level * 0.1}") if ( w_info.chat_id in self.last_response_person and self.last_response_person[w_info.chat_id][0] == w_info.person_id + and self.last_response_person[w_info.chat_id][1] ): current_willing += self.single_chat_gain * (2 * self.last_response_person[w_info.chat_id][1] + 1) if self.is_debug: - self.logger.debug(f"单聊增益:{self.single_chat_gain * (2 * self.last_response_person[w_info.chat_id][1] + 1)}") + self.logger.debug(f"单聊增益:{self.single_chat_gain * (2 * self.last_response_person[w_info.chat_id][1] - 1)}") current_willing += self.chat_fatigue_willing_attenuation.get(w_info.chat_id, 0) if self.is_debug: @@ -222,8 +224,12 @@ class MxpWillingManager(BaseWillingManager): 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] + 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) + ] + self.chat_fatigue_willing_attenuation[chat.stream_id] = - 2 * self.basic_maximum_willing + + def _willing_to_probability(self, willing: float) -> float: """意愿值转化为概率"""