From 5c68be6636b92870a23221330fde0896a6dd3c7e Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Wed, 12 Nov 2025 16:46:04 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E7=AD=94=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins_func/functions/search_from_ragflow.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main/xiaozhi-server/plugins_func/functions/search_from_ragflow.py b/main/xiaozhi-server/plugins_func/functions/search_from_ragflow.py index cdb709e3..d585a762 100644 --- a/main/xiaozhi-server/plugins_func/functions/search_from_ragflow.py +++ b/main/xiaozhi-server/plugins_func/functions/search_from_ragflow.py @@ -84,11 +84,12 @@ def search_from_ragflow(conn, question=None): else: contents.append(str(content)) - # 构建适合大模型的上下文内容(每段前加编号,段间两个换行) - context_text = "\n\n".join( - f"{i+1}. {c.strip()}" for i, c in enumerate(contents[:5]) - ) - if not context_text: + if contents: + # 组织知识库内容为引用模式 + context_text = f"# 关于问题【{question}】查到知识库如下\n" + context_text += "```\n\n\n".join(contents[:5]) + context_text += "\n```" + else: context_text = "根据知识库查询结果,没有相关信息。" return ActionResponse(Action.REQLLM, context_text, None)