llm opt, 支持非markdown的关联
This commit is contained in:
parent
133dd724ba
commit
9a7e855d65
@ -110,6 +110,7 @@ public class LLMAppServiceImpl implements LLMAppService {
|
|||||||
log.info("[pinDocsByKeywords] 未查到匹配ES文档,跳过pin操作。");
|
log.info("[pinDocsByKeywords] 未查到匹配ES文档,跳过pin操作。");
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
log.info("[pinDocsByKeywords] 已查询到关键词关联的文档。 {}", JSONUtil.toJsonStr(esFilepaths));
|
||||||
|
|
||||||
// 将当前问题标注为处理中
|
// 将当前问题标注为处理中
|
||||||
markQuestionProcessing(question);
|
markQuestionProcessing(question);
|
||||||
@ -122,9 +123,23 @@ public class LLMAppServiceImpl implements LLMAppService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. 找到需要pin的docPath集合
|
// 3. 找到需要pin的docPath集合
|
||||||
List<WorkspaceAttachment> toPinDocs = attachments.stream()
|
List<WorkspaceAttachment> toPinDocs = attachments.stream().filter(att -> {
|
||||||
.filter(att -> esFilepaths.stream().anyMatch(f -> att.getUrl().endsWith(f)))
|
String url = att.getUrl();
|
||||||
.collect(Collectors.toList());
|
if (url == null) return false;
|
||||||
|
// .md 文件
|
||||||
|
if (url.endsWith(".md")) {
|
||||||
|
return esFilepaths.stream().anyMatch(f -> url.endsWith(f));
|
||||||
|
}
|
||||||
|
// 其它文件(如 .pptx、.pdf、.docx等)
|
||||||
|
int lastSlash = url.lastIndexOf('/');
|
||||||
|
String fileName = lastSlash != -1 ? url.substring(lastSlash + 1) : url;
|
||||||
|
// esFilepaths 里也提取末尾文件名
|
||||||
|
return esFilepaths.stream().anyMatch(f -> {
|
||||||
|
int esLastSlash = f.lastIndexOf('/');
|
||||||
|
String esName = esLastSlash != -1 ? f.substring(esLastSlash + 1) : f;
|
||||||
|
return fileName.equals(esName);
|
||||||
|
});
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
// 4. 只unpin之前已pin的文档
|
// 4. 只unpin之前已pin的文档
|
||||||
attachments.stream()
|
attachments.stream()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user