mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
[improvement](chat) udpate EmbeddingConfig embeddingStorePersistentPath and if the persistentPath directory does not exist, create the directory. (#550)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user