[前端+后端+RAG] 检索范围切换(当前文件/整个知识库);联网搜索功能(SearXNG);搜索结果带网络链接;修复RAG检索source格式不匹配bug

This commit is contained in:
2026-04-07 15:02:54 +08:00
parent a5110da4e8
commit e1e5d4f30d
6 changed files with 158 additions and 36 deletions

View File

@@ -247,6 +247,7 @@ public class SmartChatController extends BaseController {
}
talkDto.setKnowledgeBaseNameList(knowledgeBaseNameList);
talkDto.setWebSearch(smartChatQueryDto.getWebSearch());
talkDto.setQuery(chatMessages.getContent().replaceAll("\n", ""));
talkDto.setStream(true);

View File

@@ -35,4 +35,7 @@ public class SmartChatQueryDto {
/* 用户请求类型 **/
private Integer chatType;
/* 是否开启联网搜索 **/
private Boolean webSearch;
}

View File

@@ -46,6 +46,10 @@ public class SmartChatSelfDto {
/* 用户请求类型 **/
private Integer chatType;
/* 是否开启联网搜索 **/
@JsonProperty("web_search")
private Boolean webSearch;
public String toJsonString() {
StringBuffer str = new StringBuffer();
extracted(knowledgeBaseNameList, str);
@@ -63,7 +67,7 @@ public class SmartChatSelfDto {
", \"fileNames\":" + fileNameList +
", \"quote\":\"" + ReplaceUtils.replaceHiddenChars(quote) + '\"' +
", \"prompt_name\":\"" + promptName + '\"' +
// ", \"use_model_self_response\":\"" + "False" + '\"' +
", \"web_search\":" + (webSearch != null && webSearch ? "true" : "false") +
'}';
}