refactor(log): 精简聊天相关模块的日志输出
为了提高日志的可读性和实用性,对聊天核心流程(兴趣评分、兴趣系统、规划执行)中的日志记录进行了全面优化。 主要变更: - 移除装饰性的分割线和表情符号,使日志格式更加统一和专业。 - 将多行分散的日志信息合并为单行,提高信息密度,方便快速浏览。 - 调整日志用语,使其更加简洁、客观,便于程序解析和人工阅读。 这些改动旨在使生产环境中的日志更易于追踪和调试,同时保持了关键信息的完整性。
This commit is contained in:
@@ -49,49 +49,36 @@ class InterestScoringSystem:
|
||||
self, messages: List[DatabaseMessages], bot_nickname: str
|
||||
) -> List[InterestScore]:
|
||||
"""计算消息的兴趣度评分"""
|
||||
logger.info("🚀 开始计算消息兴趣度评分...")
|
||||
logger.info(f"📨 收到 {len(messages)} 条消息")
|
||||
|
||||
# 通过 user_id 判断是否是用户消息(非机器人发送的消息)
|
||||
logger.info(f"开始为 {len(messages)} 条消息计算兴趣度...")
|
||||
user_messages = [msg for msg in messages if str(msg.user_info.user_id) != str(global_config.bot.qq_account)]
|
||||
logger.info(f"👤 过滤出 {len(user_messages)} 条用户消息")
|
||||
logger.info(f"正在处理 {len(user_messages)} 条用户消息。")
|
||||
|
||||
scores = []
|
||||
for i, msg in enumerate(user_messages, 1):
|
||||
logger.info(f"📋 [{i}/{len(user_messages)}] 处理消息 ID: {msg.message_id}")
|
||||
logger.debug(f"[{i}/{len(user_messages)}] 处理消息 ID: {msg.message_id}")
|
||||
score = await self._calculate_single_message_score(msg, bot_nickname)
|
||||
scores.append(score)
|
||||
|
||||
logger.info(f"✅ 兴趣度评分计算完成,生成 {len(scores)} 个评分")
|
||||
logger.info(f"兴趣度计算完成,共生成 {len(scores)} 个评分。")
|
||||
return scores
|
||||
|
||||
async def _calculate_single_message_score(self, message: DatabaseMessages, bot_nickname: str) -> InterestScore:
|
||||
"""计算单条消息的兴趣度评分"""
|
||||
logger.info(f"🎯 计算消息 {message.message_id} 的兴趣度评分...")
|
||||
logger.debug(f"📝 消息长度: {len(message.processed_plain_text)} 字符")
|
||||
logger.info(f"计算消息 {message.message_id} 的分数...")
|
||||
logger.debug(f"消息长度: {len(message.processed_plain_text)} 字符")
|
||||
|
||||
# 提取关键词(从数据库的反序列化字段)
|
||||
logger.debug("🔍 提取关键词...")
|
||||
keywords = self._extract_keywords_from_database(message)
|
||||
logger.debug(f"🏷️ 提取到 {len(keywords)} 个关键词")
|
||||
logger.debug(f"提取到 {len(keywords)} 个关键词。")
|
||||
|
||||
# 1. 计算兴趣匹配度(现在是异步的)
|
||||
logger.debug("🧠 计算兴趣匹配度...")
|
||||
interest_match_score = await self._calculate_interest_match_score(message.processed_plain_text, keywords)
|
||||
logger.debug(f"📊 兴趣匹配度: {interest_match_score:.3f}")
|
||||
logger.debug(f"兴趣匹配度: {interest_match_score:.3f}")
|
||||
|
||||
# 2. 计算关系分
|
||||
logger.debug("🤝 计算关系分...")
|
||||
relationship_score = self._calculate_relationship_score(message.user_info.user_id)
|
||||
logger.debug(f"💝 关系分: {relationship_score:.3f}")
|
||||
logger.debug(f"关系分数: {relationship_score:.3f}")
|
||||
|
||||
# 3. 计算提及分数
|
||||
logger.debug("📢 计算提及分数...")
|
||||
mentioned_score = self._calculate_mentioned_score(message, bot_nickname)
|
||||
logger.debug(f"📣 提及分数: {mentioned_score:.3f}")
|
||||
logger.debug(f"提及分数: {mentioned_score:.3f}")
|
||||
|
||||
# 4. 计算总分
|
||||
logger.debug("🧮 计算加权总分...")
|
||||
total_score = (
|
||||
interest_match_score * self.score_weights["interest_match"]
|
||||
+ relationship_score * self.score_weights["relationship"]
|
||||
@@ -99,14 +86,14 @@ class InterestScoringSystem:
|
||||
)
|
||||
|
||||
details = {
|
||||
"interest_match": f"兴趣匹配度: {interest_match_score:.3f}",
|
||||
"relationship": f"关系分: {relationship_score:.3f}",
|
||||
"mentioned": f"提及分数: {mentioned_score:.3f}",
|
||||
"interest_match": f"兴趣匹配: {interest_match_score:.3f}",
|
||||
"relationship": f"关系: {relationship_score:.3f}",
|
||||
"mentioned": f"提及: {mentioned_score:.3f}",
|
||||
}
|
||||
|
||||
logger.info(f"📈 消息 {message.message_id} 最终评分: {total_score:.3f}")
|
||||
logger.debug(f"⚖️ 评分权重: {self.score_weights}")
|
||||
logger.debug(f"📋 评分详情: {details}")
|
||||
logger.info(f"消息 {message.message_id} 最终得分: {total_score:.3f}")
|
||||
logger.debug(f"Score weights: {self.score_weights}")
|
||||
logger.debug(f"Score details: {details}")
|
||||
|
||||
return InterestScore(
|
||||
message_id=message.message_id,
|
||||
@@ -279,59 +266,41 @@ class InterestScoringSystem:
|
||||
|
||||
def should_reply(self, score: InterestScore) -> bool:
|
||||
"""判断是否应该回复"""
|
||||
logger.info("🤔 评估是否应该回复...")
|
||||
logger.debug("📊 评分详情:")
|
||||
logger.debug(f" 📝 消息ID: {score.message_id}")
|
||||
logger.debug(f" 💯 总分: {score.total_score:.3f}")
|
||||
logger.debug(f" 🧠 兴趣匹配: {score.interest_match_score:.3f}")
|
||||
logger.debug(f" 🤝 关系分: {score.relationship_score:.3f}")
|
||||
logger.debug(f" 📢 提及分: {score.mentioned_score:.3f}")
|
||||
|
||||
logger.info(f"评估消息 {score.message_id} (得分: {score.total_score:.3f}) 是否回复...")
|
||||
base_threshold = self.reply_threshold
|
||||
logger.debug(f"📋 基础阈值: {base_threshold:.3f}")
|
||||
|
||||
# 如果被提及,降低阈值
|
||||
if (
|
||||
score.mentioned_score >= global_config.affinity_flow.mention_bot_adjustment_threshold
|
||||
): # 使用提及bot兴趣分的一半作为判断阈值
|
||||
if score.mentioned_score >= global_config.affinity_flow.mention_bot_adjustment_threshold:
|
||||
base_threshold = self.mention_threshold
|
||||
logger.debug(f"📣 消息提及了机器人,使用降低阈值: {base_threshold:.3f}")
|
||||
logger.debug(f"机器人被提及, 使用较低阈值: {base_threshold:.3f}")
|
||||
|
||||
# 计算连续不回复的概率提升
|
||||
probability_boost = min(self.no_reply_count * self.probability_boost_per_no_reply, 0.8)
|
||||
effective_threshold = base_threshold - probability_boost
|
||||
|
||||
logger.debug("📈 连续不回复统计:")
|
||||
logger.debug(f" 🚫 不回复次数: {self.no_reply_count}")
|
||||
logger.debug(f" 📈 概率提升: {probability_boost:.3f}")
|
||||
logger.debug(f" 🎯 有效阈值: {effective_threshold:.3f}")
|
||||
logger.debug(
|
||||
f"基础阈值: {base_threshold:.3f}, 不回复提升: {probability_boost:.3f}, 有效阈值: {effective_threshold:.3f}"
|
||||
)
|
||||
|
||||
# 做出决策
|
||||
score.total_score = score.total_score * 1
|
||||
should_reply = score.total_score >= effective_threshold
|
||||
decision = "✅ 应该回复" if should_reply else "❌ 不回复"
|
||||
|
||||
logger.info(f"🎯 回复决策: {decision}")
|
||||
logger.info(f"📊 决策依据: {score.total_score:.3f} {'>=' if should_reply else '<'} {effective_threshold:.3f}")
|
||||
decision = "✅ 回复" if should_reply else "❌ 不回复"
|
||||
logger.info(f"回复决策: {decision} (分数: {score.total_score:.3f} {' >=' if should_reply else ' <'} 阈值: {effective_threshold:.3f})")
|
||||
|
||||
return should_reply, score.total_score
|
||||
|
||||
def record_reply_action(self, did_reply: bool):
|
||||
"""记录回复动作"""
|
||||
old_count = self.no_reply_count
|
||||
|
||||
if did_reply:
|
||||
self.no_reply_count = max(0, self.no_reply_count - global_config.affinity_flow.reply_cooldown_reduction)
|
||||
action = "✅ reply动作可用"
|
||||
action = "回复"
|
||||
else:
|
||||
self.no_reply_count += 1
|
||||
action = "❌ reply动作不可用"
|
||||
action = "不回复"
|
||||
|
||||
# 限制最大计数
|
||||
self.no_reply_count = min(self.no_reply_count, self.max_no_reply_count)
|
||||
|
||||
logger.info(f"📊 记录回复动作: {action}")
|
||||
logger.info(f"📈 连续不回复次数: {old_count} → {self.no_reply_count}")
|
||||
logger.info(f"记录动作: {action} | 连续不回复次数: {old_count} -> {self.no_reply_count}")
|
||||
logger.debug(f"📋 最大限制: {self.max_no_reply_count} 次")
|
||||
|
||||
def update_user_relationship(self, user_id: str, relationship_change: float):
|
||||
@@ -370,23 +339,22 @@ class InterestScoringSystem:
|
||||
async def initialize_smart_interests(self, personality_description: str, personality_id: str = "default"):
|
||||
"""初始化智能兴趣系统"""
|
||||
try:
|
||||
logger.info("🚀 开始初始化智能兴趣系统...")
|
||||
logger.info(f"📋 人设ID: {personality_id}")
|
||||
logger.info(f"📝 人设描述长度: {len(personality_description)} 字符")
|
||||
logger.info("开始初始化智能兴趣系统...")
|
||||
logger.info(f"人设ID: {personality_id}, 描述长度: {len(personality_description)}")
|
||||
|
||||
await bot_interest_manager.initialize(personality_description, personality_id)
|
||||
logger.info("✅ 智能兴趣系统初始化完成")
|
||||
logger.info("智能兴趣系统初始化完成。")
|
||||
|
||||
# 显示初始化后的统计信息
|
||||
stats = bot_interest_manager.get_interest_stats()
|
||||
logger.info("📊 兴趣系统统计:")
|
||||
logger.info(f" 🏷️ 总标签数: {stats.get('total_tags', 0)}")
|
||||
logger.info(f" 💾 缓存大小: {stats.get('cache_size', 0)}")
|
||||
logger.info(f" 🧠 模型: {stats.get('embedding_model', '未知')}")
|
||||
logger.info(
|
||||
f"兴趣系统统计: 总标签={stats.get('total_tags', 0)}, "
|
||||
f"缓存大小={stats.get('cache_size', 0)}, "
|
||||
f"模型='{stats.get('embedding_model', '未知')}'"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"❌ 初始化智能兴趣系统失败: {e}")
|
||||
logger.error("🔍 错误详情:")
|
||||
logger.error(f"初始化智能兴趣系统失败: {e}")
|
||||
traceback.print_exc()
|
||||
|
||||
def get_matching_config(self) -> Dict[str, Any]:
|
||||
|
||||
@@ -37,22 +37,17 @@ class BotInterestManager:
|
||||
async def initialize(self, personality_description: str, personality_id: str = "default"):
|
||||
"""初始化兴趣标签系统"""
|
||||
try:
|
||||
logger.info("=" * 60)
|
||||
logger.info("🚀 开始初始化机器人兴趣标签系统")
|
||||
logger.info(f"📋 人设ID: {personality_id}")
|
||||
logger.info(f"📝 人设描述长度: {len(personality_description)} 字符")
|
||||
logger.info("=" * 60)
|
||||
logger.info("机器人兴趣系统开始初始化...")
|
||||
logger.info(f"人设ID: {personality_id}, 描述长度: {len(personality_description)}")
|
||||
|
||||
# 初始化embedding模型
|
||||
logger.info("🧠 正在初始化embedding模型...")
|
||||
await self._initialize_embedding_model()
|
||||
|
||||
# 检查embedding客户端是否成功初始化
|
||||
if not self.embedding_request:
|
||||
raise RuntimeError("❌ Embedding客户端初始化失败,无法继续")
|
||||
raise RuntimeError("Embedding客户端初始化失败")
|
||||
|
||||
# 生成或加载兴趣标签
|
||||
logger.info("🎯 正在生成或加载兴趣标签...")
|
||||
await self._load_or_generate_interests(personality_description, personality_id)
|
||||
|
||||
self._initialized = True
|
||||
@@ -60,18 +55,13 @@ class BotInterestManager:
|
||||
# 检查是否成功获取兴趣标签
|
||||
if self.current_interests and len(self.current_interests.get_active_tags()) > 0:
|
||||
active_tags_count = len(self.current_interests.get_active_tags())
|
||||
logger.info("=" * 60)
|
||||
logger.info("✅ 机器人兴趣标签系统初始化完成!")
|
||||
logger.info(f"📊 活跃兴趣标签数量: {active_tags_count}")
|
||||
logger.info(f"💾 Embedding缓存大小: {len(self.embedding_cache)}")
|
||||
logger.info("=" * 60)
|
||||
logger.info("机器人兴趣系统初始化完成!")
|
||||
logger.info(f"当前已激活 {active_tags_count} 个兴趣标签, Embedding缓存 {len(self.embedding_cache)} 个")
|
||||
else:
|
||||
raise RuntimeError("❌ 未能成功生成或加载兴趣标签")
|
||||
raise RuntimeError("未能成功加载或生成兴趣标签")
|
||||
|
||||
except Exception as e:
|
||||
logger.error("=" * 60)
|
||||
logger.error(f"❌ 初始化机器人兴趣标签系统失败: {e}")
|
||||
logger.error("=" * 60)
|
||||
logger.error(f"机器人兴趣系统初始化失败: {e}")
|
||||
traceback.print_exc()
|
||||
raise # 重新抛出异常,不允许降级初始化
|
||||
|
||||
@@ -113,19 +103,19 @@ class BotInterestManager:
|
||||
logger.info(f"📚 正在为 '{personality_id}' 加载或生成兴趣标签...")
|
||||
|
||||
# 首先尝试从数据库加载
|
||||
logger.info("💾 尝试从数据库加载现有兴趣标签...")
|
||||
logger.info("尝试从数据库加载兴趣标签...")
|
||||
loaded_interests = await self._load_interests_from_database(personality_id)
|
||||
|
||||
if loaded_interests:
|
||||
self.current_interests = loaded_interests
|
||||
active_count = len(loaded_interests.get_active_tags())
|
||||
logger.info(f"✅ 成功从数据库加载 {active_count} 个兴趣标签")
|
||||
logger.info(f"📅 最后更新时间: {loaded_interests.last_updated}")
|
||||
logger.info(f"🔄 版本号: {loaded_interests.version}")
|
||||
logger.info(f"成功从数据库加载 {active_count} 个兴趣标签 (版本: {loaded_interests.version})")
|
||||
tags_info = [f" - '{tag.tag_name}' (权重: {tag.weight:.2f})" for tag in loaded_interests.get_active_tags()]
|
||||
tags_str = "\n".join(tags_info)
|
||||
logger.info(f"当前兴趣标签:\n{tags_str}")
|
||||
else:
|
||||
# 生成新的兴趣标签
|
||||
logger.info("🆕 数据库中未找到兴趣标签,开始生成新的...")
|
||||
logger.info("🤖 正在调用LLM生成个性化兴趣标签...")
|
||||
logger.info("数据库中未找到兴趣标签,开始生成...")
|
||||
generated_interests = await self._generate_interests_from_personality(
|
||||
personality_description, personality_id
|
||||
)
|
||||
@@ -133,10 +123,13 @@ class BotInterestManager:
|
||||
if generated_interests:
|
||||
self.current_interests = generated_interests
|
||||
active_count = len(generated_interests.get_active_tags())
|
||||
logger.info(f"✅ 成功生成 {active_count} 个兴趣标签")
|
||||
logger.info(f"成功生成 {active_count} 个新兴趣标签。")
|
||||
tags_info = [f" - '{tag.tag_name}' (权重: {tag.weight:.2f})" for tag in generated_interests.get_active_tags()]
|
||||
tags_str = "\n".join(tags_info)
|
||||
logger.info(f"当前兴趣标签:\n{tags_str}")
|
||||
|
||||
# 保存到数据库
|
||||
logger.info("💾 正在保存兴趣标签到数据库...")
|
||||
logger.info("正在保存至数据库...")
|
||||
await self._save_interests_to_database(generated_interests)
|
||||
else:
|
||||
raise RuntimeError("❌ 兴趣标签生成失败")
|
||||
@@ -411,10 +404,8 @@ class BotInterestManager:
|
||||
if not self.current_interests or not self._initialized:
|
||||
raise RuntimeError("❌ 兴趣标签系统未初始化")
|
||||
|
||||
logger.info("🎯 开始计算兴趣匹配度...")
|
||||
logger.debug(f"💬 消息长度: {len(message_text)} 字符")
|
||||
if keywords:
|
||||
logger.debug(f"🏷️ 关键词数量: {len(keywords)}")
|
||||
logger.info("开始计算兴趣匹配度...")
|
||||
logger.debug(f"消息长度: {len(message_text)}, 关键词: {len(keywords) if keywords else 0}")
|
||||
|
||||
message_id = f"msg_{datetime.now().timestamp()}"
|
||||
result = InterestMatchResult(message_id=message_id)
|
||||
@@ -422,14 +413,14 @@ class BotInterestManager:
|
||||
# 获取活跃的兴趣标签
|
||||
active_tags = self.current_interests.get_active_tags()
|
||||
if not active_tags:
|
||||
raise RuntimeError("❌ 没有活跃的兴趣标签")
|
||||
raise RuntimeError("没有检测到活跃的兴趣标签")
|
||||
|
||||
logger.info(f"📊 有 {len(active_tags)} 个活跃兴趣标签参与匹配")
|
||||
logger.info(f"正在与 {len(active_tags)} 个兴趣标签进行匹配...")
|
||||
|
||||
# 生成消息的embedding
|
||||
logger.debug("🔄 正在生成消息embedding...")
|
||||
logger.debug("正在生成消息 embedding...")
|
||||
message_embedding = await self._get_embedding(message_text)
|
||||
logger.debug(f"✅ 消息embedding生成成功,维度: {len(message_embedding)}")
|
||||
logger.debug(f"消息 embedding 生成成功, 维度: {len(message_embedding)}")
|
||||
|
||||
# 计算与每个兴趣标签的相似度
|
||||
match_count = 0
|
||||
@@ -483,10 +474,12 @@ class BotInterestManager:
|
||||
f" 🏷️ '{tag.tag_name}': 相似度={similarity:.3f}, 权重={tag.weight:.2f}, 基础分数={weighted_score:.3f}, 增强分数={enhanced_score:.3f} [低匹配]"
|
||||
)
|
||||
|
||||
logger.info(f"📈 匹配统计: {match_count}/{len(active_tags)} 个标签超过阈值")
|
||||
logger.info(f"🔥 高相似度匹配(>{high_threshold}): {high_similarity_count} 个")
|
||||
logger.info(f"⚡ 中相似度匹配(>{medium_threshold}): {medium_similarity_count} 个")
|
||||
logger.info(f"🌊 低相似度匹配(>{low_threshold}): {low_similarity_count} 个")
|
||||
logger.info(
|
||||
f"匹配统计: {match_count}/{len(active_tags)} 个标签命中 | "
|
||||
f"高(>{high_threshold}): {high_similarity_count}, "
|
||||
f"中(>{medium_threshold}): {medium_similarity_count}, "
|
||||
f"低(>{low_threshold}): {low_similarity_count}"
|
||||
)
|
||||
|
||||
# 添加直接关键词匹配奖励
|
||||
keyword_bonus = self._calculate_keyword_match_bonus(keywords, result.matched_tags)
|
||||
@@ -509,10 +502,10 @@ class BotInterestManager:
|
||||
if result.matched_tags:
|
||||
top_tag_name = max(result.match_scores.items(), key=lambda x: x[1])[0]
|
||||
result.top_tag = top_tag_name
|
||||
logger.info(f"🏆 最佳匹配标签: '{top_tag_name}' (分数: {result.match_scores[top_tag_name]:.3f})")
|
||||
logger.info(f"最佳匹配: '{top_tag_name}' (分数: {result.match_scores[top_tag_name]:.3f})")
|
||||
|
||||
logger.info(
|
||||
f"📊 最终结果: 总分={result.overall_score:.3f}, 置信度={result.confidence:.3f}, 匹配标签数={len(result.matched_tags)}"
|
||||
f"最终结果: 总分={result.overall_score:.3f}, 置信度={result.confidence:.3f}, 匹配标签数={len(result.matched_tags)}"
|
||||
)
|
||||
return result
|
||||
|
||||
@@ -620,7 +613,7 @@ class BotInterestManager:
|
||||
async def _load_interests_from_database(self, personality_id: str) -> Optional[BotPersonalityInterests]:
|
||||
"""从数据库加载兴趣标签"""
|
||||
try:
|
||||
logger.info(f"💾 正在从数据库加载兴趣标签,personality_id: {personality_id}")
|
||||
logger.debug(f"从数据库加载兴趣标签, personality_id: {personality_id}")
|
||||
|
||||
# 导入SQLAlchemy相关模块
|
||||
from src.common.database.sqlalchemy_models import BotPersonalityInterests as DBBotPersonalityInterests
|
||||
@@ -637,7 +630,7 @@ class BotInterestManager:
|
||||
)
|
||||
|
||||
if db_interests:
|
||||
logger.info(f"✅ 找到数据库中的兴趣标签配置,版本: {db_interests.version}")
|
||||
logger.debug(f"在数据库中找到兴趣标签配置, 版本: {db_interests.version}")
|
||||
logger.debug(f"📅 最后更新时间: {db_interests.last_updated}")
|
||||
logger.debug(f"🧠 使用的embedding模型: {db_interests.embedding_model}")
|
||||
|
||||
@@ -671,7 +664,7 @@ class BotInterestManager:
|
||||
)
|
||||
interests.interest_tags.append(tag)
|
||||
|
||||
logger.info(f"✅ 成功从数据库加载 {len(interests.interest_tags)} 个兴趣标签")
|
||||
logger.debug(f"成功解析 {len(interests.interest_tags)} 个兴趣标签")
|
||||
return interests
|
||||
|
||||
except (orjson.JSONDecodeError, Exception) as e:
|
||||
|
||||
@@ -96,7 +96,7 @@ class PlanExecutor:
|
||||
self.execution_stats["failed_executions"] += len(execution_results) - successful_count
|
||||
|
||||
logger.info(
|
||||
f"动作执行完成: 总数={len(plan.decided_actions)}, 成功={successful_count}, 失败={len(execution_results) - successful_count}"
|
||||
f"规划执行完成: 总数={len(plan.decided_actions)}, 成功={successful_count}, 失败={len(execution_results) - successful_count}"
|
||||
)
|
||||
|
||||
return {
|
||||
@@ -124,7 +124,7 @@ class PlanExecutor:
|
||||
reply_content = ""
|
||||
|
||||
try:
|
||||
logger.info(f"执行回复动作: {action_info.action_type}, 原因: {action_info.reasoning}")
|
||||
logger.info(f"执行回复动作: {action_info.action_type} (原因: {action_info.reasoning})")
|
||||
|
||||
# 获取用户ID - 兼容对象和字典
|
||||
if hasattr(action_info.action_message, "user_info"):
|
||||
@@ -156,7 +156,7 @@ class PlanExecutor:
|
||||
)
|
||||
|
||||
success = True
|
||||
logger.info(f"回复动作执行成功: {action_info.action_type}")
|
||||
logger.info(f"回复动作 '{action_info.action_type}' 执行成功。")
|
||||
|
||||
except Exception as e:
|
||||
error_message = str(e)
|
||||
@@ -214,7 +214,7 @@ class PlanExecutor:
|
||||
error_message = ""
|
||||
|
||||
try:
|
||||
logger.info(f"执行其他动作: {action_info.action_type}, 原因: {action_info.reasoning}")
|
||||
logger.info(f"执行其他动作: {action_info.action_type} (原因: {action_info.reasoning})")
|
||||
|
||||
# 构建动作参数
|
||||
action_params = {
|
||||
@@ -228,7 +228,7 @@ class PlanExecutor:
|
||||
await self.action_manager.execute_action(action_name=action_info.action_type, **action_params)
|
||||
|
||||
success = True
|
||||
logger.info(f"其他动作执行成功: {action_info.action_type}")
|
||||
logger.info(f"其他动作 '{action_info.action_type}' 执行成功。")
|
||||
|
||||
except Exception as e:
|
||||
error_message = str(e)
|
||||
|
||||
@@ -128,7 +128,7 @@ class ActionPlanner:
|
||||
|
||||
reply_not_available = False
|
||||
if not should_reply and "reply" in initial_plan.available_actions:
|
||||
logger.info(f"消息兴趣度不足({latest_score.total_score:.2f}),移除reply动作")
|
||||
logger.info(f"兴趣度不足 ({latest_score.total_score:.2f}),移除'回复'动作。")
|
||||
reply_not_available = True
|
||||
|
||||
# base_threshold = self.interest_scoring.reply_threshold
|
||||
@@ -136,9 +136,8 @@ class ActionPlanner:
|
||||
non_reply_action_interest_threshold = global_config.affinity_flow.non_reply_action_interest_threshold
|
||||
if score < non_reply_action_interest_threshold:
|
||||
logger.info(
|
||||
f"❌ 兴趣度不足非回复动作阈值: {score:.3f} < {non_reply_action_interest_threshold:.3f},直接返回no_action"
|
||||
f"兴趣度 {score:.3f} 低于非回复动作阈值 {non_reply_action_interest_threshold:.3f},不执行任何动作。"
|
||||
)
|
||||
logger.info(f"📊 最低要求: {non_reply_action_interest_threshold:.3f}")
|
||||
# 直接返回 no_action
|
||||
from src.common.data_models.info_data_model import ActionPlannerInfo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user