refactor(log): 精简聊天相关模块的日志输出
为了提高日志的可读性和实用性,对聊天核心流程(兴趣评分、兴趣系统、规划执行)中的日志记录进行了全面优化。 主要变更: - 移除装饰性的分割线和表情符号,使日志格式更加统一和专业。 - 将多行分散的日志信息合并为单行,提高信息密度,方便快速浏览。 - 调整日志用语,使其更加简洁、客观,便于程序解析和人工阅读。 这些改动旨在使生产环境中的日志更易于追踪和调试,同时保持了关键信息的完整性。
This commit is contained in:
@@ -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