@hasna/models 0.0.5 → 0.0.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/dist/cli/index.js +5 -4
- package/dist/index.js +5 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2910,7 +2910,7 @@ function safeDestinationPath(root, filePath) {
|
|
|
2910
2910
|
}
|
|
2911
2911
|
return destination;
|
|
2912
2912
|
}
|
|
2913
|
-
function normalizeEntry(raw, kind) {
|
|
2913
|
+
function normalizeEntry(raw, kind, fallbackRevision = "main") {
|
|
2914
2914
|
const repoId = String(raw.id ?? raw.modelId ?? "");
|
|
2915
2915
|
const tags = Array.isArray(raw.tags) ? raw.tags.map(String) : [];
|
|
2916
2916
|
const cardData = raw.cardData;
|
|
@@ -2918,7 +2918,7 @@ function normalizeEntry(raw, kind) {
|
|
|
2918
2918
|
provider: "huggingface",
|
|
2919
2919
|
entityKind: kind,
|
|
2920
2920
|
repoId,
|
|
2921
|
-
revision: String(raw.sha ??
|
|
2921
|
+
revision: String(raw.sha ?? fallbackRevision),
|
|
2922
2922
|
canonicalUrl: canonicalUrl(kind, repoId),
|
|
2923
2923
|
title: repoId,
|
|
2924
2924
|
author: typeof raw.author === "string" ? raw.author : repoId.split("/")[0],
|
|
@@ -3001,8 +3001,9 @@ async function searchHuggingFace(input = {}) {
|
|
|
3001
3001
|
}
|
|
3002
3002
|
async function getHuggingFaceInfo(refOrInput, defaultKind = "model") {
|
|
3003
3003
|
const ref = typeof refOrInput === "string" ? parseProviderRef(refOrInput, defaultKind) : refOrInput;
|
|
3004
|
-
const
|
|
3005
|
-
|
|
3004
|
+
const revision = ref.revision || "main";
|
|
3005
|
+
const raw = await hfJson(`/api/${apiKind(ref.entityKind)}/${encodeRepoId(ref.repoId)}/revision/${encodeURIComponent(revision)}`);
|
|
3006
|
+
return normalizeEntry(raw, ref.entityKind, revision);
|
|
3006
3007
|
}
|
|
3007
3008
|
async function listHuggingFaceFiles(refOrInput, defaultKind = "model") {
|
|
3008
3009
|
const ref = typeof refOrInput === "string" ? parseProviderRef(refOrInput, defaultKind) : refOrInput;
|
package/dist/index.js
CHANGED
|
@@ -534,7 +534,7 @@ function safeDestinationPath(root, filePath) {
|
|
|
534
534
|
}
|
|
535
535
|
return destination;
|
|
536
536
|
}
|
|
537
|
-
function normalizeEntry(raw, kind) {
|
|
537
|
+
function normalizeEntry(raw, kind, fallbackRevision = "main") {
|
|
538
538
|
const repoId = String(raw.id ?? raw.modelId ?? "");
|
|
539
539
|
const tags = Array.isArray(raw.tags) ? raw.tags.map(String) : [];
|
|
540
540
|
const cardData = raw.cardData;
|
|
@@ -542,7 +542,7 @@ function normalizeEntry(raw, kind) {
|
|
|
542
542
|
provider: "huggingface",
|
|
543
543
|
entityKind: kind,
|
|
544
544
|
repoId,
|
|
545
|
-
revision: String(raw.sha ??
|
|
545
|
+
revision: String(raw.sha ?? fallbackRevision),
|
|
546
546
|
canonicalUrl: canonicalUrl(kind, repoId),
|
|
547
547
|
title: repoId,
|
|
548
548
|
author: typeof raw.author === "string" ? raw.author : repoId.split("/")[0],
|
|
@@ -625,8 +625,9 @@ async function searchHuggingFace(input = {}) {
|
|
|
625
625
|
}
|
|
626
626
|
async function getHuggingFaceInfo(refOrInput, defaultKind = "model") {
|
|
627
627
|
const ref = typeof refOrInput === "string" ? parseProviderRef(refOrInput, defaultKind) : refOrInput;
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
const revision = ref.revision || "main";
|
|
629
|
+
const raw = await hfJson(`/api/${apiKind(ref.entityKind)}/${encodeRepoId(ref.repoId)}/revision/${encodeURIComponent(revision)}`);
|
|
630
|
+
return normalizeEntry(raw, ref.entityKind, revision);
|
|
630
631
|
}
|
|
631
632
|
async function listHuggingFaceFiles(refOrInput, defaultKind = "model") {
|
|
632
633
|
const ref = typeof refOrInput === "string" ? parseProviderRef(refOrInput, defaultKind) : refOrInput;
|