Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

1.3 KB
Raw Blame
import React from "react";
import { ChevronRight } from "lucide-react";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";

interface RoutingOptionsProps {
  label?: string;
  showValidationErrors?: boolean;
  summary?: string;
  children: React.ReactNode;
}

const RoutingOptions = ({
  label = "Advanced settings",
  showValidationErrors = false,
  summary,
  children,
}: RoutingOptionsProps) => {
  const [open, setOpen] = React.useState(false);
  const [previousValidation, setPreviousValidation] = React.useState(showValidationErrors);
  if (previousValidation !== showValidationErrors) {
    setPreviousValidation(showValidationErrors);
    if (showValidationErrors) setOpen(true);
  }
  return (
    <Collapsible open={open} onOpenChange={setOpen} className="rounded-lg border bg-muted/40">
      <CollapsibleTrigger className="group flex w-full flex-wrap items-center gap-2 px-4 py-3 text-left font-medium">
        <ChevronRight className="size-4 transition-transform group-data-panel-open:rotate-90" />
        {label}
        {summary && <span className="text-xs font-normal text-muted-foreground">{summary}</span>}
      </CollapsibleTrigger>
      <CollapsibleContent className="space-y-4">{children}</CollapsibleContent>
    </Collapsible>
  );
};

export default RoutingOptions;