[improvement](chat) udpate EmbeddingConfig embeddingStorePersistentPath and if the persistentPath directory does not exist, create the directory. (#550)

This commit is contained in:
lexluo09
2023-12-19 16:12:11 +08:00
committed by GitHub
parent 1d9b6d6877
commit f60c1675cd
2 changed files with 5 additions and 1 deletions

View File

@@ -32,6 +32,6 @@ public class EmbeddingConfig {
@Value("${embedding.metric.analyzeQuery.nResult:5}")
private int metricAnalyzeQueryResultNum;
@Value("${embeddingStore.persistent.path:/tmp}")
@Value("${inMemoryEmbeddingStore.persistent.path:/tmp}")
private String embeddingStorePersistentPath;
}

View File

@@ -71,6 +71,10 @@ public class InMemoryS2EmbeddingStore implements S2EmbeddingStore {
for (Entry<String, InMemoryEmbeddingStore<EmbeddingQuery>> entry : collectionNameToStore.entrySet()) {
Path filePath = getPersistentPath(entry.getKey());
try {
Path directoryPath = filePath.getParent();
if (!Files.exists(directoryPath)) {
Files.createDirectories(directoryPath);
}
entry.getValue().serializeToFile(filePath);
} catch (Exception e) {
log.error("persistentToFile error, persistentFile:" + filePath, e);