修改些许bug

This commit is contained in:
moon 2025-09-16 17:40:24 +08:00
parent 2a9597991f
commit 1a319f650a
3 changed files with 37 additions and 0 deletions

View File

@ -1,6 +1,9 @@
package com.bjtds.brichat.entity.dataset; package com.bjtds.brichat.entity.dataset;
import com.baomidou.mybatisplus.annotation.TableLogic; 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 lombok.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -29,6 +32,7 @@ public class TDatasetFiles {
/** /**
* 类型: file-文件, folder-文件夹 * 类型: file-文件, folder-文件夹
*/ */
private String content;
private String type; private String type;
@ -55,11 +59,15 @@ public class TDatasetFiles {
/** /**
* 创建时间 * 创建时间
*/ */
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime createdAt; private LocalDateTime createdAt;
/** /**
* 最后更新时间 * 最后更新时间
*/ */
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
/** /**

View File

@ -96,6 +96,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
doc.getId(), doc.getId(),
doc.getName(), doc.getName(),
chunk, chunk,
doc.getType(),
doc.getParentId(), doc.getParentId(),
doc.getPath(), doc.getPath(),
doc.getSize(), doc.getSize(),
@ -135,6 +136,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
doc.getId(), doc.getId(),
doc.getName(), doc.getName(),
content, content,
doc.getType(),
doc.getParentId(), doc.getParentId(),
doc.getPath(), doc.getPath(),
doc.getSize(), doc.getSize(),
@ -253,6 +255,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService {
: lower + (rawScore - minScore) / (maxScore - minScore) * (upper - lower); : lower + (rawScore - minScore) / (maxScore - minScore) * (upper - lower);
String content = String.join(" ... ", hit.highlight().getOrDefault("content", Collections.emptyList())); String content = String.join(" ... ", hit.highlight().getOrDefault("content", Collections.emptyList()));
System.out.println("content: " + content);
String datasetName = tUserDatasetMapper.getDatasetName(d.getDifyDatasetId()); String datasetName = tUserDatasetMapper.getDatasetName(d.getDifyDatasetId());
RetrievalDto retrievalDto = new RetrievalDto( RetrievalDto retrievalDto = new RetrievalDto(
d.getId() != null ? d.getId().toString() : null, d.getId() != null ? d.getId().toString() : null,

View File

@ -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<LocalDateTime> {
@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);
}
}