修复4个问题:KB未回复诊断日志、微信唤醒bug、exe打包、截屏分目录

1. KB搜索命中但未回复:增加诊断日志记录每个检查步骤的失败原因
2. 微信窗口唤醒bug:增加Win32 API进程枚举兜底+可见窗口直接截图(不要求置前)
3. PyInstaller打包修复:自定义hook-torch.py避免isolated子进程access violation,
   改用onedir模式+CUDA_VISIBLE_DEVICES=""环境变量
4. OCR截屏分平台存放:img/raw/qq/ img/raw/wechat/ img/processed/qq/ img/processed/wechat/
This commit is contained in:
youpaishidifu
2026-08-02 23:44:43 +08:00
parent c853b3e504
commit 30106571d7
2 changed files with 107 additions and 39 deletions
+16
View File
@@ -324,10 +324,26 @@ class MsgBotApp(ctk.CTk):
lines.append(f" 📄 [{title}] (匹配度 {score:.2f})")
lines.append(f" {snippet}")
# 诊断日志:记录自动回复触发条件
if not self.ar.enabled:
lines.append(" ⚠ 自动回复已关闭,不触发回复")
elif answer_score < self.ar.min_score:
lines.append(f" ⚠ 匹配度 {answer_score:.2f} < 阈值 {self.ar.min_score},跳过")
else:
# 检查内容相关性
has_relevance = self.ar._has_content_relevance(msg, results[0][0], answer_score)
if not has_relevance:
heading = results[0][0].get("heading", "")[:40]
lines.append(f" ⚠ 内容相关性检查失败 (heading={heading!r}),跳过")
else:
lines.append(" ✅ 匹配通过,准备发送自动回复")
# 自动回复:队列到主线程执行(daemon 线程不能可靠 SetForegroundWindow)
reply_data = self.ar.get_reply_data(platform, msg, results[0][0], results[0][1])
if reply_data:
self._reply_queue.put(reply_data)
else:
lines.append(" ⚠ get_reply_data 返回 None(重复命中或内部检查失败)")
else:
lines.append(" ❌ 知识库中未找到相关答案")