diff --git a/chat/server/src/main/java/com/tencent/supersonic/chat/server/service/impl/MemoryServiceImpl.java b/chat/server/src/main/java/com/tencent/supersonic/chat/server/service/impl/MemoryServiceImpl.java index dfeba2f65..62e1495dc 100644 --- a/chat/server/src/main/java/com/tencent/supersonic/chat/server/service/impl/MemoryServiceImpl.java +++ b/chat/server/src/main/java/com/tencent/supersonic/chat/server/service/impl/MemoryServiceImpl.java @@ -38,8 +38,9 @@ public class MemoryServiceImpl implements MemoryService { @Override public void createMemory(ChatMemoryDO memory) { // if an existing enabled memory has the same question, just skip - List memories = getMemories(ChatMemoryFilter.builder() - .agentId(memory.getAgentId()).question(memory.getQuestion()).status(MemoryStatus.ENABLED).build()); + List memories = + getMemories(ChatMemoryFilter.builder().agentId(memory.getAgentId()) + .question(memory.getQuestion()).status(MemoryStatus.ENABLED).build()); if (memories.size() == 0) { chatMemoryRepository.createMemory(memory); } diff --git a/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/knowledge/helper/HdfsFileHelper.java b/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/knowledge/helper/HdfsFileHelper.java index 15ea42e36..fc956eef2 100644 --- a/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/knowledge/helper/HdfsFileHelper.java +++ b/headless/chat/src/main/java/com/tencent/supersonic/headless/chat/knowledge/helper/HdfsFileHelper.java @@ -11,7 +11,6 @@ import org.apache.hadoop.fs.Path; import java.io.IOException; import java.net.URI; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -61,13 +60,11 @@ public class HdfsFileHelper { FileSystem fs = FileSystem.get(URI.create(path[0]), new Configuration()); String cacheFilePath = path[0] + Predefine.BIN_EXT; - java.nio.file.Path normalizedPath = Paths.get(cacheFilePath).normalize(); - int customBase = normalizedPath.toString().lastIndexOf(FileHelper.FILE_SPILT); - String customPathStr = normalizedPath.toString().substring(0, customBase) - + FileHelper.FILE_SPILT + "*.txt"; - - log.info("customPath:{}", customPathStr); - List fileList = getFileList(fs, new Path(customPathStr)); + Path hdfsPath = new Path(cacheFilePath); + String parentPath = hdfsPath.getParent().toString(); + Path customPath = new Path(parentPath, "*.txt"); + log.info("customPath:{}", customPath); + List fileList = getFileList(fs, customPath); log.info("CustomDictionaryPath:{}", fileList); Config.CustomDictionaryPath = fileList.toArray(new String[0]); customDictionary.path = diff --git a/headless/core/src/main/java/com/tencent/supersonic/headless/core/adaptor/db/H2Adaptor.java b/headless/core/src/main/java/com/tencent/supersonic/headless/core/adaptor/db/H2Adaptor.java index 44e120058..9fe3ca56c 100644 --- a/headless/core/src/main/java/com/tencent/supersonic/headless/core/adaptor/db/H2Adaptor.java +++ b/headless/core/src/main/java/com/tencent/supersonic/headless/core/adaptor/db/H2Adaptor.java @@ -5,11 +5,12 @@ import com.tencent.supersonic.common.pojo.Constants; import com.tencent.supersonic.common.pojo.enums.TimeDimensionEnum; import com.tencent.supersonic.headless.api.pojo.DBColumn; import com.tencent.supersonic.headless.core.pojo.ConnectInfo; +import lombok.extern.slf4j.Slf4j; + import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; -import lombok.extern.slf4j.Slf4j; @Slf4j public class H2Adaptor extends BaseDbAdaptor {