"use client" /* Adapted from https://ui.shadcn.com/docs/components/combobox */ import * as React from "react" import { CheckIcon, ChevronsUpDownIcon, Cpu, Brain, ShieldOff } from "lucide-react" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" import { models } from "./ai" interface ModelPickerProps { value?: string onValueChange?: (value: string) => void disabled?: boolean className?: string } export function ModelPicker({ value, onValueChange, disabled = false, className }: ModelPickerProps) { const [open, setOpen] = React.useState(false) const currentModel = React.useMemo(() => { for (const category of models) { const model = category.models.find(m => m.name === value) if (model) { return { model, category: category.label, categoryDescription: category.descriptionEn } } } return null }, [value]) const handleSelect = (modelName: string) => { onValueChange?.(modelName) setOpen(false) } return ( No model found. {models.map((category) => (
{category.descriptionEn}
{category.models.map((model) => ( handleSelect(model.name)} className="flex items-center gap-3 py-3" >
{model.label}
{model.parameterSize} {model.thinking && ( Thinking )} {model.uncensored && ( Uncensored )}
))}
))}
) }