feat(llm): 优化知识库为空时的处理逻辑
- 在知识库内容为空时,添加特定的处理逻辑 - 返回明确的提示信息,提高用户体验 -保持代码风格和命名规范
This commit is contained in:
parent
2fcfb86f87
commit
c235b2eed4
@ -396,7 +396,8 @@ public class ConversationServiceImpl implements ConversationService {
|
||||
"\n" +
|
||||
"屏蔽知识库外的任何数据引用\n" +
|
||||
"禁止添加解释性语句或背景补充\n" +
|
||||
"拦截包含\"假设\"/\"如果\"等假设性词汇的问题";
|
||||
"拦截包含\"假设\"/\"如果\"等假设性词汇的问题" +
|
||||
"7. 如果存在 <知识库内容> 这个标签,但是内容为空,返回 “抱歉,我无法回答这个问题,因为相关信息不在知识库中”,";
|
||||
/**
|
||||
* 公共模型聊天流式处理方法
|
||||
*
|
||||
@ -466,6 +467,11 @@ public class ConversationServiceImpl implements ConversationService {
|
||||
if (chatReqVO.getKnowledge() != null) {
|
||||
StringBuilder knowledgeBase = getKnowledgeBase(chatReqVO);
|
||||
knowledgeBaseString = knowledgeBase.toString();
|
||||
|
||||
if (org.apache.commons.lang3.StringUtils.isBlank(knowledgeBaseString)){
|
||||
knowledgeBaseString="<知识库内容> ,内容为空";
|
||||
}
|
||||
|
||||
// 处理 systemPrompt
|
||||
systemPrompt = StringUtils.isBlank(chatReqVO.getSystemPrompt())
|
||||
? PROMPT
|
||||
|
Loading…
x
Reference in New Issue
Block a user