import { RunEngine } from "@/api/types"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "./ui/select"; import { cn } from "@/util/utils"; type EngineOption = { value: RunEngine; label: string; badge?: string; badgeVariant?: "default" | "success" | "warning"; }; type Props = { value: RunEngine | null; onChange: (value: RunEngine) => void; className?: string; availableEngines?: Array; }; const allEngineOptions: Array = [ { value: RunEngine.SkyvernV1, label: "Skyvern 1.0", badge: "Recommended", badgeVariant: "success", }, { value: RunEngine.SkyvernV2, label: "Skyvern 2.0", badge: "Multi-Goal", badgeVariant: "warning", }, { value: RunEngine.OpenaiCua, label: "OpenAI CUA", }, { value: RunEngine.AnthropicCua, label: "Anthropic CUA", }, ]; // Default engines for blocks that don't support V2 mode const defaultEngines: Array = [ RunEngine.SkyvernV1, RunEngine.OpenaiCua, RunEngine.AnthropicCua, ]; function BadgeLabel({ option }: { option: EngineOption }) { return (
{option.label} {option.badge && ( {option.badge} )}
); } function RunEngineSelector({ value, onChange, className, availableEngines, }: Props) { const engines = availableEngines ?? defaultEngines; const engineOptions = allEngineOptions.filter((opt) => engines.includes(opt.value), ); const selectedOption = engineOptions.find( (opt) => opt.value === (value ?? RunEngine.SkyvernV1), ); return ( ); } export { RunEngineSelector };