修复2个问题:退回裁剪+知识库只回复匹配句\n\n1. 裁剪退回c9acd7e版(cap_left=0.25)\n 0.35只截到时间戳,用户消息被切;0.25覆盖消息文字区域\n\n2. 知识库返回全文→只返回匹配问答段\n 原问题:名字.txt含2个Q&A,TF-IDF整文件匹配后返回全文\n 该方案:knowledge_base._parse_qa_segments解析文件为独立问答段\n 每段作为独立doc,auto_reply._get_answer优先返回doc.answer\n 用户问一句话,只回复对应答句,不塞全部内容
This commit is contained in:
+4
-2
@@ -65,8 +65,10 @@ class AutoReply:
|
||||
return {"platform": platform, "answer": answer, "sender": sender}
|
||||
|
||||
def _get_answer(self, platform: str, msg: str, doc: dict, score: float) -> str or None:
|
||||
"""提取答案 + 防重复检查。"""
|
||||
answer = doc["content"].strip()
|
||||
"""提取答案 + 防重复检查。
|
||||
优先返回 doc['answer'](Q&A 段),兜底用整段 content。
|
||||
"""
|
||||
answer = (doc.get("answer") or doc["content"]).strip()
|
||||
if not answer:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user