补充 ai_auto_response 的完整模型决策日志

变更项:
1. 新增 LLM_RESULT 日志,记录模型输出的 should_reply、reply_mode、topic、reply 预览和原始响应预览。
2. 新增 BLOCKED_REPLY 日志,记录模型原本想回复但被 post_llm_cooldown、过期、覆盖或重复回复拦下的具体原因。
3. 保留原有 SKIP 与 SENT 日志,使模型判定、发送阻断和最终发出三段链路可以串起来排查。
This commit is contained in:
liuwei
2026-04-28 17:51:10 +08:00
parent 348353fe8c
commit ec29bc7551
2 changed files with 81 additions and 0 deletions

View File

@@ -76,6 +76,31 @@ def build_log_summary(event: str, data: Dict[str, Any]) -> str:
f"err={data.get('last_error', '')}"
).strip()
if event == "llm_result":
return (
f"[XIAONIU] LLM_RESULT room={room} user={sender} "
f"trigger={data.get('trigger_type', 'none')} "
f"want={yn(data.get('should_reply'))} "
f"mode={data.get('reply_mode', '')} "
f"topic={data.get('topic', '-') or '-'} "
f"reply={data.get('response_preview', '')} "
f"raw={data.get('raw_response_preview', '')}"
).strip()
if event == "blocked_reply":
age_text = ""
if data.get("age_sec") not in (None, ""):
age_text = f" age={data.get('age_sec')}"
return (
f"[XIAONIU] BLOCKED_REPLY room={room} user={sender} "
f"reason={data.get('reason', '')} "
f"trigger={data.get('trigger_type', 'none')} "
f"mode={data.get('reply_mode', '')} "
f"topic={data.get('topic', '-') or '-'} "
f"reply={data.get('response_preview', '')}"
f"{age_text}"
).strip()
if event == "sent":
return (
f"[XIAONIU] SENT room={room} user={sender_name}/{sender} "