offgrid-ai 0.6.5 → 0.6.7
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/README.md +1 -1
- package/install.sh +1 -1
- package/package.json +4 -2
- package/src/autodetect.mjs +7 -8
- package/src/backend-installers.mjs +57 -0
- package/src/backends.mjs +20 -10
- package/src/cli.mjs +12 -1238
- package/src/commands/benchmark.mjs +4 -0
- package/src/commands/main.mjs +89 -0
- package/src/commands/models.mjs +170 -0
- package/src/commands/onboard.mjs +177 -0
- package/src/commands/run.mjs +146 -0
- package/src/commands/status.mjs +38 -0
- package/src/commands/stop.mjs +64 -0
- package/src/commands/uninstall.mjs +96 -0
- package/src/exec.mjs +31 -0
- package/src/managed.mjs +31 -0
- package/src/model-catalog.mjs +58 -0
- package/src/model-presenters.mjs +190 -0
- package/src/model-summary.mjs +61 -0
- package/src/profile-setup.mjs +20 -13
- package/src/profiles.mjs +6 -13
- package/src/recommendations.mjs +17 -0
- package/src/scan.mjs +2 -21
package/src/scan.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
2
|
import { readdir } from "node:fs/promises";
|
|
3
|
-
import { basename, dirname, join
|
|
3
|
+
import { basename, dirname, join } from "node:path";
|
|
4
4
|
import { getModelScanDirs } from "./config.mjs";
|
|
5
5
|
import { readGgufMetadata } from "./gguf.mjs";
|
|
6
6
|
|
|
@@ -67,7 +67,6 @@ async function scanOneDir(root) {
|
|
|
67
67
|
source: "local-gguf",
|
|
68
68
|
});
|
|
69
69
|
} else {
|
|
70
|
-
const hf = inferHfRef(path, name);
|
|
71
70
|
models.push({
|
|
72
71
|
path,
|
|
73
72
|
mmprojPath,
|
|
@@ -76,8 +75,7 @@ async function scanOneDir(root) {
|
|
|
76
75
|
quant: quantFromName(name),
|
|
77
76
|
sizeBytes,
|
|
78
77
|
backend: "llama-cpp",
|
|
79
|
-
source:
|
|
80
|
-
...(hf ? { hfRepo: hf.repo, hfVariant: hf.variant } : {}),
|
|
78
|
+
source: "local-gguf",
|
|
81
79
|
});
|
|
82
80
|
}
|
|
83
81
|
}
|
|
@@ -160,23 +158,6 @@ function quantFromName(name) {
|
|
|
160
158
|
return name.match(/(Q\d_K_[A-Z]+|Q\d_[01]|UD-[A-Z0-9_]+)/)?.[1];
|
|
161
159
|
}
|
|
162
160
|
|
|
163
|
-
export function inferHfRef(path, name = basename(path).replace(/\.gguf$/i, "")) {
|
|
164
|
-
const parts = path.split(sep);
|
|
165
|
-
const hubIndex = parts.lastIndexOf("hub");
|
|
166
|
-
const hfCacheRepo = hubIndex >= 0 ? parts.find((part, index) => index > hubIndex && part.startsWith("models--")) : null;
|
|
167
|
-
if (hfCacheRepo) {
|
|
168
|
-
return { repo: hfCacheRepo.replace(/^models--/u, "").replace(/--/gu, "/"), variant: quantFromName(name) ?? name };
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const lmStudioIndex = parts.lastIndexOf(".lmstudio");
|
|
172
|
-
if (lmStudioIndex >= 0 && parts[lmStudioIndex + 1] === "models") {
|
|
173
|
-
const org = parts[lmStudioIndex + 2];
|
|
174
|
-
const repo = parts[lmStudioIndex + 3];
|
|
175
|
-
if (org && repo) return { repo: `${org}/${repo}`, variant: quantFromName(name) ?? name };
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
161
|
|
|
181
162
|
function safeReadGgufMetadata(path) {
|
|
182
163
|
try {
|