From 2ab60068f856b66c2b6c0cd02ace4fd64864948a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 May 2025 04:27:16 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20=E8=87=AA=E5=8A=A8=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/PFC/pfc_relationship.py | 9 ++++++--- src/plugins/PFC/pfc_utils.py | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/PFC/pfc_relationship.py b/src/plugins/PFC/pfc_relationship.py index fb6e96aa..3ebc0c1b 100644 --- a/src/plugins/PFC/pfc_relationship.py +++ b/src/plugins/PFC/pfc_relationship.py @@ -139,7 +139,9 @@ class PfcRelationshipUpdater: raw_adjustment_val = self.REL_INCREMENTAL_DEFAULT_CHANGE else: raw_adjustment_val = float(raw_adjustment) - raw_adjustment_val = max(-self.REL_INCREMENTAL_MAX_CHANGE, min(self.REL_INCREMENTAL_MAX_CHANGE, raw_adjustment_val)) + raw_adjustment_val = max( + -self.REL_INCREMENTAL_MAX_CHANGE, min(self.REL_INCREMENTAL_MAX_CHANGE, raw_adjustment_val) + ) except Exception as e: logger.error(f"[私聊][{self.private_name}] 增量关系评估LLM调用或解析失败: {e}") @@ -222,11 +224,12 @@ class PfcRelationshipUpdater: raw_adjustment_val = self.REL_FINAL_DEFAULT_CHANGE else: raw_adjustment_val = float(raw_adjustment) - raw_adjustment_val = max(-self.REL_INCREMENTAL_MAX_CHANGE, min(self.REL_INCREMENTAL_MAX_CHANGE, raw_adjustment_val)) + raw_adjustment_val = max( + -self.REL_INCREMENTAL_MAX_CHANGE, min(self.REL_INCREMENTAL_MAX_CHANGE, raw_adjustment_val) + ) except Exception as e: logger.error(f"[私聊][{self.private_name}] 最终关系评估LLM调用或解析失败: {e}") - adjustment_val = await adjust_relationship_value_nonlinear(current_relationship_value, raw_adjustment_val) new_relationship_value = max(-1000.0, min(1000.0, current_relationship_value + adjustment_val)) diff --git a/src/plugins/PFC/pfc_utils.py b/src/plugins/PFC/pfc_utils.py index 7d0f6695..e4cc39e2 100644 --- a/src/plugins/PFC/pfc_utils.py +++ b/src/plugins/PFC/pfc_utils.py @@ -310,6 +310,7 @@ async def get_person_id(private_name: str, chat_stream: ChatStream): ) return None # 返回 None 表示失败 + async def adjust_relationship_value_nonlinear(self, old_value: float, raw_adjustment: float) -> float: # 限制 old_value 范围 old_value = max(-1000, min(1000, old_value))