fix: 微信颜色检测放宽+KB精确匹配+自动回复重试

1. monitor.py - 微信白色气泡检测阈值放宽(>=245->>=240, >=3->>=2)
   适配新版微信UI颜色变化,减少漏检
2. knowledge_base.py - 精确短语匹配(5x加分)+子串匹配(2.5x/1.5x)
   防止查询被不相关文档抢走高分
3. gui.py - 自动回复发送失败重试(3次/5秒间隔)
   连续失败退避本轮,避免反复抢焦点
4. .gitignore - 补充build目录下的证书/构建产物
@
This commit is contained in:
youpaishidifu
2026-08-03 16:42:21 +08:00
parent 708bcbf315
commit c6c8cc0571
4 changed files with 52 additions and 14 deletions
+17
View File
@@ -317,6 +317,23 @@ class KnowledgeBase:
combined_scores[i] *= 1.3
elif body_hits >= 1:
combined_scores[i] *= 1.1
# ⭐ 精确短语匹配:文档包含完整查询短语 → 巨幅奖励
# 防止"php端的管理员密码"匹配到不含"php"的云背包文档
full_text = heading + " " + body
if query_stripped in full_text:
combined_scores[i] *= 5.0
elif len(query_stripped) >= 4:
# 2字以上子串匹配:如"php端"、"管理员密码"
sub_hits = 0
for qlen in range(min(len(query_stripped), 6), 3, -1):
for start in range(len(query_stripped) - qlen + 1):
phrase = query_stripped[start:start+qlen]
if phrase in full_text:
sub_hits += 1
if sub_hits >= 2:
combined_scores[i] *= 2.5
elif sub_hits == 1:
combined_scores[i] *= 1.5
# 短查询惩罚:分词数 ≤2 的短查询(如图标残片/短词)得分大幅降权
# 防止 OCR 碎片中的高 IDF 词(如"下载")获得超过真实用户消息的分数