mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +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}")
|
@Value("${embedding.metric.analyzeQuery.nResult:5}")
|
||||||
private int metricAnalyzeQueryResultNum;
|
private int metricAnalyzeQueryResultNum;
|
||||||
|
|
||||||
@Value("${embeddingStore.persistent.path:/tmp}")
|
@Value("${inMemoryEmbeddingStore.persistent.path:/tmp}")
|
||||||
private String embeddingStorePersistentPath;
|
private String embeddingStorePersistentPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ public class InMemoryS2EmbeddingStore implements S2EmbeddingStore {
|
|||||||
for (Entry<String, InMemoryEmbeddingStore<EmbeddingQuery>> entry : collectionNameToStore.entrySet()) {
|
for (Entry<String, InMemoryEmbeddingStore<EmbeddingQuery>> entry : collectionNameToStore.entrySet()) {
|
||||||
Path filePath = getPersistentPath(entry.getKey());
|
Path filePath = getPersistentPath(entry.getKey());
|
||||||
try {
|
try {
|
||||||
|
Path directoryPath = filePath.getParent();
|
||||||
|
if (!Files.exists(directoryPath)) {
|
||||||
|
Files.createDirectories(directoryPath);
|
||||||
|
}
|
||||||
entry.getValue().serializeToFile(filePath);
|
entry.getValue().serializeToFile(filePath);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("persistentToFile error, persistentFile:" + filePath, e);
|
log.error("persistentToFile error, persistentFile:" + filePath, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user