- 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>
16 lines
530 B
TypeScript
16 lines
530 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { withAuth } from "@/lib/api-auth";
|
|
import { apiError } from "@/lib/api-errors";
|
|
import { ModelError, removeModel } from "@/lib/models";
|
|
|
|
export const DELETE = withAuth<RouteContext<"/api/models/[id]">>(async (_req, { params }) => {
|
|
const { id } = await params;
|
|
try {
|
|
await removeModel(id);
|
|
return new NextResponse(null, { status: 204 });
|
|
} catch (err) {
|
|
if (err instanceof ModelError) return apiError(err.status, err.code, err.message);
|
|
throw err;
|
|
}
|
|
});
|