Import folders without a Hub repo as local models

The Import form gets "Add as local model": every file in the folder,
kept as it is, named after the folder. A new models.source column
(hub | local) marks them; local models skip Hub checks, metadata,
downloads, updates and deep verify, and Verify checks existence and
size only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-11-08 00:14:56 +01:00
1 parent 90d6007b55
commit 80ccf800df
21 files changed
+1747 -39

No files matched your search

+27
View File
@@ -175,6 +175,21 @@ export function AddModelForm({
});
}
/** Import without a Hub repo: every file in the folder, kept as it is. */
async function addAsLocal() {
if (!importFolder) return;
setSubmitting(true);
try {
const { id } = await postJson<{ id: string }>("/api/models", { source: "local", localPath: importFolder.path });
toast.success(`${importFolder.path} added as a local model`);
onAdded(id);
} catch (err) {
toast.error(err instanceof Error ? err.message : String(err));
} finally {
setSubmitting(false);
}
}
async function addToLibrary() {
if (!result) return;
setSubmitting(true);
@@ -241,6 +256,18 @@ export function AddModelForm({
{error}
</p>
)}
{importFolder && (
<div className="mt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-t pt-4">
<p className="min-w-0 flex-1 text-sm text-muted-foreground">
<span className="font-medium text-foreground">Not on Hugging Face?</span> Add the folder as a local model: all{" "}
{importFolder.fileCount} file{importFolder.fileCount === 1 ? "" : "s"} as they are, without Hub checks, updates or
downloads.
</p>
<Button type="button" variant="outline" onClick={addAsLocal} disabled={submitting || loading}>
{submitting ? "Adding…" : "Add as local model"}
</Button>
</div>
)}
</CardContent>
</Card>