import { useState, useEffect } from "react"; import { Cpu, LayoutGrid, FlaskConical, BookOpen, Github, Activity, ChevronRight, Zap } from "lucide-react"; import { api } from "./api"; import ModelManager from "./components/ModelManager"; import TestPanel from "./components/TestPanel"; import DocsView from "./components/DocsView"; import StatsBar from "./components/StatsBar"; const NAV = [ { id: "models", label: "Models", icon: LayoutGrid }, { id: "test", label: "Test API", icon: FlaskConical }, { id: "docs", label: "Integration Docs", icon: BookOpen }, ]; export default function App() { const [tab, setTab] = useState("models"); const [stats, setStats] = useState(null); const [health, setHealth] = useState(null); useEffect(() => { Promise.all([api.getStats(), api.getHealth()]) .then(([s, h]) => { setStats(s.data); setHealth(h.data); }) .catch(() => {}); const interval = setInterval(() => { api.getStats().then(s => setStats(s.data)).catch(() => {}); }, 30000); return () => clearInterval(interval); }, []); return (
{/* ── Header ─────────────────────────────────────────────────────── */}
{/* Logo */}
AI Gateway Hub
LiteLLM-powered
{/* Nav */} {/* Status + GitHub */}
{/* ── Stats bar ──────────────────────────────────────────────────── */} {stats && } {/* ── Main content ───────────────────────────────────────────────── */}
{tab === "models" && } {tab === "test" && } {tab === "docs" && }
{/* ── Footer ─────────────────────────────────────────────────────── */}
); } function StatusDot({ health }) { if (!health) return null; const allOk = Object.values(health).every(v => v === "ok"); return (
{allOk ? "online" : "degraded"}
); }