Local models: Reload button, scans keep their files in step

Files tab → Reload asks the worker for a scan and waits until it has
finished. Every scan now syncs local models' file lists with their
folders (new, resized, removed files; README) and settles the status.
Skipped while a job runs, and for a folder that is gone or too big.

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:55:03 +01:00
1 parent f862717158
commit 80d71a1bc9
9 files changed
+218 -15

No files matched your search

+11 -4
View File
@@ -1,9 +1,16 @@
import { NextResponse } from "next/server";
import { withAuth } from "@/lib/api-auth";
import { requestFolderScan } from "@/lib/local-folders";
import { getScanState, requestFolderScan } from "@/lib/local-folders";
/** Ask the worker to rescan the models folder for importable folders. */
export const dynamic = "force-dynamic";
/** Ask the worker to rescan the models folder (importable folders, and local models' files). */
export const POST = withAuth(async () => {
await requestFolderScan();
return new NextResponse(null, { status: 202 });
const requestedAt = await requestFolderScan();
return NextResponse.json({ requestedAt: requestedAt.getTime() }, { status: 202 });
});
/** When the worker last finished a scan, so a client can wait for the one it asked for. */
export const GET = withAuth(async () => {
return NextResponse.json(await getScanState());
});