feat(affinity-flow): 重构消息处理以使用StreamContext对象
重构AFC消息处理系统,将基于字典的消息数据传递改为直接使用StreamContext对象。主要变更包括: - 修改AFCManager的process_message方法为process_stream_context,直接接收StreamContext对象 - 在chatter中重构消息处理逻辑,直接从StreamContext获取未读和历史消息 - 移除批量消息处理功能,改为单次StreamContext处理 - 在message_manager中简化消息处理流程,直接传递StreamContext对象 - 添加未读消息清理机制,防止异常情况下消息一直未读 同时优化兴趣度评分系统的参数: - 调整回复阈值从0.55到0.56 - 增加最大不回复次数从15到20 - 提升每次不回复的概率增加从0.01到0.02 - 优化提及奖励从3.0降到1.0 - 调整回复后的不回复计数减少从1到3 BREAKING CHANGE: AFCManager的process_message方法已重命名为process_stream_context,参数从message_data改为context对象
This commit is contained in:
@@ -433,9 +433,9 @@ class BotInterestManager:
|
||||
low_similarity_count = 0
|
||||
|
||||
# 分级相似度阈值
|
||||
high_threshold = 0.5
|
||||
medium_threshold = 0.3
|
||||
low_threshold = 0.15
|
||||
high_threshold = 0.55
|
||||
medium_threshold = 0.47
|
||||
low_threshold = 0.3
|
||||
|
||||
logger.debug(f"🔍 使用分级相似度阈值: 高={high_threshold}, 中={medium_threshold}, 低={low_threshold}")
|
||||
|
||||
@@ -449,7 +449,7 @@ class BotInterestManager:
|
||||
# 根据相似度等级应用不同的加成
|
||||
if similarity > high_threshold:
|
||||
# 高相似度:强加成
|
||||
enhanced_score = weighted_score * 1.5
|
||||
enhanced_score = weighted_score * 1.8
|
||||
match_count += 1
|
||||
high_similarity_count += 1
|
||||
result.add_match(tag.tag_name, enhanced_score, [tag.tag_name])
|
||||
@@ -457,7 +457,7 @@ class BotInterestManager:
|
||||
|
||||
elif similarity > medium_threshold:
|
||||
# 中相似度:中等加成
|
||||
enhanced_score = weighted_score * 1.2
|
||||
enhanced_score = weighted_score * 1.4
|
||||
match_count += 1
|
||||
medium_similarity_count += 1
|
||||
result.add_match(tag.tag_name, enhanced_score, [tag.tag_name])
|
||||
@@ -465,7 +465,7 @@ class BotInterestManager:
|
||||
|
||||
elif similarity > low_threshold:
|
||||
# 低相似度:轻微加成
|
||||
enhanced_score = weighted_score * 1.05
|
||||
enhanced_score = weighted_score * 1.15
|
||||
match_count += 1
|
||||
low_similarity_count += 1
|
||||
result.add_match(tag.tag_name, enhanced_score, [tag.tag_name])
|
||||
|
||||
Reference in New Issue
Block a user