Local models: the folder's README.md is the model card

The worker reads README.md when it scans the models folder (the web
app can't see it) and stores it on the folder and, after import, on
the model; every scan refreshes it for local models. Relative images
and links are dropped.

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:27:17 +01:00
1 parent 5a8893e7db
commit d27e79bba0
10 files changed
+1660 -17

No files matched your search

+4
View File
@@ -94,6 +94,8 @@ export const models = sqliteTable(
source: text("source", { enum: MODEL_SOURCES }).notNull().default("hub"),
trackedRevision: text("tracked_revision").notNull().default("main"),
pinnedSha: text("pinned_sha").notNull(), // "" for local models
/** Local models: the folder's README.md, read by the worker (the web app can't see MODELS_DIR). */
localReadme: text("local_readme"),
/** Relative to MODELS_DIR, e.g. "unsloth/Qwen3-27B-GGUF". */
localPath: text("local_path").notNull(),
/**
@@ -334,6 +336,8 @@ export const localFolders = sqliteTable("local_folders", {
totalBytes: integer("total_bytes").notNull(),
/** Commit from hf's download metadata, if the folder was written by `hf download`. */
commit: text("commit"),
/** The folder's README.md (capped), so an import as a local model has a model card. */
readme: text("readme"),
/** When a scan last wrote this folder (found it, or found it changed). */
scannedAt: ts("scanned_at").notNull(),
});
+1
View File
@@ -124,6 +124,7 @@ export async function addLocalModel(input: { localPath: string }): Promise<{ id:
pinnedSha: "",
localPath: folder.path,
status: "ready",
localReadme: folder.readme,
// Nothing to fetch from the Hub.
metadataFetchedAt: now,
}),