Flag models deleted from the Hub; tag picker, tags in settings, account menu
- Worker checks each model's repo and pinned commit on the Hub every
UPDATE_CHECK_INTERVAL_HOURS and after failed downloads; missing repos or
commits are flagged (badge, banner, Status filter) and block new
downloads. Local files are never touched. "Check now" on the model page.
- Tag picker dropdown ("Create new tag…" first, then existing tags) on the
model page and in Add model.
- Settings: separate File labels and Tags pages; create tags there. Unused
tags are no longer deleted automatically.
- Header: app icon, nav with active state, account menu with the OIDC
profile picture, theme switch and sign out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df18415e02
commit
3603742637
33 files changed
+1708
-122
No files matched your search
@@ -1,18 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getFileRoleStyles } from "@/lib/settings";
|
||||
import { listTags } from "@/lib/tags";
|
||||
import { FileLabelSettings } from "./file-label-settings";
|
||||
import { TagSettings } from "./tag-settings";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const metadata: Metadata = { title: "Labels · Settings" };
|
||||
export const metadata: Metadata = { title: "File labels · Settings" };
|
||||
|
||||
export default async function LabelSettingsPage() {
|
||||
const [fileRoles, tags] = await Promise.all([getFileRoleStyles(), listTags()]);
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<FileLabelSettings initial={fileRoles} />
|
||||
<TagSettings tags={tags} />
|
||||
</div>
|
||||
);
|
||||
return <FileLabelSettings initial={await getFileRoleStyles()} />;
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
import { TagsIcon } from "lucide-react";
|
||||
import { TagIcon, TagsIcon } from "lucide-react";
|
||||
import { SettingsNav } from "./settings-nav";
|
||||
|
||||
const SECTIONS = [{ href: "/settings/labels", label: "Labels", icon: <TagsIcon className="size-4" /> }];
|
||||
const SECTIONS = [
|
||||
{ href: "/settings/labels", label: "File labels", icon: <TagIcon className="size-4" /> },
|
||||
{ href: "/settings/tags", label: "Tags", icon: <TagsIcon className="size-4" /> },
|
||||
];
|
||||
|
||||
export default function SettingsLayout({ children }: LayoutProps<"/settings">) {
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import { listTags } from "@/lib/tags";
|
||||
import { TagSettings } from "./tag-settings";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const metadata: Metadata = { title: "Tags · Settings" };
|
||||
|
||||
export default async function TagSettingsPage() {
|
||||
return <TagSettings tags={await listTags()} />;
|
||||
}
|
||||
+65
-6
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Trash2Icon } from "lucide-react";
|
||||
import { PlusIcon, Trash2Icon } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
@@ -19,21 +19,22 @@ import {
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { autoTagColor, isLabelColor } from "@/lib/colors";
|
||||
import { autoTagColor, isLabelColor, type LabelColor } from "@/lib/colors";
|
||||
import type { Tag } from "@/lib/tags";
|
||||
import { ColorPicker } from "./color-picker";
|
||||
import { ColorPicker } from "../labels/color-picker";
|
||||
|
||||
/** Rename, recolor or delete user tags. Changes save immediately. */
|
||||
/** Create, rename, recolor or delete user tags. Changes save immediately. */
|
||||
export function TagSettings({ tags }: { tags: (Tag & { count: number })[] }) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Tags</CardTitle>
|
||||
<CardDescription>
|
||||
Your own tags (added on a model page or when adding a model). Tags without a color get an automatic one.
|
||||
Your own tags, to attach on a model page or when adding a model. Tags without a color get an automatic one.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<CardContent className="flex flex-col gap-3">
|
||||
<NewTagRow />
|
||||
{tags.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">No tags yet.</p>
|
||||
) : (
|
||||
@@ -48,6 +49,64 @@ export function TagSettings({ tags }: { tags: (Tag & { count: number })[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
function NewTagRow() {
|
||||
const router = useRouter();
|
||||
const [name, setName] = useState("");
|
||||
const [color, setColor] = useState<LabelColor | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
async function create(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
if (!name.trim()) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
const res = await fetch("/api/tags", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ name, color }),
|
||||
});
|
||||
const json = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
toast.error(json.error?.message ?? `Could not create tag (${res.status})`);
|
||||
return;
|
||||
}
|
||||
toast.success(`Tag "${json.name}" created`);
|
||||
setName("");
|
||||
setColor(null);
|
||||
router.refresh();
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<form
|
||||
onSubmit={create}
|
||||
className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 gap-y-2 rounded-lg border border-dashed px-4 py-3 sm:grid-cols-[8rem_minmax(0,1fr)_8rem_6rem_2rem]"
|
||||
>
|
||||
{name.trim() ? (
|
||||
<TagBadge name={name.trim()} color={color} className="justify-self-start" />
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground">New tag</span>
|
||||
)}
|
||||
<Input
|
||||
value={name}
|
||||
maxLength={40}
|
||||
disabled={busy}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
placeholder="e.g. roleplay"
|
||||
aria-label="New tag name"
|
||||
className="h-8"
|
||||
/>
|
||||
<ColorPicker value={color} onChange={setColor} allowAuto autoColor={autoTagColor(name.trim())} />
|
||||
<Button type="submit" size="sm" disabled={busy || !name.trim()} className="sm:col-span-2">
|
||||
<PlusIcon />
|
||||
Add
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function TagRow({ tag }: { tag: Tag & { count: number } }) {
|
||||
const router = useRouter();
|
||||
const [name, setName] = useState(tag.name);
|
||||
Reference in new issue
Block a user