refactor(llm): 将知识库中的 score 字段类型从 Integer 改为 Double
- 修改了 KnowledgeBasePageReqVO、KnowledgeBaseRespVO 和 KnowledgeBaseSaveReqVO 中的 score 字段类型 - 这个改动可以提供更高的精度,更好地处理分数阈值
This commit is contained in:
parent
e50e3117ef
commit
e303b6f78c
@ -32,7 +32,7 @@ public class KnowledgeBasePageReqVO extends PageParam {
|
||||
private Integer topK;
|
||||
|
||||
@Schema(description = "Score阈值")
|
||||
private Integer score;
|
||||
private Double score;
|
||||
|
||||
@Schema(description = "知识长度")
|
||||
private Integer knowledgeLength;
|
||||
@ -40,4 +40,4 @@ public class KnowledgeBasePageReqVO extends PageParam {
|
||||
@Schema(description = "文件引用")
|
||||
private String knowledgeFile;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class KnowledgeBaseRespVO {
|
||||
|
||||
@Schema(description = "Score阈值")
|
||||
@ExcelProperty("Score阈值")
|
||||
private Integer score;
|
||||
private Double score;
|
||||
|
||||
@Schema(description = "知识长度")
|
||||
@ExcelProperty("知识长度")
|
||||
|
@ -27,7 +27,7 @@ public class KnowledgeBaseSaveReqVO {
|
||||
private Integer topK;
|
||||
|
||||
@Schema(description = "Score阈值")
|
||||
private Integer score;
|
||||
private Double score;
|
||||
|
||||
@Schema(description = "知识长度")
|
||||
private Integer knowledgeLength;
|
||||
|
@ -588,6 +588,7 @@ public class ConversationServiceImpl implements ConversationService {
|
||||
.collect(Collectors.groupingBy(KnowledgeHitRateTestResultVO::getFileId));
|
||||
|
||||
// 遍历Map,查看分组结果
|
||||
List<ParagraphHitRateWordVO> finalWords = words;
|
||||
groupedByFileId.forEach((fileId, list) -> {
|
||||
System.out.println("File ID: " + fileId);
|
||||
list.forEach(i->{
|
||||
@ -607,10 +608,12 @@ public class ConversationServiceImpl implements ConversationService {
|
||||
|
||||
rateWordVO.setParagraphHitRate(paragraphHitRate);
|
||||
|
||||
words.add(rateWordVO);
|
||||
finalWords.add(rateWordVO);
|
||||
});
|
||||
});
|
||||
|
||||
Set<ParagraphHitRateWordVO> uniqueWords = new TreeSet<>(Comparator.comparing(ParagraphHitRateWordVO::getDocumentName));
|
||||
uniqueWords.addAll(words);
|
||||
words = new ArrayList<>(uniqueWords);
|
||||
if (CollectionUtils.isEmpty(words)) {
|
||||
paragraphHitRateListVO.setWordList(Collections.emptyList());
|
||||
paragraphHitRateListVO.setIsExist(false);
|
||||
|
@ -357,10 +357,11 @@ public class ModelService {
|
||||
String content = delta.getString("content");
|
||||
// content = content.replaceAll("\n", " ");
|
||||
ChatReqVO chatReqVO = new ChatReqVO();
|
||||
chatReqVO.setUuid("");
|
||||
chatReqVO.setGroupId("");
|
||||
chatReqVO.setUuid(uuid);
|
||||
chatReqVO.setGroupId(groupId);
|
||||
chatReqVO.setContent(content);
|
||||
chatReqVO.setFinish_reason(false);
|
||||
chatReqVO.setIsExist(!StringUtils.isBlank(knowledgeBaseString));
|
||||
return JSON.toJSONString(chatReqVO);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user