@betterdb/memory 0.4.0 → 0.4.1
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/package.json +1 -1
- package/src/client/model.ts +16 -2
- package/src/index.ts +1 -1
- package/src/mcp/server.ts +1 -1
package/package.json
CHANGED
package/src/client/model.ts
CHANGED
|
@@ -28,6 +28,20 @@ export const PRESET_LIGHTWEIGHT: ModelPreset = {
|
|
|
28
28
|
embedDim: 384,
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Preset for an explicitly-selected Ollama provider. Unlike auto-detect (which
|
|
33
|
+
* picks a built-in preset whose model is installed), an explicit
|
|
34
|
+
* BETTERDB_*_PROVIDER=ollama must honor the configured model/dim — otherwise a
|
|
35
|
+
* user who set BETTERDB_SUMMARIZE_MODEL is silently overridden by PRESET_CLEAN.
|
|
36
|
+
*/
|
|
37
|
+
function ollamaPresetFromConfig(): ModelPreset {
|
|
38
|
+
return {
|
|
39
|
+
embedModel: config.ollama.embedModel,
|
|
40
|
+
summarizeModel: config.ollama.summarizeModel,
|
|
41
|
+
embedDim: config.ollama.embedDim,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
31
45
|
// --- ModelClient Interface ---
|
|
32
46
|
|
|
33
47
|
export interface ModelClient {
|
|
@@ -219,7 +233,7 @@ function createExplicitEmbedProvider(
|
|
|
219
233
|
}
|
|
220
234
|
case "ollama": {
|
|
221
235
|
const { OllamaModelClient } = require("./providers/ollama.js");
|
|
222
|
-
return new OllamaModelClient(
|
|
236
|
+
return new OllamaModelClient(ollamaPresetFromConfig(), config.ollama.url);
|
|
223
237
|
}
|
|
224
238
|
case "openai": {
|
|
225
239
|
if (!p.openaiKey) throw new Error("BETTERDB_EMBED_PROVIDER=openai but OPENAI_API_KEY is not set");
|
|
@@ -253,7 +267,7 @@ function createExplicitSummarizeProvider(
|
|
|
253
267
|
switch (name) {
|
|
254
268
|
case "ollama": {
|
|
255
269
|
const { OllamaModelClient } = require("./providers/ollama.js");
|
|
256
|
-
return new OllamaModelClient(
|
|
270
|
+
return new OllamaModelClient(ollamaPresetFromConfig(), config.ollama.url);
|
|
257
271
|
}
|
|
258
272
|
case "openai": {
|
|
259
273
|
if (!p.openaiKey) throw new Error("BETTERDB_SUMMARIZE_PROVIDER=openai but OPENAI_API_KEY is not set");
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, chmodSync, rmSync } from "node:fs";
|
|
14
14
|
import { join, resolve } from "node:path";
|
|
15
15
|
|
|
16
|
-
const VERSION = "0.4.
|
|
16
|
+
const VERSION = "0.4.1";
|
|
17
17
|
const HOME = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "";
|
|
18
18
|
const BETTERDB_DIR = join(HOME, ".betterdb");
|
|
19
19
|
const BIN_DIR = join(BETTERDB_DIR, "bin");
|