From 254ea1c477bf6f2db285d693d6a1f386eed56a95 Mon Sep 17 00:00:00 2001
From: Liuyang <2746366019@qq.com>
Date: Tue, 11 Mar 2025 17:51:06 +0800
Subject: [PATCH] =?UTF-8?q?refactor(module-llm):=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E8=81=8A=E5=A4=A9=E6=A8=A1=E5=9E=8B=E6=8F=90=E7=A4=BA=E5=92=8C?=
=?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93=E5=86=85=E5=AE=B9=E6=B7=BB=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 简化聊天模型提示文本,移除多余的换行符
- 修改知识库内容添加方式,移除多余的格式化
---
.../llm/service/conversation/ConversationServiceImpl.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java
index 4c4dfdc03..c9123e5ed 100644
--- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java
+++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java
@@ -365,7 +365,7 @@ public class ConversationServiceImpl implements ConversationService {
&& Objects.equals(expectedGroupId, actualGroupId);
}
- public static final String PROMPT="Use the following context as your learned knowledge, inside XML tags.\\n\\n\\n{{#context#}}\\n\\n\\nWhen answer to user:\\n- If you don't know, just say that you don't know.\\n- If you don't know when you are not sure, ask for clarification.\\nAvoid mentioning that you obtained the information from the context.\\nAnd answer according to the language of the user's question.\\n\\n";
+ public static final String PROMPT="Use the following context as your learned knowledge, inside XML tags.When answer to user:\\n- If you don't know, just say that you don't know.\\n- If you don't know when you are not sure, ask for clarification.\\nAvoid mentioning that you obtained the information from the context.\\nAnd answer according to the language of the user's question.\\n\\n";
/**
* 公共模型聊天流式处理方法
*
@@ -649,7 +649,8 @@ public class ConversationServiceImpl implements ConversationService {
}
if (StringUtils.isNotBlank(pageContent)) {
- knowledgeBase.append("\n[知识库内容] [内容如下]").append(pageContent);
+// knowledgeBase.append("\n[知识库内容] [内容如下]").append(pageContent);
+ knowledgeBase.append(pageContent);
log.info("{} 添加知识内容,长度: {}", "[KnowledgeBase]", pageContent.length());
ParagraphHitRateVO paragraphHitRateVO = new ParagraphHitRateVO();