mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
OmniRoute is an intelligent API gateway that unifies 20+ AI providers behind a single OpenAI-compatible endpoint. Features include intelligent routing with 6 strategies, multi-format translation (OpenAI/Claude/Gemini/Responses API), circuit breakers, semantic caching, combo fallback chains, real-time health monitoring, and a full dashboard with provider management, analytics, and CLI tool integration. Key highlights: - 20+ providers (Claude Code, Codex, Gemini CLI, GitHub Copilot, iFlow, Qwen, Kiro, etc.) - 6 routing strategies (Fill First, Round Robin, P2C, Random, Least Used, Cost Optimized) - Export/Import database backup with full archive support - Translator Playground with 4 modes (Playground, Chat Tester, Test Bench, Live Monitor) - 100% TypeScript across src/ and open-sse/ - Docker support with multi-stage builds - Comprehensive documentation and 9 dashboard screenshots
70 lines
1.6 KiB
TypeScript
70 lines
1.6 KiB
TypeScript
"use client";
|
|
|
|
import { cn } from "@/shared/utils/cn";
|
|
|
|
interface SegmentedOption {
|
|
value: string;
|
|
label: string;
|
|
icon?: string;
|
|
}
|
|
|
|
interface SegmentedControlProps {
|
|
options?: SegmentedOption[];
|
|
value?: string;
|
|
onChange?: (value: string) => void;
|
|
size?: "sm" | "md" | "lg";
|
|
className?: string;
|
|
"aria-label"?: string;
|
|
}
|
|
|
|
export default function SegmentedControl({
|
|
options = [],
|
|
value,
|
|
onChange,
|
|
size = "md",
|
|
className,
|
|
"aria-label": ariaLabel,
|
|
}: SegmentedControlProps) {
|
|
const sizes = {
|
|
sm: "h-7 text-xs",
|
|
md: "h-9 text-sm",
|
|
lg: "h-11 text-base",
|
|
};
|
|
|
|
return (
|
|
<div
|
|
role="tablist"
|
|
aria-label={ariaLabel}
|
|
className={cn(
|
|
"inline-flex items-center p-1 rounded-lg",
|
|
"bg-black/5 dark:bg-white/5",
|
|
className
|
|
)}
|
|
>
|
|
{options.map((option) => (
|
|
<button
|
|
key={option.value}
|
|
role="tab"
|
|
aria-selected={value === option.value}
|
|
tabIndex={value === option.value ? 0 : -1}
|
|
onClick={() => onChange(option.value)}
|
|
className={cn(
|
|
"px-4 rounded-md font-medium transition-all",
|
|
sizes[size],
|
|
value === option.value
|
|
? "bg-white dark:bg-white/10 text-text-main shadow-sm"
|
|
: "text-text-muted hover:text-text-main"
|
|
)}
|
|
>
|
|
{option.icon && (
|
|
<span className="material-symbols-outlined text-[16px] mr-1.5" aria-hidden="true">
|
|
{option.icon}
|
|
</span>
|
|
)}
|
|
{option.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|