refactor(scoring): 重构评分系统使用统一API替代插件内部实现
将原有的兴趣度评分系统重构为使用统一的评分API,移除了插件内部实现并更新了所有相关引用。主要变更包括: - 替换 chatter_interest_scoring_system 为 scoring_api - 移除 interest_scoring.py 文件,统一使用 src/plugin_system/apis/scoring_api - 更新关系追踪器以使用统一API,保持向后兼容性 - 简化了多个模块中的关系分获取逻辑
This commit is contained in:
@@ -199,16 +199,16 @@ class RelationshipEnergyCalculator(EnergyCalculator):
|
||||
if not user_id:
|
||||
return 0.3
|
||||
|
||||
# 使用插件内部的兴趣度评分系统获取关系分
|
||||
# 使用统一的评分API获取关系分
|
||||
try:
|
||||
from src.plugins.built_in.affinity_flow_chatter.interest_scoring import chatter_interest_scoring_system
|
||||
from src.plugin_system.apis.scoring_api import scoring_api
|
||||
|
||||
relationship_score = await chatter_interest_scoring_system._calculate_relationship_score(user_id)
|
||||
logger.debug(f"使用插件内部系统计算关系分: {relationship_score:.3f}")
|
||||
return max(0.0, min(1.0, relationship_score))
|
||||
relationship_score = await scoring_api.get_user_relationship_score(user_id)
|
||||
logger.debug(f"使用统一评分API计算关系分: {relationship_score:.3f}")
|
||||
return relationship_score
|
||||
|
||||
except Exception as e:
|
||||
logger.warning(f"插件内部关系分计算失败,使用默认值: {e}")
|
||||
logger.warning(f"关系分计算失败,使用默认值: {e}")
|
||||
return 0.3 # 默认基础分
|
||||
|
||||
def get_weight(self) -> float:
|
||||
|
||||
Reference in New Issue
Block a user