mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 05:45:04 +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
66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import Modal from "./Modal";
|
|
import Button from "./Button";
|
|
|
|
export default function ManualConfigModal({
|
|
isOpen,
|
|
onClose,
|
|
title = "Manual Configuration",
|
|
configs = [],
|
|
}) {
|
|
const [copiedIndex, setCopiedIndex] = useState(null);
|
|
|
|
const copyToClipboard = async (text, index) => {
|
|
try {
|
|
if (navigator.clipboard && window.isSecureContext) {
|
|
await navigator.clipboard.writeText(text);
|
|
} else {
|
|
const textarea = document.createElement("textarea");
|
|
textarea.value = text;
|
|
textarea.style.position = "fixed";
|
|
textarea.style.left = "-9999px";
|
|
textarea.style.top = "-9999px";
|
|
textarea.style.opacity = "0";
|
|
document.body.appendChild(textarea);
|
|
textarea.focus();
|
|
textarea.select();
|
|
document.execCommand("copy");
|
|
document.body.removeChild(textarea);
|
|
}
|
|
setCopiedIndex(index);
|
|
setTimeout(() => setCopiedIndex(null), 2000);
|
|
} catch (err) {
|
|
console.log("Failed to copy:", err);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Modal isOpen={isOpen} onClose={onClose} title={title} size="xl">
|
|
<div className="flex flex-col gap-4">
|
|
{configs.map((config, index) => (
|
|
<div key={index} className="flex flex-col gap-2">
|
|
<div className="flex items-center justify-between">
|
|
<span className="text-sm font-medium text-text-main">{config.filename}</span>
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
onClick={() => copyToClipboard(config.content, index)}
|
|
>
|
|
<span className="material-symbols-outlined text-[14px] mr-1">
|
|
{copiedIndex === index ? "check" : "content_copy"}
|
|
</span>
|
|
{copiedIndex === index ? "Copied!" : "Copy"}
|
|
</Button>
|
|
</div>
|
|
<pre className="px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border">
|
|
{config.content}
|
|
</pre>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}
|