From 90ad5e7cfb8feddc28386748c864ad29e4f2c658 Mon Sep 17 00:00:00 2001 From: martsforever Date: Wed, 29 Oct 2025 17:21:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96milvus=E6=A3=80?= =?UTF-8?q?=E7=B4=A2=E6=80=BB=E7=BB=93=E6=8F=90=E7=A4=BA=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/milvus_utils.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/app/utils/milvus_utils.py b/app/utils/milvus_utils.py index ddc333e..9ba67bf 100644 --- a/app/utils/milvus_utils.py +++ b/app/utils/milvus_utils.py @@ -98,27 +98,18 @@ class MilvusService: result_nodes = [node for node in result_nodes if node.score >= 0.3] chain = ChatPromptTemplate.from_template(""" - 你将收到一个用户问题和一组来自LlamaIndex的检索结果。你的任务是: - 1. 分析检索结果内容 - 2. 提取与用户问题直接相关的信息片段 - 3. 基于这些相关信息生成准确、简洁且有帮助的回答 + 请根据context标签中的内容来回答用户问题,如果与用户问题相关的内容,请回答"在提供的资料中未找到相关信息"; - 用户问题如下标签中的内容所示: - - {question} - - - 检索结果如下标签中的内容所示: {context} 处理要求: - - 仅关注检索结果中与用户问题直接相关的内容 - - 忽略任何无关或关联性较弱的信息 - 如果检索结果中没有相关信息,请明确回答:"在提供的资料中未找到相关信息" - 不要添加检索结果之外的额外知识 - 回答时优先使用检索结果中的原文表述 + + 用户的问题是:{question} """) | create_llm(disable_streaming=True) | StrOutputParser() chain_input = {"context": "\n".join([node.node.text for node in result_nodes]), "question": param.question}