搜索结果显示增强,展示更多匹配详情
This commit is contained in:
@@ -317,13 +317,17 @@ class MsgBotApp(ctk.CTk):
|
||||
answer_title = results[0][0]["title"]
|
||||
answer_score = results[0][1]
|
||||
lines.append(f" 🔍 找到 {len(results)} 条相关结果:")
|
||||
for doc, score in results:
|
||||
for i, (doc, score) in enumerate(results):
|
||||
title = doc["title"]
|
||||
snippet = doc["content"][:200].replace("\n", " ")
|
||||
if len(snippet) > 200:
|
||||
snippet = snippet[:197] + "..."
|
||||
heading = doc.get("heading", "")
|
||||
body = doc.get("body", "")
|
||||
content = doc.get("content", "")
|
||||
# 显示更详细的信息
|
||||
lines.append(f" 📄 [{title}] (匹配度 {score:.2f})")
|
||||
lines.append(f" {snippet}")
|
||||
lines.append(f" 标题: {heading[:60]}")
|
||||
lines.append(f" 正文片段: {body[:100].replace(chr(10), ' ')}...")
|
||||
if i == 0:
|
||||
lines.append(f" 完整内容片段: {content[:200].replace(chr(10), ' ')}...")
|
||||
|
||||
# 诊断日志:记录自动回复触发条件
|
||||
if not self.ar.enabled:
|
||||
|
||||
Reference in New Issue
Block a user