Skip to content

Commit

Permalink
[improvement](chat) udpate EmbeddingConfig embeddingStorePersistentPa…
Browse files Browse the repository at this point in the history
…th and if the persistentPath directory does not exist, create the directory. (#550)
  • Loading branch information
lexluo09 committed Dec 19, 2023
1 parent 1d9b6d6 commit f60c167
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public void persistentToFile() {
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);
Expand Down

0 comments on commit f60c167

Please sign in to comment.