diff --git a/chat-client/src/api/dataset.ts b/chat-client/src/api/dataset.ts index 1579c9e..4f38ae4 100644 --- a/chat-client/src/api/dataset.ts +++ b/chat-client/src/api/dataset.ts @@ -108,9 +108,9 @@ export const deleteDataset = (id: string) => { } interface RenameParams { - fileId: number - newName: string -} + fileId: number + newName: string + } export const renameDocument = (data: RenameParams) => { return request({ url: '/brichat-service/datasetManage/document/rename', 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 3e438f5..1013547 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 @@ -133,7 +133,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService { try { client.index(req -> req .index(subDoc.getDifyDatasetId()) - .id(subDoc.getId().toString()) + .id(subDoc.getId() + "_" + UUID.randomUUID()) .document(subDoc) ); log.info("异步添加文档分片到索引 fileId={} docName={}", subDoc.getId(), subDoc.getName()); @@ -175,7 +175,7 @@ public class EsTDatasetFilesServiceImpl implements EsTDatasetFilesService { client.index(req -> req .index(singleDoc.getDifyDatasetId()) - .id(singleDoc.getId().toString()) + .id(singleDoc.getId() + "_" + UUID.randomUUID()) .document(singleDoc) ); log.info("Single文档索引成功 fileId={} docName={}", singleDoc.getId(), singleDoc.getName()); diff --git a/chat-server/src/main/java/com/bjtds/brichat/util/EsTDatasetFilesImporter.java b/chat-server/src/main/java/com/bjtds/brichat/util/EsTDatasetFilesImporter.java index aee7fd5..9ac87f0 100644 --- a/chat-server/src/main/java/com/bjtds/brichat/util/EsTDatasetFilesImporter.java +++ b/chat-server/src/main/java/com/bjtds/brichat/util/EsTDatasetFilesImporter.java @@ -14,6 +14,7 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.util.List; @@ -76,11 +77,12 @@ public class EsTDatasetFilesImporter { } File file = new File(filePath); if (!file.exists()) { - log.error(file.getAbsolutePath() + " 不存在,跳过"); + log.error("文件不存在: {}", file.getAbsolutePath()); failed_2++; redisTemplate.opsForValue().set("import:task:" + taskId + ":failed2", String.valueOf(failed_2)); continue; } + if(Boolean.TRUE.equals(document.getIsEs())){ log.warn("documentId=" + document.getId() + " 是ES索引文件,跳过"); failed_3++; diff --git a/chat-server/src/main/resources/com/bjtds/brichat/mapper/opengauss/TDatasetFilesMapper.xml b/chat-server/src/main/resources/com/bjtds/brichat/mapper/opengauss/TDatasetFilesMapper.xml index ccfcc85..0661c87 100644 --- a/chat-server/src/main/resources/com/bjtds/brichat/mapper/opengauss/TDatasetFilesMapper.xml +++ b/chat-server/src/main/resources/com/bjtds/brichat/mapper/opengauss/TDatasetFilesMapper.xml @@ -261,6 +261,7 @@ SELECT FROM t_dataset_files WHERE type = 'file' + and indexing_status='completed' ORDER BY created_at DESC