feat(affinity-flow): 调整回复概率参数和评分计算

- 增加最大不回复次数至15次,降低每次不回复的概率提升至1%
- 在最终评分计算中增加1.15倍系数提升
- 被提及时的基础分数从1.0提升至3.0
- 为兴趣标签保存添加数据库验证机制
- 在消息处理流程中增加数据库存储功能
- 修复JSON解析错误处理,增加异常情况下的默认响应
- 优化数据库会话管理和模型转换的健壮性
This commit is contained in:
Windpicker-owo
2025-09-17 13:37:57 +08:00
parent 974de4d25d
commit 553739f2cd
8 changed files with 43 additions and 12 deletions

View File

@@ -611,6 +611,19 @@ class BotInterestManager:
logger.info("✅ 兴趣标签已成功保存到数据库")
# 验证保存是否成功
with get_db_session() as session:
saved_record = session.query(DBBotPersonalityInterests).filter(
DBBotPersonalityInterests.personality_id == interests.personality_id
).first()
session.commit()
if saved_record:
logger.info(f"✅ 验证成功数据库中存在personality_id为 {interests.personality_id} 的记录")
logger.info(f" 版本: {saved_record.version}")
logger.info(f" 最后更新: {saved_record.last_updated}")
else:
logger.error(f"❌ 验证失败数据库中未找到personality_id为 {interests.personality_id} 的记录")
except Exception as e:
logger.error(f"❌ 保存兴趣标签到数据库失败: {e}")
logger.error("🔍 错误详情:")