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/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, sep } from "node:path";
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: hf ? "huggingface" : "local-gguf",
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 {