diff --git a/chat-server/src/main/java/com/bjtds/brichat/entity/dataset/TDatasetFiles.java b/chat-server/src/main/java/com/bjtds/brichat/entity/dataset/TDatasetFiles.java index 242a4f2..b953a68 100644 --- a/chat-server/src/main/java/com/bjtds/brichat/entity/dataset/TDatasetFiles.java +++ b/chat-server/src/main/java/com/bjtds/brichat/entity/dataset/TDatasetFiles.java @@ -1,6 +1,9 @@ package com.bjtds.brichat.entity.dataset; import com.baomidou.mybatisplus.annotation.TableLogic; +import com.bjtds.brichat.util.LocalDateTimeDeserializer; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.*; import java.time.LocalDateTime; @@ -29,6 +32,7 @@ public class TDatasetFiles { /** * 类型: file-文件, folder-文件夹 */ + private String content; private String type; @@ -55,11 +59,15 @@ public class TDatasetFiles { /** * 创建时间 */ + + @JsonDeserialize(using = LocalDateTimeDeserializer.class) private LocalDateTime createdAt; /** * 最后更新时间 */ + + @JsonDeserialize(using = LocalDateTimeDeserializer.class) private LocalDateTime updatedAt; /** diff --git a/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java b/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java index 0cb95e1..bbe2f27 100644 --- a/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java +++ b/chat-server/src/main/java/com/bjtds/brichat/service/impl/EsTDatasetFilesServiceImpl.java @@ -96,6 +96,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService { doc.getId(), doc.getName(), chunk, + doc.getType(), doc.getParentId(), doc.getPath(), doc.getSize(), @@ -135,6 +136,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService { doc.getId(), doc.getName(), content, + doc.getType(), doc.getParentId(), doc.getPath(), doc.getSize(), @@ -253,6 +255,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService { : lower + (rawScore - minScore) / (maxScore - minScore) * (upper - lower); String content = String.join(" ... ", hit.highlight().getOrDefault("content", Collections.emptyList())); + System.out.println("content: " + content); String datasetName = tUserDatasetMapper.getDatasetName(d.getDifyDatasetId()); RetrievalDto retrievalDto = new RetrievalDto( d.getId() != null ? d.getId().toString() : null, diff --git a/chat-server/src/main/java/com/bjtds/brichat/util/LocalDateTimeDeserializer.java b/chat-server/src/main/java/com/bjtds/brichat/util/LocalDateTimeDeserializer.java new file mode 100644 index 0000000..697850f --- /dev/null +++ b/chat-server/src/main/java/com/bjtds/brichat/util/LocalDateTimeDeserializer.java @@ -0,0 +1,26 @@ +package com.bjtds.brichat.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.IOException; +import java.time.LocalDateTime; + +public class LocalDateTimeDeserializer extends JsonDeserializer { + @Override + public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + JsonNode node = p.getCodec().readTree(p); + + int year = node.path("year").asInt(); + int month = node.path("monthValue").asInt(); + int day = node.path("dayOfMonth").asInt(); + int hour = node.path("hour").asInt(); + int minute = node.path("minute").asInt(); + int second = node.path("second").asInt(); + int nano = node.path("nano").asInt(); + + return LocalDateTime.of(year, month, day, hour, minute, second, nano); + } +}