memories-lite 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vectorstores/lite.js +12 -5
- package/package.json +1 -1
- package/src/vectorstores/lite.ts +11 -5
|
@@ -33,6 +33,7 @@ class LiteVectorStore {
|
|
|
33
33
|
const filename = this.isSecure ? `memories-lite-${currentUserId}.db` : `memories-lite-global.db`;
|
|
34
34
|
this.dbPath = (config.rootPath == ':memory:') ? ':memory:' : path_1.default.join(config.rootPath, filename);
|
|
35
35
|
// Add error handling callback for the database connection
|
|
36
|
+
console.log('--- DBG create LiteVectorStore::dbPath', this.dbPath);
|
|
36
37
|
this.db = new sqlite3_1.default.Database(this.dbPath);
|
|
37
38
|
}
|
|
38
39
|
async init() {
|
|
@@ -142,11 +143,17 @@ class LiteVectorStore {
|
|
|
142
143
|
}
|
|
143
144
|
return cachedStore;
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
try {
|
|
147
|
+
// Pass the full config (including scoring) to the constructor
|
|
148
|
+
const newStore = new LiteVectorStore(config, hashedUserId);
|
|
149
|
+
await newStore.init();
|
|
150
|
+
LiteVectorStore.cache.set(hashedUserId, newStore);
|
|
151
|
+
return newStore;
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
console.error('--- DBG LiteVectorStore::from error', err);
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
150
157
|
}
|
|
151
158
|
async insert(vectors, ids, payloads) {
|
|
152
159
|
for (let i = 0; i < vectors.length; i++) {
|
package/package.json
CHANGED
package/src/vectorstores/lite.ts
CHANGED
|
@@ -47,6 +47,7 @@ export class LiteVectorStore implements VectorStore {
|
|
|
47
47
|
this.dbPath = (config.rootPath == ':memory:') ? ':memory:' : path.join(config.rootPath, filename);
|
|
48
48
|
|
|
49
49
|
// Add error handling callback for the database connection
|
|
50
|
+
console.log('--- DBG create LiteVectorStore::dbPath',this.dbPath);
|
|
50
51
|
this.db = new sqlite3.Database(this.dbPath);
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -166,12 +167,17 @@ export class LiteVectorStore implements VectorStore {
|
|
|
166
167
|
return cachedStore;
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
try{
|
|
171
|
+
// Pass the full config (including scoring) to the constructor
|
|
172
|
+
const newStore = new LiteVectorStore(config, hashedUserId);
|
|
171
173
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
await newStore.init();
|
|
175
|
+
LiteVectorStore.cache.set(hashedUserId, newStore);
|
|
176
|
+
return newStore;
|
|
177
|
+
}catch(err){
|
|
178
|
+
console.error('--- DBG LiteVectorStore::from error',err);
|
|
179
|
+
throw err;
|
|
180
|
+
}
|
|
175
181
|
}
|
|
176
182
|
|
|
177
183
|
async insert(
|