Skip to content

Commit f60c167

Browse files
authored
[improvement](chat) udpate EmbeddingConfig embeddingStorePersistentPath and if the persistentPath directory does not exist, create the directory. (#550)
1 parent 1d9b6d6 commit f60c167

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

common/src/main/java/com/tencent/supersonic/common/config/EmbeddingConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public class EmbeddingConfig {
3232
@Value("${embedding.metric.analyzeQuery.nResult:5}")
3333
private int metricAnalyzeQueryResultNum;
3434

35-
@Value("${embeddingStore.persistent.path:/tmp}")
35+
@Value("${inMemoryEmbeddingStore.persistent.path:/tmp}")
3636
private String embeddingStorePersistentPath;
3737
}

common/src/main/java/com/tencent/supersonic/common/util/embedding/InMemoryS2EmbeddingStore.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public void persistentToFile() {
7171
for (Entry<String, InMemoryEmbeddingStore<EmbeddingQuery>> entry : collectionNameToStore.entrySet()) {
7272
Path filePath = getPersistentPath(entry.getKey());
7373
try {
74+
Path directoryPath = filePath.getParent();
75+
if (!Files.exists(directoryPath)) {
76+
Files.createDirectories(directoryPath);
77+
}
7478
entry.getValue().serializeToFile(filePath);
7579
} catch (Exception e) {
7680
log.error("persistentToFile error, persistentFile:" + filePath, e);

0 commit comments

Comments
 (0)