Milestone (b): repo lookup and file selection
- Hub API client: resolve revision to SHA, paginated recursive file tree, gated-access probe, readable error mapping - Add-model page with quant quick-select, fnmatch-compatible include/exclude globs, selection summary and free-space hint - Models stored pinned to the reviewed SHA with full file list and selection rule - Library list, model detail page, remove (never-downloaded models only) - Worker reports MODELS_DIR free space; unit tests for selection logic Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
891e496157
commit
8f7ac60ccf
35 files changed
+2567
-19
No files matched your search
@@ -10,19 +10,31 @@ export type WorkerStatus = {
|
||||
online: boolean;
|
||||
heartbeatAt: string | null;
|
||||
hfVersion: string | null;
|
||||
modelsDirFreeBytes: number | null;
|
||||
modelsDirTotalBytes: number | null;
|
||||
};
|
||||
|
||||
const OFFLINE: WorkerStatus = {
|
||||
online: false,
|
||||
heartbeatAt: null,
|
||||
hfVersion: null,
|
||||
modelsDirFreeBytes: null,
|
||||
modelsDirTotalBytes: null,
|
||||
};
|
||||
|
||||
export async function getWorkerStatus(): Promise<WorkerStatus> {
|
||||
try {
|
||||
const row = await db().query.workerState.findFirst({ where: eq(workerState.id, "worker") });
|
||||
if (!row) return { online: false, heartbeatAt: null, hfVersion: null };
|
||||
if (!row) return OFFLINE;
|
||||
return {
|
||||
online: Date.now() - row.heartbeatAt.getTime() < OFFLINE_AFTER_MS,
|
||||
heartbeatAt: row.heartbeatAt.toISOString(),
|
||||
hfVersion: row.hfVersion,
|
||||
modelsDirFreeBytes: row.modelsDirFreeBytes,
|
||||
modelsDirTotalBytes: row.modelsDirTotalBytes,
|
||||
};
|
||||
} catch {
|
||||
// Table missing (worker never ran migrations yet) or DB unavailable.
|
||||
return { online: false, heartbeatAt: null, hfVersion: null };
|
||||
return OFFLINE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user