feat(affinity-flow): 使用配置阈值替换硬编码的80%逻辑

将硬编码的80%阈值检查替换为从全局配置读取的`non_reply_action_interest_threshold`参数,提高配置灵活性并统一阈值管理。

- 移除硬编码的阈值计算逻辑
- 使用全局配置中的非回复动作兴趣度阈值
- 更新日志信息和返回理由中的阈值描述
This commit is contained in:
Windpicker-owo
2025-09-19 17:51:38 +08:00
parent 96e4dc2946
commit b905320c07

View File

@@ -137,16 +137,16 @@ class ActionPlanner:
base_threshold = self.interest_scoring.reply_threshold base_threshold = self.interest_scoring.reply_threshold
# 检查兴趣度是否达到阈值的0.8 # 检查兴趣度是否达到阈值的0.8
threshold_requirement = base_threshold * 0.8 non_reply_action_interest_threshold = global_config.affinity_flow.non_reply_action_interest_threshold
if score < threshold_requirement: if score < non_reply_action_interest_threshold:
logger.info(f"❌ 兴趣度不足阈值的80%: {score:.3f} < {threshold_requirement:.3f}直接返回no_action") logger.info(f"❌ 兴趣度不足非回复动作阈值: {score:.3f} < {non_reply_action_interest_threshold:.3f}直接返回no_action")
logger.info(f"📊 最低要求: 阈值({base_threshold:.3f}) × 0.8 = {threshold_requirement:.3f}") logger.info(f"📊 最低要求: {non_reply_action_interest_threshold:.3f}")
# 直接返回 no_action # 直接返回 no_action
from src.common.data_models.info_data_model import ActionPlannerInfo from src.common.data_models.info_data_model import ActionPlannerInfo
no_action = ActionPlannerInfo( no_action = ActionPlannerInfo(
action_type="no_action", action_type="no_action",
reasoning=f"兴趣度评分 {score:.3f} 未达阈值80% {threshold_requirement:.3f}", reasoning=f"兴趣度评分 {score:.3f} 未达阈值 {non_reply_action_interest_threshold:.3f}",
action_data={}, action_data={},
action_message=None, action_message=None,
) )