Deployments: API keys, deploy from the library, reorganized form

- Settings → API keys (generate or paste, show again, delete). Deployments with
  "Require an API key" get them via LLAMA_API_KEY / VLLM_API_KEY (--api-key for
  several vLLM keys); values are masked in the stored/shown command and in logs.
  The chat proxy sends a key.
- "Deploy" in the library and on the model page preselects the model and a
  runtime that can serve it; library rows and the model page link to the
  model's deployments.
- Deployment form: grouped launch options with flags next to labels, command in
  its own step, extra arguments as flag/value rows (runtime form too).
- Native selects follow the dark theme (color-scheme), fixing unreadable options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-06 12:28:25 +02:00
1 parent 66e6a8c4f7
commit ea1f18cc74
32 files changed
+2478 -183

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
"use client";
import { PlusIcon, XIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import type { ArgRow } from "@/lib/extra-args";
const GENERIC = { flag: "--flag", value: "value (optional)" };
/** Extra command-line arguments as flag/value rows (controlled). `placeholder` is the first row's example. */
export function ArgsEditor({
rows,
onChange,
placeholder = GENERIC,
addLabel = "Add argument",
}: {
rows: ArgRow[];
onChange: (rows: ArgRow[]) => void;
placeholder?: { flag: string; value: string };
addLabel?: string;
}) {
const set = (i: number, patch: Partial<ArgRow>) => onChange(rows.map((r, j) => (j === i ? { ...r, ...patch } : r)));
const single = (s: string) => s.replace(/[\r\n]/g, "");
return (
<div className="flex flex-col gap-1.5">
{rows.map((r, i) => (
<div key={i} className="flex items-center gap-1.5">
<Input
value={r.flag}
onChange={(e) => set(i, { flag: single(e.target.value) })}
placeholder={(i === 0 ? placeholder : GENERIC).flag}
spellCheck={false}
aria-label={`Argument ${i + 1} flag`}
className="font-mono text-xs md:text-xs"
/>
<Input
value={r.value}
onChange={(e) => set(i, { value: single(e.target.value) })}
placeholder={(i === 0 ? placeholder : GENERIC).value}
spellCheck={false}
aria-label={`Argument ${i + 1} value`}
className="font-mono text-xs md:text-xs"
/>
<Button type="button" variant="ghost" size="icon-sm" aria-label={`Remove argument ${i + 1}`} onClick={() => onChange(rows.filter((_, j) => j !== i))}>
<XIcon />
</Button>
</div>
))}
<Button type="button" variant="outline" size="sm" className="self-start" onClick={() => onChange([...rows, { flag: "", value: "" }])}>
<PlusIcon />
{addLabel}
</Button>
</div>
);
}
+21
View File
@@ -0,0 +1,21 @@
import { ChevronDownIcon } from "lucide-react";
import * as React from "react";
import { cn } from "@/lib/utils";
/** A native <select> styled like Input; the option list follows the theme via `color-scheme`. */
function NativeSelect({ className, children, ...props }: React.ComponentProps<"select">) {
return (
<div className={cn("relative w-full", className)}>
<select
data-slot="native-select"
className="h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30"
{...props}
>
{children}
</select>
<ChevronDownIcon className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground" />
</div>
);
}
export { NativeSelect };
+5 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { BoxesIcon, LogOutIcon, MonitorIcon, MoonIcon, SunIcon, TagIcon, TagsIcon } from "lucide-react";
import { BoxesIcon, KeyRoundIcon, LogOutIcon, MonitorIcon, MoonIcon, SunIcon, TagIcon, TagsIcon } from "lucide-react";
import Link from "next/link";
import { useTheme } from "next-themes";
import { useTransition } from "react";
@@ -71,6 +71,10 @@ export function UserMenu({ user, signOutAction }: { user: MenuUser; signOutActio
<BoxesIcon />
Runtimes
</DropdownMenuItem>
<DropdownMenuItem render={<Link href="/settings/api-keys" />}>
<KeyRoundIcon />
API keys
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>