File size: 891 Bytes
b2d4d0e
 
 
 
 
 
 
 
 
 
 
65949d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b2d4d0e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import type { ModelInfo } from "@/lib/api";

type Props = {
  models: ModelInfo[];
  activeId: string | null;
  loading: boolean;
  onPick: (id: string) => void;
};

export default function ModelPicker({ models, activeId, loading, onPick }: Props) {
  return (
    <div className="flex items-center gap-2">
      <span className="label-mono">model</span>
      <select
        aria-label="Model"
        disabled={loading || models.length === 0}
        value={activeId ?? ""}
        onChange={(e) => onPick(e.target.value)}
        className="rounded-sm border border-border bg-paper/60 px-2.5 py-1 font-mono text-[12px] tracking-wider focus:outline-none focus:border-[hsl(var(--ember))]/60"
      >
        <option value="" disabled>choose…</option>
        {models.map((m) => (
          <option key={m.id} value={m.id}>{m.label}</option>
        ))}
      </select>
    </div>
  );
}