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,9 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { XIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { FileRoleBadge } from "@/components/labels";
|
||||
import { TagBadge } from "@/components/tag-badge";
|
||||
import { TagPicker } from "@/components/tag-picker";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
@@ -46,15 +49,7 @@ export function AddModelForm({
|
||||
const [includeText, setIncludeText] = useState("");
|
||||
const [excludeText, setExcludeText] = useState("");
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [tagsText, setTagsText] = useState("");
|
||||
const [knownTags, setKnownTags] = useState<string[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("/api/tags")
|
||||
.then((r) => (r.ok ? r.json() : []))
|
||||
.then((all: { name: string }[]) => setKnownTags(all.map((t) => t.name)))
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
const [tags, setTags] = useState<{ name: string; color?: string | null }[]>([]);
|
||||
|
||||
async function lookup(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
@@ -67,7 +62,7 @@ export function AddModelForm({
|
||||
setChecked(new Set());
|
||||
setIncludeText("");
|
||||
setExcludeText("");
|
||||
setTagsText("");
|
||||
setTags([]);
|
||||
} catch (err) {
|
||||
setResult(null);
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -146,7 +141,7 @@ export function AddModelForm({
|
||||
sha: result.sha,
|
||||
include: [...includePatterns, ...[...checked].sort().map(escapeGlob)],
|
||||
exclude: excludePatterns,
|
||||
tags: parsePatternList(tagsText),
|
||||
tags: tags.map((t) => t.name),
|
||||
});
|
||||
toast.success(`${result.repoId} added, download queued`);
|
||||
onAdded(id);
|
||||
@@ -289,20 +284,32 @@ export function AddModelForm({
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor="tags">Tags</Label>
|
||||
<Input
|
||||
id="tags"
|
||||
value={tagsText}
|
||||
onChange={(e) => setTagsText(e.target.value)}
|
||||
placeholder="roleplay, security"
|
||||
list="known-tags"
|
||||
/>
|
||||
<datalist id="known-tags">
|
||||
{knownTags.map((t) => (
|
||||
<option key={t} value={t} />
|
||||
<Label>Tags</Label>
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
{tags.map((t) => (
|
||||
<TagBadge key={t.name.toLowerCase()} name={t.name} color={t.color}>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`Remove tag ${t.name}`}
|
||||
onClick={() => setTags((prev) => prev.filter((x) => x !== t))}
|
||||
className="opacity-60 hover:opacity-100"
|
||||
>
|
||||
<XIcon className="size-3" />
|
||||
</button>
|
||||
</TagBadge>
|
||||
))}
|
||||
</datalist>
|
||||
<p className="text-xs text-muted-foreground">Optional, comma-separated. Editable later on the model page.</p>
|
||||
<TagPicker
|
||||
exclude={tags.map((t) => t.name)}
|
||||
onPick={(name, tag) =>
|
||||
setTags((prev) =>
|
||||
prev.some((x) => x.name.toLowerCase() === name.toLowerCase())
|
||||
? prev
|
||||
: [...prev, { name, color: tag?.color }],
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">Optional. Editable later on the model page.</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in new issue
Block a user