Files
Kaname/src/app/api/local-folders/scan/route.ts
T
Pascal LinxweilerandClaude Opus 5.5 80d71a1bc9 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>
2026-11-08 00:55:03 +01:00

17 lines
667 B
TypeScript

import { NextResponse } from "next/server";
import { withAuth } from "@/lib/api-auth";
import { getScanState, requestFolderScan } from "@/lib/local-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 () => {
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());
});