mirror of https://github.com/Mai-with-u/MaiBot.git
🤖 自动格式化代码 [skip ci]
parent
e5b2e2a5ee
commit
2ab60068f8
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in New Issue