"use client"; import React from "react"; import { cn } from "@/lib/utils"; import { ChevronDown, Cpu } from "lucide-react"; const MODELS = [ { id: "yuuki-best", name: "Yuuki Best", tag: "Flagship" }, { id: "yuuki-3.7", name: "Yuuki 3.7", tag: "Balanced" }, { id: "yuuki-v0.1", name: "Yuuki v0.1", tag: "Fast" }, ]; interface ModelSelectorProps { value: string; onChange: (model: string) => void; } export function ModelSelector({ value, onChange }: ModelSelectorProps) { const [open, setOpen] = React.useState(false); const ref = React.useRef(null); const selected = MODELS.find((m) => m.id === value) || MODELS[0]; React.useEffect(() => { const handler = (e: MouseEvent) => { if (ref.current && !ref.current.contains(e.target as Node)) { setOpen(false); } }; document.addEventListener("mousedown", handler); return () => document.removeEventListener("mousedown", handler); }, []); return (
{open && (
{MODELS.map((m) => ( ))}
)}
); }