offgrid-ai 0.4.5 → 0.4.6
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/profile-setup.mjs +25 -1
package/package.json
CHANGED
package/src/profile-setup.mjs
CHANGED
|
@@ -4,6 +4,9 @@ import { estimateMemory } from "./estimate.mjs";
|
|
|
4
4
|
import { findLlamaServer } from "./config.mjs";
|
|
5
5
|
import { baseUrlForFlags, LLAMA_CPP_PORT, LLAMA_CPP_MTP_PORT } from "./backends.mjs";
|
|
6
6
|
import { pc, formatBytes, renderRows, renderSection } from "./ui.mjs";
|
|
7
|
+
import { detectCapabilities } from "./autodetect.mjs";
|
|
8
|
+
import { matchDrafter } from "./scan.mjs";
|
|
9
|
+
import { scanGgufModels } from "./scan.mjs";
|
|
7
10
|
|
|
8
11
|
const execFileAsync = promisify(execFile);
|
|
9
12
|
|
|
@@ -29,7 +32,28 @@ const THINKING_DEFAULTS = {
|
|
|
29
32
|
|
|
30
33
|
export async function configureLocalProfile(prompt, profile) {
|
|
31
34
|
let configured = profile;
|
|
32
|
-
|
|
35
|
+
// Re-detect capabilities from the model file and check for drafters
|
|
36
|
+
// so that re-setup can pick up MTP availability, vision changes, etc.
|
|
37
|
+
const freshCaps = detectCapabilities(profile.modelPath, profile.mmprojPath);
|
|
38
|
+
let drafterPath = profile.drafterPath ?? null;
|
|
39
|
+
if (!drafterPath) {
|
|
40
|
+
const { drafters } = await scanGgufModels();
|
|
41
|
+
const drafter = matchDrafter(profile.modelPath, drafters);
|
|
42
|
+
if (drafter) drafterPath = drafter.path;
|
|
43
|
+
}
|
|
44
|
+
const hasMtp = freshCaps.mtp || Boolean(drafterPath);
|
|
45
|
+
const caps = { ...freshCaps, mtp: hasMtp };
|
|
46
|
+
// If MTP is newly available, switch backend and add drafter path
|
|
47
|
+
if (hasMtp && configured.backend !== "llama-cpp-mtp") {
|
|
48
|
+
configured = { ...configured, backend: "llama-cpp-mtp", providerId: "llama-cpp-mtp", drafterPath, capabilities: { ...configured.capabilities, mtp: true } };
|
|
49
|
+
}
|
|
50
|
+
if (drafterPath && !configured.drafterPath) {
|
|
51
|
+
configured = { ...configured, drafterPath };
|
|
52
|
+
}
|
|
53
|
+
// If vision was previously disabled but mmproj is back, re-enable
|
|
54
|
+
if (configured.disabledMmprojPath && configured.mmprojPath === null && freshCaps.vision) {
|
|
55
|
+
configured = { ...configured, mmprojPath: configured.disabledMmprojPath, disabledMmprojPath: undefined, capabilities: { ...configured.capabilities, vision: true, visionDisabledReason: undefined } };
|
|
56
|
+
}
|
|
33
57
|
|
|
34
58
|
console.log("");
|
|
35
59
|
console.log(renderSection("Model setup", renderRows([
|