Download more, file labels, split-file grouping, settings for labels and tags
- Files tab: "Download more" adds files to a model's selection and queues them - Colored file labels (Model, MTP, Vision/mmproj, imatrix, Config, …) - Split GGUF/safetensors parts shown and selected as one entry everywhere - Settings page with a Labels section: file label names/colors, tag rename/recolor/delete; new settings table and tags.color - Quants only count model weights Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5211ec9064
commit
df18415e02
34 files changed
+2256
-132
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { z } from "zod";
|
||||
import { withAuth } from "@/lib/api-auth";
|
||||
import { apiError, handleApiError } from "@/lib/api-errors";
|
||||
import { addFilesToModel, ModelError } from "@/lib/models";
|
||||
|
||||
const Body = z.object({ add: z.array(z.string().min(1).max(1024)).min(1).max(10_000) });
|
||||
|
||||
/** Add files to a model's selection and queue their download. */
|
||||
export const POST = withAuth<RouteContext<"/api/models/[id]/files">>(async (req, { params }) => {
|
||||
const { id } = await params;
|
||||
try {
|
||||
const { add } = Body.parse(await req.json());
|
||||
return NextResponse.json(await addFilesToModel(id, add), { status: 201 });
|
||||
} catch (err) {
|
||||
if (err instanceof ModelError) return apiError(err.status, err.code, err.message);
|
||||
return handleApiError(err);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { z } from "zod";
|
||||
import { withAuth } from "@/lib/api-auth";
|
||||
import { apiError, handleApiError } from "@/lib/api-errors";
|
||||
import { getFileRoleStyles, saveFileRoleStyles, SettingsError } from "@/lib/settings";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
/** Label text and color per file role (defaults merged with saved overrides). */
|
||||
export const GET = withAuth(async () => NextResponse.json({ fileRoles: await getFileRoleStyles() }));
|
||||
|
||||
const Body = z.object({
|
||||
fileRoles: z.record(z.string(), z.object({ label: z.string().optional(), color: z.string().optional() })),
|
||||
});
|
||||
|
||||
/** Replace the saved overrides; send the full set (values equal to the default are dropped). */
|
||||
export const PUT = withAuth(async (req) => {
|
||||
try {
|
||||
const { fileRoles } = Body.parse(await req.json());
|
||||
return NextResponse.json({ fileRoles: await saveFileRoleStyles(fileRoles) });
|
||||
} catch (err) {
|
||||
if (err instanceof SettingsError) return apiError(err.status, err.code, err.message);
|
||||
return handleApiError(err);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { z } from "zod";
|
||||
import { withAuth } from "@/lib/api-auth";
|
||||
import { apiError, handleApiError } from "@/lib/api-errors";
|
||||
import { deleteTag, TagError, updateTag } from "@/lib/tags";
|
||||
|
||||
const Body = z.object({ name: z.string().optional(), color: z.string().nullable().optional() });
|
||||
|
||||
/** Rename a tag and/or change its color (null = automatic). */
|
||||
export const PATCH = withAuth<RouteContext<"/api/tags/[id]">>(async (req, { params }) => {
|
||||
const { id } = await params;
|
||||
try {
|
||||
return NextResponse.json(await updateTag(id, Body.parse(await req.json())));
|
||||
} catch (err) {
|
||||
if (err instanceof TagError) return apiError(err.status, err.code, err.message);
|
||||
return handleApiError(err);
|
||||
}
|
||||
});
|
||||
|
||||
/** Delete a tag everywhere. */
|
||||
export const DELETE = withAuth<RouteContext<"/api/tags/[id]">>(async (_req, { params }) => {
|
||||
const { id } = await params;
|
||||
await deleteTag(id);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
});
|
||||
Reference in new issue
Block a user