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]

feat(ui): migrate chat UI from antd to shadcn/ui

Krrish Dholakia11314f4baea3
diff --git a/ui/litellm-dashboard/eslint-metrics.json b/ui/litellm-dashboard/eslint-metrics.json
index cf754a1bb75..23774254b7d 100644
--- a/ui/litellm-dashboard/eslint-metrics.json
+++ b/ui/litellm-dashboard/eslint-metrics.json
@@ -1,5 +1,5 @@
{
"@typescript-eslint/no-explicit-any": 1991,
- "complexity": 128,
+ "complexity": 129,
"max-depth": 59
}
diff --git a/ui/litellm-dashboard/src/app/chat/page.test.tsx b/ui/litellm-dashboard/src/app/chat/page.test.tsx
index 658142d47a6..af85b6b8c7f 100644
--- a/ui/litellm-dashboard/src/app/chat/page.test.tsx
+++ b/ui/litellm-dashboard/src/app/chat/page.test.tsx
@@ -17,6 +17,7 @@ const { mockUseAuthorized, mockUseUISettings, mockUseUIConfig, mockReplace, stat
userRole: state.userRole,
userId: "user-1",
userEmail: "[email protected]",
+ premiumUser: false,
})),
mockUseUISettings: vi.fn(() => ({
data: { values: { enable_chat_ui: state.enableChatUI } },
diff --git a/ui/litellm-dashboard/src/app/chat/page.tsx b/ui/litellm-dashboard/src/app/chat/page.tsx
index f1053bec78d..21f34ba9f6e 100644
--- a/ui/litellm-dashboard/src/app/chat/page.tsx
+++ b/ui/litellm-dashboard/src/app/chat/page.tsx
@@ -9,7 +9,7 @@ import ChatPage from "@/components/chat/ChatPage";
// ChatPage uses useSearchParams() which requires a Suspense boundary for static export.
const ChatPageContent = () => {
- const { accessToken, userRole, userId, userEmail } = useAuthorized();
+ const { accessToken, userRole, userId, userEmail, premiumUser } = useAuthorized();
const { data: uiSettings, isLoading: isUISettingsLoading } = useUISettings();
const { data: uiConfig } = useUIConfig();
const router = useRouter();
@@ -33,6 +33,7 @@ const ChatPageContent = () => {
userRole={userRole ?? ""}
userId={userId ?? ""}
userEmail={userEmail ?? ""}
+ premiumUser={premiumUser ?? false}
/>
);
};
diff --git a/ui/litellm-dashboard/src/components/chat/ChatMessages.tsx b/ui/litellm-dashboard/src/components/chat/ChatMessages.tsx
index f29adcfb6a5..c92b9494e2c 100644
--- a/ui/litellm-dashboard/src/components/chat/ChatMessages.tsx
+++ b/ui/litellm-dashboard/src/components/chat/ChatMessages.tsx
@@ -1,7 +1,8 @@
"use client";
-import { ToolOutlined, CopyOutlined, CheckOutlined, EditOutlined } from "@ant-design/icons";
-import { Collapse, Tooltip } from "antd";
+import { Wrench, Copy, Check, Pencil } from "lucide-react";
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import React, { useEffect, useRef, useState } from "react";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
@@ -11,9 +12,6 @@ import ReasoningContent from "@/components/chat_ui/ReasoningContent";
import MCPEventsDisplay from "@/components/chat_ui/MCPEventsDisplay";
import { ChatMessage } from "./types";
-const { Panel } = Collapse;
-
-// Keys whose values must be redacted in tool args display
const REDACTED_KEY_PATTERNS = /token|key|secret|password|auth/i;
function redactSensitiveValues(obj: Record<string, unknown>): Record<string, unknown> {
@@ -43,8 +41,6 @@ function formatTimestamp(ts: number): string {
return `${hh}:${mm}`;
}
-// Shared markdown code renderer matching ReasoningContent style.
-// react-markdown v9 removed the `inline` prop; detect fenced blocks via language className.
function MarkdownCodeRenderer({
node,
className,
@@ -63,14 +59,12 @@ function MarkdownCodeRenderer({
{String(children).replace(/\n$/, "")}
</SyntaxHighlighter>
) : (
- <code className={`${className ?? ""} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`} {...props}>
+ <code className={`${className ?? ""} px-1.5 py-0.5 rounded bg-muted text-sm font-mono`} {...props}>
{children}
</code>
);
}
-// ------- Sub-components -------
-
interface UserBubbleProps {
message: ChatMessage;
onEdit?: (messageId: string, newContent: string) => void;
@@ -90,7 +84,6 @@ function UserBubble({ message, onEdit, isStreaming }: UserBubbleProps) {
}
}, [editing]);
- // Auto-resize textarea
useEffect(() => {
const ta = textareaRef.current;
if (!ta) return;
@@ -119,76 +112,34 @@ function UserBubble({ message, onEdit, isStreaming }: UserBubbleProps) {
if (editing) {
return (
- <div style={{ display: "flex", flexDirection: "column", alignItems: "flex-end" }}>
- <div
- style={{
- width: "72%",
- background: "#fff",
- border: "1.5px solid #1677ff",
- borderRadius: 12,
- overflow: "hidden",
- boxShadow: "0 0 0 3px rgba(22,119,255,0.1)",
- }}
- >
+ <div className="flex flex-col items-end">
+ <div className="w-[72%] bg-background border-2 border-primary rounded-xl overflow-hidden shadow-[0_0_0_3px_rgba(var(--primary)/0.1)]">
<textarea
ref={textareaRef}
value={editValue}
onChange={(e) => setEditValue(e.target.value)}
onKeyDown={handleKeyDown}
- style={{
- width: "100%",
- padding: "10px 14px",
- border: "none",
- outline: "none",
- resize: "none",
- fontSize: 14,
- lineHeight: "1.6",
- color: "#111827",
- fontFamily: "inherit",
- background: "transparent",
- boxSizing: "border-box",
- minHeight: 40,
- }}
+ className="w-full px-3.5 py-2.5 border-none outline-none resize-none text-sm leading-relaxed text-foreground font-[inherit] bg-transparent box-border min-h-[40px]"
/>
- <div
- style={{
- display: "flex",
- justifyContent: "flex-end",
- gap: 8,
- padding: "6px 10px 8px",
- borderTop: "1px solid #f0f0f0",
- }}
- >
+ <div className="flex justify-end gap-2 px-2.5 py-1.5 border-t">
<button
onClick={() => {
setEditValue(message.content);
setEditing(false);
}}
- style={{
- padding: "4px 12px",
- borderRadius: 6,
- border: "1px solid #d1d5db",
- background: "#fff",
- color: "#374151",
- fontSize: 13,
- cursor: "pointer",
- }}
+ className="px-3 py-1 rounded-md border text-[13px] text-muted-foreground hover:bg-accent transition-colors"
+ style={{ background: "none" }}
>
Cancel
</button>
<button
onClick={handleSave}
disabled={!editValue.trim()}
- style={{
- padding: "4px 12px",
- borderRadius: 6,
- border: "none",
- background: editValue.trim() ? "#1677ff" : "#f3f4f6",
- color: editValue.trim() ? "#fff" : "#9ca3af",
- fontSize: 13,
- fontWeight: 500,
- cursor: editValue.trim() ? "pointer" : "not-allowed",
- }}
+ className={`px-3 py-1 rounded-md border-none text-[13px] font-medium transition-colors ${
+ editValue.trim()
+ ? "bg-primary text-primary-foreground cursor-pointer hover:bg-primary/90"
+ : "bg-muted text-muted-foreground cursor-not-allowed"
+ }`}
>
Save &amp; Send
</button>
@@ -200,59 +151,37 @@ function UserBubble({ message, onEdit, isStreaming }: UserBubbleProps) {
return (
<div
- style={{ display: "flex", flexDirection: "column", alignItems: "flex-end", width: "100%" }}
+ className="flex flex-col items-end w-full"
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
>
- <div style={{ display: "flex", alignItems: "flex-end", gap: 6, maxWidth: "72%" }}>
- {/* Edit button — appears on hover, to the left of the bubble */}
+ <div className="flex items-end gap-1.5 max-w-[72%]">
{hovered && !isStreaming && onEdit && (
- <Tooltip title="Edit message">
- <button
- onClick={() => {
- setEditValue(message.content);
- setEditing(true);
- }}
- style={{
- background: "none",
- border: "none",
- cursor: "pointer",
- padding: "4px 6px",
- borderRadius: 5,
- color: "#9ca3af",
- fontSize: 13,
- flexShrink: 0,
- display: "flex",
- alignItems: "center",
- transition: "color 0.15s",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLButtonElement).style.color = "#6b7280";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLButtonElement).style.color = "#9ca3af";
- }}
- >
- <EditOutlined />
- </button>
- </Tooltip>
+ <TooltipProvider delayDuration={300}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ onClick={() => {
+ setEditValue(message.content);
+ setEditing(true);
+ }}
+ className="p-1 rounded-md text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center"
+ style={{ background: "none", border: "none" }}
+ >
+ <Pencil className="h-3.5 w-3.5" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Edit message</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
)}
- <div
- style={{
- backgroundColor: "#f0f2f5",
- borderRadius: 16,
- padding: "10px 14px",
- fontSize: 14,
- lineHeight: "1.6",
- whiteSpace: "pre-wrap",
- wordBreak: "break-word",
- color: "#111827",
- }}
- >
+ <div className="bg-muted rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed whitespace-pre-wrap break-words text-foreground">
{message.content}
</div>
</div>
- <span style={{ fontSize: 11, color: "#9ca3af", marginTop: 4 }}>{formatTimestamp(message.timestamp)}</span>
+ <span className="text-[11px] text-muted-foreground mt-1">{formatTimestamp(message.timestamp)}</span>
</div>
);
}
@@ -262,13 +191,10 @@ interface AssistantBubbleProps {
isLastMessage: boolean;
isStreaming: boolean;
isTypingIndicator: boolean;
- /** MCP events stored on the message — rendered inline below the response. */
mcpEvents?: ChatMessage["mcpEvents"];
}
function AssistantBubble({ message, isLastMessage, isStreaming, isTypingIndicator, mcpEvents }: AssistantBubbleProps) {
- // ReasoningContent manages its own expanded state; we bump this key to
- // remount it (collapsed by default) when streaming finishes.
const [reasoningKey, setReasoningKey] = useState(0);
const prevStreamingRef = useRef<boolean>(isStreaming);
@@ -280,20 +206,18 @@ function AssistantBubble({ message, isLastMessage, isStreaming, isTypingIndicato
}, [isStreaming]);
const showReasoningPlaceholder = isLastMessage && isStreaming && !message.reasoningContent;
-
const showReasoning = !!message.reasoningContent || showReasoningPlaceholder;
if (isTypingIndicator) {
return (
- <div style={{ display: "flex", flexDirection: "column", alignItems: "flex-start" }}>
- <div style={{ display: "flex", alignItems: "center", gap: 4, padding: "10px 4px" }}>
+ <div className="flex flex-col items-start">
+ <div className="flex items-center gap-1 px-1 py-2.5">
<TypingDots />
</div>
</div>
);
}
- // Split content at trailing "[stopped]"
let mainContent = message.content;
let stoppedSuffix = false;
if (mainContent.endsWith("[stopped]")) {
@@ -302,7 +226,7 @@ function AssistantBubble({ message, isLastMessage, isStreaming, isTypingIndicato
}
return (
- <div style={{ display: "flex", flexDirection: "column", alignItems: "flex-start", maxWidth: "80%" }}>
+ <div className="flex flex-col items-start max-w-[80%]">
{showReasoning &&
(showReasoningPlaceholder ? (
<ThinkingPlaceholder />
@@ -310,14 +234,7 @@ function AssistantBubble({ message, isLastMessage, isStreaming, isTypingIndicato
<ReasoningContent key={reasoningKey} reasoningContent={message.reasoningContent!} />
))}
- <div
- style={{
- fontSize: 14,
- lineHeight: "1.7",
- color: "#111827",
- wordBreak: "break-word",
- }}
- >
+ <div className="text-sm leading-[1.7] text-foreground break-words">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
components={{
@@ -326,12 +243,12 @@ function AssistantBubble({ message, isLastMessage, isStreaming, isTypingIndicato
>
{mainContent}
</ReactMarkdown>
- {stoppedSuffix && <span style={{ color: "#9ca3af", fontStyle: "italic" }}> [stopped]</span>}
+ {stoppedSuffix && <span className="text-muted-foreground italic"> [stopped]</span>}
</div>
<CopyButton text={mainContent} />
{mcpEvents && mcpEvents.length > 0 && (
- <div style={{ marginTop: 8, maxWidth: "100%" }}>
+ <div className="mt-2 max-w-full">
<MCPEventsDisplay events={mcpEvents} />
</div>
)}
@@ -349,39 +266,29 @@ function CopyButton({ text }: { text: string }) {
setCopied(true);
setTimeout(() => setCopied(false), 2000);
})
- .catch(() => {
- // clipboard not available (non-HTTPS or permission denied) — silently no-op
- });
+ .catch(() => {});
};
return (
- <div style={{ display: "flex", alignItems: "center", gap: 4, marginTop: 6 }}>
- <Tooltip title={copied ? "Copied!" : "Copy"}>
- <button
- onClick={handleCopy}
- style={{
- background: "none",
- border: "none",
- cursor: "pointer",
- padding: "4px 6px",
- borderRadius: 5,
- color: copied ? "#52c41a" : "#9ca3af",
- fontSize: 13,
- display: "flex",
- alignItems: "center",
- gap: 4,
- transition: "color 0.15s",
- }}
- onMouseEnter={(e) => {
- if (!copied) (e.currentTarget as HTMLButtonElement).style.color = "#6b7280";
- }}
- onMouseLeave={(e) => {
- if (!copied) (e.currentTarget as HTMLButtonElement).style.color = "#9ca3af";
- }}
- >
- {copied ? <CheckOutlined /> : <CopyOutlined />}
- </button>
- </Tooltip>
+ <div className="flex items-center gap-1 mt-1.5">
+ <TooltipProvider delayDuration={300}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ onClick={handleCopy}
+ className={`p-1 rounded-md flex items-center gap-1 transition-colors text-[13px] ${
+ copied ? "text-emerald-600" : "text-muted-foreground hover:text-foreground"
+ }`}
+ style={{ background: "none", border: "none" }}
+ >
+ {copied ? <Check className="h-3.5 w-3.5" /> : <Copy className="h-3.5 w-3.5" />}
+ </button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{copied ? "Copied!" : "Copy"}</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
</div>
);
}
@@ -398,21 +305,8 @@ function ThinkingPlaceholder() {
animation: thinking-pulse 1.4s ease-in-out infinite;
}
`}</style>
- <div
- style={{
- display: "inline-flex",
- alignItems: "center",
- gap: 6,
- padding: "4px 10px",
- marginBottom: 8,
- backgroundColor: "#f9fafb",
- border: "1px solid #e5e7eb",
- borderRadius: 8,
- fontSize: 12,
- color: "#6b7280",
- }}
- >
- <span className="chat-thinking-text">Thinking...</span>
+ <div className="inline-flex items-center gap-1.5 px-2.5 mb-2 bg-muted/50 border rounded-lg text-xs text-muted-foreground">
+ <span className="chat-thinking-text py-1">Thinking...</span>
</div>
</>
);
@@ -430,7 +324,7 @@ function TypingDots() {
width: 7px;
height: 7px;
border-radius: 50%;
- background-color: #9ca3af;
+ background-color: var(--color-muted-foreground);
animation: chat-typing-bounce 1.2s ease-in-out infinite;
}
.chat-dot:nth-child(2) { animation-delay: 0.2s; }
@@ -449,96 +343,43 @@ interface ToolCardProps {
function ToolCard({ message }: ToolCardProps) {
const redactedArgs = message.toolArgs ? redactSensitiveValues(message.toolArgs) : undefined;
+ const [open, setOpen] = useState(false);
return (
- <div style={{ maxWidth: "80%" }}>
- <Collapse
- size="small"
- style={{
- backgroundColor: "#fafafa",
- border: "1px solid #e5e7eb",
- borderRadius: 8,
- }}
- >
- <Panel
- header={
- <span style={{ display: "flex", alignItems: "center", gap: 6, fontSize: 13 }}>
- <ToolOutlined style={{ color: "#6b7280" }} />
- <span style={{ color: "#374151", fontWeight: 500 }}>{message.toolName ?? "Tool call"}</span>
- </span>
- }
- key="tool"
- >
+ <div className="max-w-[80%]">
+ <Collapsible open={open} onOpenChange={setOpen}>
+ <CollapsibleTrigger className="flex items-center gap-1.5 text-[13px] px-3 py-2 border rounded-lg bg-muted/50 hover:bg-muted transition-colors w-full text-left">
+ <Wrench className="h-3.5 w-3.5 text-muted-foreground" />
+ <span className="font-medium text-foreground">{message.toolName ?? "Tool call"}</span>
+ </CollapsibleTrigger>
+ <CollapsibleContent className="border border-t-0 rounded-b-lg px-3 py-2 bg-muted/30">
{redactedArgs !== undefined && (
- <div style={{ marginBottom: message.toolResult ? 12 : 0 }}>
- <div
- style={{
- fontSize: 11,
- fontWeight: 600,
- textTransform: "uppercase",
- letterSpacing: "0.05em",
- color: "#9ca3af",
- marginBottom: 4,
- }}
- >
+ <div className={message.toolResult ? "mb-3" : ""}>
+ <div className="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1">
Arguments
</div>
- <pre
- style={{
- margin: 0,
- padding: "8px 10px",
- backgroundColor: "#f3f4f6",
- borderRadius: 6,
- fontSize: 12,
- fontFamily:
- 'ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
- whiteSpace: "pre-wrap",
- wordBreak: "break-word",
- color: "#374151",
- }}
- >
+ <pre className="m-0 p-2 bg-muted rounded-md text-xs font-mono whitespace-pre-wrap break-words text-foreground">
{JSON.stringify(redactedArgs, null, 2)}
</pre>
</div>
)}
-
{message.toolResult && (
<div>
- <div
- style={{
- fontSize: 11,
- fontWeight: 600,
- textTransform: "uppercase",
- letterSpacing: "0.05em",
- color: "#9ca3af",
- marginBottom: 4,
- }}
- >
+ <div className="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1">
Result
</div>
- <div
- style={{
- fontSize: 13,
- color: "#374151",
- whiteSpace: "pre-wrap",
- wordBreak: "break-word",
- fontFamily:
- 'ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
- }}
- >
+ <div className="text-[13px] text-foreground whitespace-pre-wrap break-words font-mono">
{message.toolResult}
</div>
</div>
)}
- </Panel>
- </Collapse>
- <div style={{ fontSize: 11, color: "#9ca3af", marginTop: 4 }}>{formatTimestamp(message.timestamp)}</div>
+ </CollapsibleContent>
+ </Collapsible>
+ <div className="text-[11px] text-muted-foreground mt-1">{formatTimestamp(message.timestamp)}</div>
</div>
);
}
-// ------- Main component -------
-
interface Props {
messages: ChatMessage[];
isStreaming: boolean;
@@ -546,15 +387,12 @@ interface Props {
}
const ChatMessages: React.FC<Props> = ({ messages, isStreaming, onEditMessage }) => {
- // Scrolling is managed by ChatPage.tsx (scroll lock during streaming,
- // scroll-to-bottom on new message). No auto-scroll here.
-
const lastIndex = messages.length - 1;
const lastMsg = messages[lastIndex] ?? null;
const isTypingIndicator = isStreaming && lastMsg !== null && lastMsg.role === "assistant" && lastMsg.content === "";
return (
- <div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
+ <div className="flex flex-col gap-4">
{messages.map((msg, idx) => {
const isLastMessage = idx === lastIndex;
@@ -566,7 +404,6 @@ const ChatMessages: React.FC<Props> = ({ messages, isStreaming, onEditMessage })
return <ToolCard key={msg.id} message={msg} />;
}
- // assistant
return (
<AssistantBubble
key={msg.id}
diff --git a/ui/litellm-dashboard/src/components/chat/ChatPage.tsx b/ui/litellm-dashboard/src/components/chat/ChatPage.tsx
index c229de5ec79..58745ad485b 100644
--- a/ui/litellm-dashboard/src/components/chat/ChatPage.tsx
+++ b/ui/litellm-dashboard/src/components/chat/ChatPage.tsx
@@ -1,22 +1,28 @@
"use client";
import React, { useCallback, useEffect, useRef, useState, useLayoutEffect } from "react";
-import { Tooltip, Skeleton, Popover } from "antd";
-import MessageManager from "@/components/molecules/message_manager";
import {
- SettingOutlined,
- PlusOutlined,
- EditOutlined,
- MenuFoldOutlined,
- MenuUnfoldOutlined,
- SearchOutlined,
- MessageOutlined,
- AppstoreOutlined,
- KeyOutlined,
- ArrowLeftOutlined,
- DownOutlined,
- CheckOutlined,
-} from "@ant-design/icons";
+ Settings,
+ Plus,
+ Pencil,
+ PanelLeftClose,
+ PanelLeftOpen,
+ Search,
+ MessageSquare,
+ LayoutGrid,
+ KeyRound,
+ ArrowLeft,
+ ChevronDown,
+ Check,
+ Lock,
+ BarChart3,
+} from "lucide-react";
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import { Skeleton } from "@/components/ui/skeleton";
+import { Separator } from "@/components/ui/separator";
+import { ScrollArea } from "@/components/ui/scroll-area";
+import MessageManager from "@/components/molecules/message_manager";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { useRouter, useSearchParams } from "next/navigation";
@@ -26,6 +32,8 @@ import ChatMessages from "./ChatMessages";
import MCPConnectPicker from "./MCPConnectPicker";
import MCPAppsPanel from "./MCPAppsPanel";
import MCPCredentialsTab from "./MCPCredentialsTab";
+import KeysPanel from "./KeysPanel";
+import UsagePanel from "./UsagePanel";
import { fetchAvailableModels } from "@/components/llm_calls/fetch_models";
import { makeOpenAIChatCompletionRequest } from "@/components/llm_calls/chat_completion";
import { makeOpenAIResponsesRequest } from "@/components/llm_calls/responses_api";
@@ -34,13 +42,6 @@ import { getProxyBaseUrl } from "@/components/networking";
import { useUIConfig } from "@/app/(dashboard)/hooks/uiConfig/useUIConfig";
import { getProviderLogoAndName } from "@/components/provider_info_helpers";
-interface ChatPageProps {
- accessToken: string;
- userRole: string;
- userId: string;
- userEmail?: string;
-}
-
const SUGGESTIONS = ["Write", "Learn", "Code", "Brainstorm"];
const MAX_COMPARISON_MODELS = 3;
const LOCALSTORAGE_MODEL_KEY = "litellm_chat_selected_models";
@@ -135,7 +136,15 @@ async function streamToModel({
}
}
-const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, userEmail }) => {
+interface ChatPageProps {
+ accessToken: string;
+ userRole: string;
+ userId: string;
+ userEmail?: string;
+ premiumUser?: boolean;
+}
+
+const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, userEmail, premiumUser = false }) => {
const router = useRouter();
const searchParams = useSearchParams();
const activeConversationId = searchParams.get("id");
@@ -161,7 +170,7 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
const [mcpPopoverOpen, setMcpPopoverOpen] = useState(false);
const [sidebarCollapsed, setSidebarCollapsed] = useState(false);
const _oauthReturn = searchParams?.get("mcpOauthReturn");
- const [sidebarView, setSidebarView] = useState<"chats" | "apps" | "credentials">(
+ const [sidebarView, setSidebarView] = useState<"chats" | "apps" | "credentials" | "keys" | "usage">(
_oauthReturn === "apps" ? "apps" : "chats",
);
const [storageBannerDismissed, setStorageBannerDismissed] = useState(false);
@@ -554,32 +563,23 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
return 0;
});
- // ---- Model selector popover content ----
const modelSelectorContent = (
- <div style={{ width: 280, maxHeight: 400, display: "flex", flexDirection: "column" }}>
- <div style={{ padding: "8px 8px 4px" }}>
+ <div className="w-[280px] max-h-[400px] flex flex-col">
+ <div className="p-2 pb-1">
<input
autoFocus
value={modelSearchText}
onChange={(e) => setModelSearchText(e.target.value)}
placeholder="Search models..."
- style={{
- width: "100%",
- padding: "6px 10px",
- border: "1px solid #d1d5db",
- borderRadius: 6,
- fontSize: 13,
- outline: "none",
- boxSizing: "border-box",
- }}
+ className="w-full px-2.5 py-1.5 border rounded-md text-[13px] outline-none bg-background text-foreground"
/>
</div>
{selectedModels.length >= MAX_COMPARISON_MODELS && (
- <div style={{ padding: "4px 12px", fontSize: 12, color: "#6b7280" }}>
- Max {MAX_COMPARISON_MODELS} models selected — deselect one to change.
+ <div className="px-3 py-1 text-xs text-muted-foreground">
+ Max {MAX_COMPARISON_MODELS} models selected; deselect one to change
</div>
)}
- <div style={{ flex: 1, overflowY: "auto" }}>
+ <ScrollArea className="flex-1">
{filteredModels.map((m) => {
const checked = selectedModels.includes(m);
const disabled = !checked && selectedModels.length >= MAX_COMPARISON_MODELS;
@@ -590,67 +590,38 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
key={m}
disabled={disabled}
onClick={() => toggleModel(m)}
- style={{
- display: "flex",
- alignItems: "center",
- gap: 8,
- width: "100%",
- padding: "7px 12px",
- background: checked ? "#eff6ff" : "transparent",
- border: "none",
- cursor: disabled ? "not-allowed" : "pointer",
- textAlign: "left",
- opacity: disabled ? 0.45 : 1,
- borderRadius: 4,
- }}
+ className={`flex items-center gap-2 w-full px-3 py-[7px] border-none text-left rounded transition-colors ${
+ checked ? "bg-accent" : "bg-transparent hover:bg-accent/50"
+ } ${disabled ? "opacity-45 cursor-not-allowed" : "cursor-pointer"}`}
>
<span
- style={{
- width: 16,
- height: 16,
- borderRadius: 3,
- border: `1.5px solid ${checked ? "#1677ff" : "#d1d5db"}`,
- background: checked ? "#1677ff" : "#fff",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- flexShrink: 0,
- transition: "all 0.1s",
- }}
+ className={`w-4 h-4 rounded-[3px] flex items-center justify-center shrink-0 transition-all ${
+ checked ? "bg-primary border-primary" : "bg-background border-border"
+ }`}
+ style={{ border: `1.5px solid ${checked ? "var(--color-primary)" : "var(--color-border)"}` }}
>
- {checked && <CheckOutlined style={{ fontSize: 10, color: "#fff" }} />}
+ {checked && <Check className="h-2.5 w-2.5 text-primary-foreground" />}
</span>
{logo ? (
<img
src={logo}
alt=""
- style={{ width: 16, height: 16, objectFit: "contain", flexShrink: 0 }}
+ className="w-4 h-4 object-contain shrink-0"
onError={(e) => {
(e.currentTarget as HTMLImageElement).style.display = "none";
}}
/>
) : (
- <span style={{ width: 16, flexShrink: 0 }} />
+ <span className="w-4 shrink-0" />
)}
- <span
- style={{
- fontSize: 13,
- color: "#111827",
- overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "nowrap",
- }}
- >
- {m}
- </span>
+ <span className="text-[13px] text-foreground overflow-hidden text-ellipsis whitespace-nowrap">{m}</span>
</button>
);
})}
- </div>
+ </ScrollArea>
</div>
);
- // ---- Sidebar nav item renderer ----
const sidebarNavItem = ({
icon,
label,
@@ -663,47 +634,42 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
onClick: () => void;
active?: boolean;
kbd?: string;
- }) => (
- <Tooltip title={sidebarCollapsed ? label : undefined} placement="right" key={label}>
+ }) => {
+ const btn = (
<button
+ key={label}
onClick={onClick}
- style={{
- display: "flex",
- alignItems: "center",
- gap: 10,
- padding: "8px 10px",
- width: "100%",
- borderRadius: 7,
- border: "none",
- cursor: "pointer",
- background: active ? "#e8f4ff" : "transparent",
- color: active ? "#1677ff" : "#374151",
- textAlign: "left",
- fontSize: 14,
- justifyContent: sidebarCollapsed ? "center" : "flex-start",
- transition: "background 0.12s",
- }}
- onMouseEnter={(e) => {
- if (!active) (e.currentTarget as HTMLButtonElement).style.background = "#f5f5f5";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLButtonElement).style.background = active ? "#e8f4ff" : "transparent";
- }}
+ className={`flex items-center gap-2.5 px-2.5 py-2 w-full rounded-md border-none text-sm transition-colors ${
+ sidebarCollapsed ? "justify-center" : "justify-start"
+ } ${active ? "bg-accent text-accent-foreground" : "text-foreground/70 hover:bg-accent/50"}`}
+ style={{ cursor: "pointer", background: active ? undefined : undefined }}
>
- <span style={{ fontSize: 16, flexShrink: 0 }}>{icon}</span>
+ <span className="shrink-0">{icon}</span>
{!sidebarCollapsed && (
<>
- <span style={{ flex: 1 }}>{label}</span>
- {kbd && <span style={{ fontSize: 11, color: "#9ca3af" }}>{kbd}</span>}
+ <span className="flex-1 font-medium">{label}</span>
+ {kbd && <span className="text-[11px] text-muted-foreground">{kbd}</span>}
</>
)}
</button>
- </Tooltip>
- );
+ );
+ if (sidebarCollapsed) {
+ return (
+ <TooltipProvider key={label} delayDuration={200}>
+ <Tooltip>
+ <TooltipTrigger asChild>{btn}</TooltipTrigger>
+ <TooltipContent side="right">
+ <p>{label}</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+ }
+ return btn;
+ };
- // ---- Model selector trigger button ----
const modelSelectorTrigger = isLoadingModels ? (
- <Skeleton.Input active style={{ width: 160, height: 28 }} />
+ <Skeleton className="w-40 h-7" />
) : (
<Popover
open={modelSelectorOpen}
@@ -711,185 +677,103 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
setModelSelectorOpen(open);
if (!open) setModelSearchText("");
}}
- content={modelSelectorContent}
- trigger="click"
- placement="bottomLeft"
>
- <button
- style={{
- display: "flex",
- alignItems: "center",
- gap: 6,
- padding: "5px 10px",
- borderRadius: 7,
- border: "1px solid transparent",
- cursor: "pointer",
- background: "transparent",
- color: "#111827",
- fontSize: 14,
- fontWeight: 500,
- maxWidth: 480,
- overflow: "hidden",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLButtonElement).style.background = "#f5f5f5";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLButtonElement).style.background = "transparent";
- }}
- >
- {selectedModels.length === 0 ? (
- <span style={{ color: "#9ca3af" }}>Select model</span>
- ) : selectedModels.length === 1 ? (
- <>
- {(() => {
- const provider = getProviderFromModelName(selectedModels[0]);
- const { logo } = provider ? getProviderLogoAndName(provider) : { logo: "" };
- return logo ? (
- <img
- src={logo}
- alt=""
- style={{ width: 18, height: 18, objectFit: "contain", flexShrink: 0 }}
- onError={(e) => {
- (e.currentTarget as HTMLImageElement).style.display = "none";
- }}
- />
- ) : null;
- })()}
- <span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", maxWidth: 240 }}>
- {selectedModels[0]}
- </span>
- </>
- ) : (
- <div style={{ display: "flex", alignItems: "center", gap: 4, flexWrap: "nowrap", overflow: "hidden" }}>
- {selectedModels.map((m) => {
- const provider = getProviderFromModelName(m);
- const { logo } = provider ? getProviderLogoAndName(provider) : { logo: "" };
- return (
- <span
- key={m}
- style={{
- display: "inline-flex",
- alignItems: "center",
- gap: 4,
- padding: "2px 8px",
- background: "#f0f4ff",
- borderRadius: 10,
- fontSize: 12,
- color: "#1677ff",
- fontWeight: 500,
- flexShrink: 0,
- }}
- >
- {logo && (
- <img
- src={logo}
- alt=""
- style={{ width: 13, height: 13, objectFit: "contain" }}
- onError={(e) => {
- (e.currentTarget as HTMLImageElement).style.display = "none";
- }}
- />
- )}
- <span style={{ maxWidth: 120, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
- {m}
+ <PopoverTrigger asChild>
+ <button className="flex items-center gap-1.5 px-2.5 py-[5px] rounded-md border border-transparent cursor-pointer bg-transparent text-foreground text-sm font-medium max-w-[480px] overflow-hidden hover:bg-accent/50 transition-colors">
+ {selectedModels.length === 0 ? (
+ <span className="text-muted-foreground">Select model</span>
+ ) : selectedModels.length === 1 ? (
+ <>
+ {(() => {
+ const provider = getProviderFromModelName(selectedModels[0]);
+ const { logo } = provider ? getProviderLogoAndName(provider) : { logo: "" };
+ return logo ? (
+ <img
+ src={logo}
+ alt=""
+ className="w-[18px] h-[18px] object-contain shrink-0"
+ onError={(e) => {
+ (e.currentTarget as HTMLImageElement).style.display = "none";
+ }}
+ />
+ ) : null;
+ })()}
+ <span className="overflow-hidden text-ellipsis whitespace-nowrap max-w-[240px]">{selectedModels[0]}</span>
+ </>
+ ) : (
+ <div className="flex items-center gap-1 flex-nowrap overflow-hidden">
+ {selectedModels.map((m) => {
+ const provider = getProviderFromModelName(m);
+ const { logo } = provider ? getProviderLogoAndName(provider) : { logo: "" };
+ return (
+ <span
+ key={m}
+ className="inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 rounded-[10px] text-xs text-primary font-medium shrink-0"
+ >
+ {logo && (
+ <img
+ src={logo}
+ alt=""
+ className="w-[13px] h-[13px] object-contain"
+ onError={(e) => {
+ (e.currentTarget as HTMLImageElement).style.display = "none";
+ }}
+ />
+ )}
+ <span className="max-w-[120px] overflow-hidden text-ellipsis whitespace-nowrap">{m}</span>
</span>
- </span>
- );
- })}
- </div>
- )}
- <DownOutlined style={{ fontSize: 10, color: "#9ca3af", flexShrink: 0, marginLeft: 2 }} />
- </button>
+ );
+ })}
+ </div>
+ )}
+ <ChevronDown className="h-2.5 w-2.5 text-muted-foreground shrink-0 ml-0.5" />
+ </button>
+ </PopoverTrigger>
+ <PopoverContent align="start" className="p-0 w-auto">
+ {modelSelectorContent}
+ </PopoverContent>
</Popover>
);
- // ---- Shared input bar ----
const inputBar = (inConversation: boolean) => (
- <div
- style={{
- background: "#fff",
- borderRadius: 12,
- border: "1px solid #e5e7eb",
- boxShadow: "0 1px 6px rgba(0,0,0,0.06)",
- overflow: "hidden",
- }}
- >
+ <div className="bg-background rounded-xl border shadow-[0_1px_6px_rgba(0,0,0,0.06)] overflow-hidden">
<textarea
ref={textareaRef}
value={inputText}
onChange={(e) => setInputText(e.target.value)}
onKeyDown={handleKeyDown}
placeholder={inConversation ? "Send a message..." : "How can I help you today?"}
+ className="w-full border-none outline-none resize-none text-[15px] text-foreground bg-transparent font-[inherit] box-border"
style={{
- width: "100%",
minHeight: inConversation ? 52 : 80,
padding: inConversation ? "16px 20px 8px" : "20px 20px 8px",
- border: "none",
- outline: "none",
- resize: "none",
- fontSize: 15,
- color: "#111827",
- background: "transparent",
- fontFamily: "inherit",
- boxSizing: "border-box",
}}
/>
<div
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- padding: inConversation ? "4px 12px 10px" : "8px 12px 12px",
- borderTop: "1px solid #f3f4f6",
- }}
+ className="flex items-center justify-between border-t"
+ style={{ padding: inConversation ? "4px 12px 10px" : "8px 12px 12px" }}
>
- <Popover
- open={mcpPopoverOpen}
- onOpenChange={setMcpPopoverOpen}
- content={
+ <Popover open={mcpPopoverOpen} onOpenChange={setMcpPopoverOpen}>
+ <PopoverTrigger asChild>
+ <button className="border rounded-md px-2.5 py-[5px] cursor-pointer text-sm text-muted-foreground flex items-center gap-1 bg-transparent hover:bg-accent/50 transition-colors">
+ <Plus className="h-3.5 w-3.5" />
+ {selectedMCPServers.length > 0 && (
+ <span className="text-xs text-primary font-medium">{selectedMCPServers.length}</span>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent side="top" align="start" className="p-0 w-auto">
<MCPConnectPicker
accessToken={accessToken}
selectedServers={selectedMCPServers}
onChange={setSelectedMCPServers}
/>
- }
- trigger="click"
- placement="topLeft"
- >
- <button
- style={{
- background: "none",
- border: "1px solid #d1d5db",
- borderRadius: 6,
- padding: "5px 10px",
- cursor: "pointer",
- fontSize: 14,
- color: "#6b7280",
- display: "flex",
- alignItems: "center",
- gap: 4,
- }}
- >
- <PlusOutlined />
- {selectedMCPServers.length > 0 && (
- <span style={{ fontSize: 12, color: "#1677ff", fontWeight: 500 }}>{selectedMCPServers.length}</span>
- )}
- </button>
+ </PopoverContent>
</Popover>
- <div style={{ display: "flex", alignItems: "center", gap: 8 }}>
+ <div className="flex items-center gap-2">
{!isComparisonMode && (
- <span
- style={{
- fontSize: 12,
- color: "#9ca3af",
- maxWidth: 160,
- overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "nowrap",
- }}
- >
+ <span className="text-xs text-muted-foreground max-w-[160px] overflow-hidden text-ellipsis whitespace-nowrap">
{inConversation
? selectedMCPServers.length > 0
? `${selectedMCPServers.length} tool${selectedMCPServers.length > 1 ? "s" : ""} connected`
@@ -900,44 +784,19 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
{isAnyStreaming ? (
<button
onClick={handleStop}
- style={{
- background: "none",
- border: "1.5px solid #d1d5db",
- borderRadius: "50%",
- width: 32,
- height: 32,
- cursor: "pointer",
- color: "#374151",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- flexShrink: 0,
- transition: "border-color 0.15s",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLButtonElement).style.borderColor = "#9ca3af";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLButtonElement).style.borderColor = "#d1d5db";
- }}
+ className="w-8 h-8 rounded-full border-[1.5px] flex items-center justify-center shrink-0 cursor-pointer transition-colors hover:border-muted-foreground bg-transparent text-foreground"
>
- <div style={{ width: 10, height: 10, background: "#374151", borderRadius: 2 }} />
+ <div className="w-2.5 h-2.5 bg-foreground rounded-[2px]" />
</button>
) : (
<button
onClick={() => handleSubmit(inputText)}
disabled={!inputText.trim() || isLoadingModels || selectedModels.length === 0}
- style={{
- background: inputText.trim() && selectedModels.length > 0 ? "#1677ff" : "#f3f4f6",
- border: "none",
- borderRadius: 7,
- padding: "7px 16px",
- cursor: inputText.trim() && selectedModels.length > 0 ? "pointer" : "not-allowed",
- color: inputText.trim() && selectedModels.length > 0 ? "#fff" : "#9ca3af",
- fontSize: 14,
- fontWeight: 500,
- transition: "background 0.15s",
- }}
+ className={`border-none rounded-md px-4 py-[7px] text-sm font-medium transition-colors ${
+ inputText.trim() && selectedModels.length > 0
+ ? "bg-primary text-primary-foreground cursor-pointer hover:bg-primary/90"
+ : "bg-muted text-muted-foreground cursor-not-allowed"
+ }`}
>
Send
</button>
@@ -949,137 +808,117 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
return (
<div
- style={{
- display: "flex",
- height: "100vh",
- width: "100vw",
- background: "#ffffff",
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
- overflow: "hidden",
- }}
+ className="flex h-screen w-screen bg-background overflow-hidden"
+ style={{ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif" }}
>
- {/* ===== LEFT SIDEBAR ===== */}
<div
- style={{
- width: sidebarCollapsed ? 56 : 260,
- flexShrink: 0,
- background: "#f9fafb",
- borderRight: "1px solid #e5e7eb",
- display: "flex",
- flexDirection: "column",
- overflow: "hidden",
- transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
- }}
+ className="shrink-0 bg-secondary border-r flex flex-col overflow-hidden"
+ style={{ width: sidebarCollapsed ? 56 : 260, transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)" }}
>
- {/* Sidebar header: logo + collapse button */}
<div
- style={{
- display: "flex",
- alignItems: "center",
- padding: "12px 10px",
- justifyContent: sidebarCollapsed ? "center" : "space-between",
- flexShrink: 0,
- }}
+ className={`flex items-center px-2.5 py-3 shrink-0 ${sidebarCollapsed ? "justify-center" : "justify-between"}`}
>
{!sidebarCollapsed && (
- <div style={{ display: "flex", alignItems: "center", gap: 8 }}>
- <img
- src={logoSrc}
- alt="LiteLLM"
- style={{ height: 28, maxWidth: 120, objectFit: "contain", flexShrink: 0 }}
- />
+ <div className="flex items-center gap-2">
+ <img src={logoSrc} alt="LiteLLM" className="h-7 max-w-[120px] object-contain shrink-0" />
</div>
)}
- <Tooltip title={sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar"} placement="right">
- <button
- onClick={() => setSidebarCollapsed((v) => !v)}
- style={{
- background: "none",
- border: "none",
- cursor: "pointer",
- padding: 6,
- borderRadius: 7,
- color: "#6b7280",
- fontSize: 16,
- display: "flex",
- alignItems: "center",
- }}
- >
- {sidebarCollapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
- </button>
- </Tooltip>
+ <TooltipProvider delayDuration={200}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ onClick={() => setSidebarCollapsed((v) => !v)}
+ className="p-1.5 rounded-md text-muted-foreground hover:text-foreground flex items-center cursor-pointer transition-colors"
+ style={{ background: "none", border: "none" }}
+ >
+ {sidebarCollapsed ? <PanelLeftOpen className="h-4 w-4" /> : <PanelLeftClose className="h-4 w-4" />}
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="right">
+ <p>{sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar"}</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
</div>
- {/* Sidebar nav buttons */}
- <div style={{ padding: "0 8px 4px", flexShrink: 0 }}>
+ <div className="px-2 pb-1 shrink-0">
{sidebarNavItem({
- icon: <EditOutlined />,
+ icon: <Pencil className="h-4 w-4" />,
label: "New chat",
onClick: () => router.push(getChatUrl(uiRoot)),
})}
{sidebarNavItem({
- icon: <SearchOutlined />,
+ icon: <Search className="h-4 w-4" />,
label: "Search chats",
onClick: () => setSidebarView("chats"),
})}
</div>
- <div style={{ height: 1, background: "#e5e7eb", margin: "4px 8px", flexShrink: 0 }} />
+ <Separator className="mx-2 shrink-0" />
- {/* Chats / Apps tabs + Back to console */}
- <div style={{ padding: "4px 8px", flexShrink: 0 }}>
+ <div className="px-2 py-1 shrink-0">
{sidebarNavItem({
- icon: <MessageOutlined />,
+ icon: <MessageSquare className="h-4 w-4" />,
label: "Chats",
onClick: () => setSidebarView("chats"),
active: sidebarView === "chats",
})}
{sidebarNavItem({
- icon: <AppstoreOutlined />,
+ icon: <LayoutGrid className="h-4 w-4" />,
label: "Apps",
onClick: () => setSidebarView("apps"),
active: sidebarView === "apps",
})}
{sidebarNavItem({
- icon: <KeyOutlined />,
+ icon: <KeyRound className="h-4 w-4" />,
label: "Credentials",
onClick: () => setSidebarView("credentials"),
active: sidebarView === "credentials",
})}
- <Tooltip title={sidebarCollapsed ? "Back to Developer Console UI" : undefined} placement="right">
- <a
- href={dashboardUrl}
- style={{
- display: "flex",
- alignItems: "center",
- gap: 10,
- padding: "8px 10px",
- width: "100%",
- borderRadius: 7,
- color: "#6b7280",
- textDecoration: "none",
- fontSize: 14,
- justifyContent: sidebarCollapsed ? "center" : "flex-start",
- boxSizing: "border-box",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLAnchorElement).style.background = "#f5f5f5";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLAnchorElement).style.background = "transparent";
- }}
- >
- <ArrowLeftOutlined style={{ fontSize: 16, flexShrink: 0 }} />
- {!sidebarCollapsed && <span>Back to Developer Console UI</span>}
- </a>
- </Tooltip>
+ {sidebarNavItem({
+ icon: <Lock className="h-4 w-4" />,
+ label: "API Keys",
+ onClick: () => setSidebarView("keys"),
+ active: sidebarView === "keys",
+ })}
+ {sidebarNavItem({
+ icon: <BarChart3 className="h-4 w-4" />,
+ label: "Usage",
+ onClick: () => setSidebarView("usage"),
+ active: sidebarView === "usage",
+ })}
+ {(() => {
+ const link = (
+ <a
+ href={dashboardUrl}
+ className={`flex items-center gap-2.5 px-2.5 py-2 w-full rounded-md text-muted-foreground no-underline text-sm hover:bg-accent/50 transition-colors ${
+ sidebarCollapsed ? "justify-center" : "justify-start"
+ }`}
+ >
+ <ArrowLeft className="h-4 w-4 shrink-0" />
+ {!sidebarCollapsed && <span>Back to Developer Console UI</span>}
+ </a>
+ );
+ if (sidebarCollapsed) {
+ return (
+ <TooltipProvider delayDuration={200}>
+ <Tooltip>
+ <TooltipTrigger asChild>{link}</TooltipTrigger>
+ <TooltipContent side="right">
+ <p>Back to Developer Console UI</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+ }
+ return link;
+ })()}
</div>
- <div style={{ height: 1, background: "#e5e7eb", margin: "4px 8px", flexShrink: 0 }} />
+ <Separator className="mx-2 shrink-0" />
- {/* Sidebar content — only conversation list, only when in chats view and expanded */}
{!sidebarCollapsed && sidebarView === "chats" && (
- <div style={{ flex: 1, overflow: "hidden", display: "flex", flexDirection: "column" }}>
+ <div className="flex-1 overflow-hidden flex flex-col">
<ConversationList
conversations={conversations}
activeConversationId={activeConversationId}
@@ -1095,96 +934,44 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
)}
</div>
- {/* ===== MAIN AREA ===== */}
- <div style={{ flex: 1, display: "flex", flexDirection: "column", overflow: "hidden", minWidth: 0 }}>
- {/* Top bar */}
- <div
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- padding: "8px 16px",
- flexShrink: 0,
- borderBottom: "1px solid #f0f0f0",
- background: "#fff",
- height: 48,
- }}
- >
- {/* Left: model selector */}
- <div style={{ display: "flex", alignItems: "center", gap: 8, minWidth: 0, flex: 1 }}>
- {modelSelectorTrigger}
- </div>
-
- {/* Right: settings */}
- <div style={{ display: "flex", alignItems: "center", gap: 4, flexShrink: 0 }}>
- <Tooltip title="Settings">
- <button
- style={{
- background: "none",
- border: "none",
- cursor: "pointer",
- padding: 7,
- borderRadius: 7,
- color: "#6b7280",
- fontSize: 16,
- display: "flex",
- alignItems: "center",
- }}
- >
- <SettingOutlined />
- </button>
- </Tooltip>
+ <div className="flex-1 flex flex-col overflow-hidden min-w-0">
+ <div className="flex items-center justify-between px-4 py-2 shrink-0 border-b bg-background h-12">
+ <div className="flex items-center gap-2 min-w-0 flex-1">{modelSelectorTrigger}</div>
+ <div className="flex items-center gap-1 shrink-0">
+ <TooltipProvider delayDuration={200}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ className="p-[7px] rounded-md text-muted-foreground hover:text-foreground flex items-center cursor-pointer transition-colors"
+ style={{ background: "none", border: "none" }}
+ >
+ <Settings className="h-4 w-4" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Settings</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
</div>
</div>
- {/* Storage warning banner */}
{storageUnavailable && !storageBannerDismissed && (
- <div
- style={{
- background: "#fffbe6",
- borderBottom: "1px solid #ffe58f",
- padding: "6px 20px",
- fontSize: 13,
- color: "#874d00",
- display: "flex",
- justifyContent: "space-between",
- alignItems: "center",
- }}
- >
- <span>Chat history won&apos;t be saved in this browser session.</span>
+ <div className="bg-amber-50 border-b border-amber-200 px-5 py-1.5 text-[13px] text-amber-800 flex justify-between items-center">
+ <span>Chat history won&apos;t be saved in this browser session</span>
<button
onClick={() => setStorageBannerDismissed(true)}
- style={{ background: "none", border: "none", cursor: "pointer", fontSize: 16, color: "#874d00" }}
+ className="text-amber-800 text-base cursor-pointer"
+ style={{ background: "none", border: "none" }}
>
- ×
+ &times;
</button>
</div>
)}
- {/* Content area */}
- <div
- style={{
- flex: 1,
- minHeight: 0,
- overflow: "hidden",
- display: "flex",
- flexDirection: "column",
- background: "#fff",
- }}
- >
- {/* ---- Apps page view ---- */}
+ <div className="flex-1 min-h-0 overflow-hidden flex flex-col bg-background">
{sidebarView === "apps" ? (
- <div
- style={{
- flex: 1,
- minHeight: 0,
- overflow: "auto",
- maxWidth: 800,
- margin: "0 auto",
- width: "100%",
- padding: "32px 24px",
- }}
- >
+ <div className="flex-1 min-h-0 overflow-auto max-w-[800px] mx-auto w-full py-8 px-6">
<MCPAppsPanel
accessToken={accessToken}
selectedServers={selectedMCPServers}
@@ -1192,105 +979,49 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
/>
</div>
) : sidebarView === "credentials" ? (
- /* ---- Credentials view ---- */
- <div
- style={{
- flex: 1,
- minHeight: 0,
- overflow: "auto",
- maxWidth: 800,
- margin: "0 auto",
- width: "100%",
- padding: "32px 24px",
- }}
- >
+ <div className="flex-1 min-h-0 overflow-auto max-w-[800px] mx-auto w-full py-8 px-6">
<MCPCredentialsTab accessToken={accessToken} />
</div>
+ ) : sidebarView === "keys" ? (
+ <div className="flex-1 min-h-0 overflow-auto max-w-[800px] mx-auto w-full py-8 px-6">
+ <KeysPanel accessToken={accessToken} userId={userId} premiumUser={premiumUser} />
+ </div>
+ ) : sidebarView === "usage" ? (
+ <div className="flex-1 min-h-0 overflow-auto max-w-[800px] mx-auto w-full py-8 px-6">
+ <UsagePanel accessToken={accessToken} userId={userId} />
+ </div>
) : showBlankState ? (
- /* ---- Blank state ---- */
- <div
- style={{
- flex: 1,
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- justifyContent: "center",
- padding: "0 24px 80px",
- }}
- >
- {/* Greeting */}
- <h1
- style={{
- margin: "0 0 32px",
- fontSize: 28,
- fontWeight: 600,
- color: "#111827",
- fontFamily: "inherit",
- letterSpacing: "-0.01em",
- textAlign: "center",
- }}
- >
+ <div className="flex-1 flex flex-col items-center justify-center px-6 pb-20">
+ <h1 className="m-0 mb-8 text-[28px] font-semibold text-foreground tracking-tight text-center">
{isComparisonMode ? `Compare ${selectedModels.length} models` : greeting}
</h1>
{isComparisonMode ? (
- <p style={{ margin: "-16px 0 24px", fontSize: 14, color: "#6b7280", textAlign: "center" }}>
+ <p className="-mt-4 mb-6 text-sm text-muted-foreground text-center">
Send a message to see responses side-by-side
</p>
) : (
- <p
- style={{
- margin: "-16px 0 28px",
- fontSize: 14,
- color: "#6b7280",
- textAlign: "center",
- maxWidth: 520,
- lineHeight: 1.6,
- }}
- >
- Chat with 100+ LLMs + MCP tools — authenticate once, use them here.{" "}
+ <p className="-mt-4 mb-7 text-sm text-muted-foreground text-center max-w-[520px] leading-relaxed">
+ Chat with 100+ LLMs + MCP tools; authenticate once, use them here.{" "}
<button
onClick={() => setSidebarView("apps")}
- style={{
- background: "none",
- border: "none",
- cursor: "pointer",
- color: "#1677ff",
- fontSize: 14,
- padding: 0,
- fontWeight: 500,
- }}
+ className="text-primary text-sm font-medium cursor-pointer hover:underline"
+ style={{ background: "none", border: "none", padding: 0 }}
>
- Open Apps →
+ Open Apps -&gt;
</button>
</p>
)}
- {/* Input card */}
- <div style={{ width: "100%", maxWidth: 680 }}>{inputBar(false)}</div>
+ <div className="w-full max-w-[680px]">{inputBar(false)}</div>
- {/* Suggestion chips — only in single-model mode */}
{!isComparisonMode && (
- <div style={{ display: "flex", gap: 8, marginTop: 14, flexWrap: "wrap", justifyContent: "center" }}>
+ <div className="flex gap-2 mt-3.5 flex-wrap justify-center">
{SUGGESTIONS.map((s) => (
<button
key={s}
onClick={() => setInputText(s + ": ")}
- style={{
- background: "#f9fafb",
- border: "1px solid #e5e7eb",
- borderRadius: 20,
- padding: "7px 16px",
- fontSize: 14,
- color: "#374151",
- cursor: "pointer",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLButtonElement).style.background = "#f3f4f6";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLButtonElement).style.background = "#f9fafb";
- }}
+ className="bg-secondary border rounded-full px-4 py-[7px] text-sm text-foreground/70 cursor-pointer hover:bg-accent transition-colors"
>
{s}
</button>
@@ -1299,174 +1030,77 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
)}
</div>
) : (
- /* ---- Active conversation (single-model or comparison) ---- */
<div
- style={{
- flex: 1,
- minHeight: 0,
- display: "flex",
- flexDirection: "column",
- maxWidth: isComparisonMode ? (selectedModels.length >= 3 ? 1200 : 960) : 760,
- margin: "0 auto",
- width: "100%",
- padding: "0 24px",
- position: "relative",
- }}
+ className="flex-1 min-h-0 flex flex-col mx-auto w-full px-6 relative"
+ style={{ maxWidth: isComparisonMode ? (selectedModels.length >= 3 ? 1200 : 960) : 760 }}
>
<div
ref={messagesScrollRef}
- style={{ flex: 1, minHeight: 0, overflow: "auto", paddingTop: 24, overflowAnchor: "none" }}
+ className="flex-1 min-h-0 overflow-auto pt-6"
+ style={{ overflowAnchor: "none" }}
>
{isComparisonMode ? (
- /* Comparison: multi-turn exchanges, each with user bubble + side-by-side response cards */
- <div style={{ paddingBottom: 8 }}>
+ <div className="pb-2">
{comparisonExchanges.map((exchange, exchangeIdx) => {
const isLastExchange = exchangeIdx === comparisonExchanges.length - 1;
return (
- <div key={exchangeIdx} style={{ marginBottom: 32 }}>
- {/* User message bubble */}
- <div style={{ display: "flex", justifyContent: "flex-end", marginBottom: 20 }}>
- <div
- style={{
- background: "#f3f4f6",
- borderRadius: 16,
- padding: "10px 16px",
- maxWidth: "75%",
- fontSize: 14,
- color: "#111827",
- lineHeight: 1.5,
- }}
- >
+ <div key={exchangeIdx} className="mb-8">
+ <div className="flex justify-end mb-5">
+ <div className="bg-muted rounded-2xl px-4 py-2.5 max-w-[75%] text-sm text-foreground leading-relaxed">
{exchange.userMessage}
</div>
</div>
- {/* Response cards side-by-side */}
- <div style={{ display: "flex", gap: 14, alignItems: "flex-start" }}>
+ <div className="flex gap-3.5 items-start">
{selectedModels.map((model, idx) => {
const provider = getProviderFromModelName(model);
const { logo } = provider ? getProviderLogoAndName(provider) : { logo: "" };
const responseText = exchange.responses[model] ?? "";
const isModelStreaming = isLastExchange && comparisonStreamingSet.has(model);
return (
- <div
- key={model}
- style={{
- flex: 1,
- border: "1px solid #e5e7eb",
- borderRadius: 12,
- overflow: "hidden",
- minWidth: 0,
- }}
- >
- {/* Card header — only show on first exchange */}
+ <div key={model} className="flex-1 border rounded-xl overflow-hidden min-w-0">
{exchangeIdx === 0 && (
- <div
- style={{
- padding: "10px 14px",
- borderBottom: "1px solid #f0f0f0",
- display: "flex",
- alignItems: "center",
- gap: 8,
- background: "#fafafa",
- }}
- >
+ <div className="px-3.5 py-2.5 border-b flex items-center gap-2 bg-muted/50">
{logo ? (
<img
src={logo}
alt=""
- style={{ width: 18, height: 18, objectFit: "contain", flexShrink: 0 }}
+ className="w-[18px] h-[18px] object-contain shrink-0"
onError={(e) => {
(e.currentTarget as HTMLImageElement).style.display = "none";
}}
/>
) : (
- <div
- style={{
- width: 18,
- height: 18,
- borderRadius: "50%",
- background: "#e5e7eb",
- flexShrink: 0,
- }}
- />
+ <div className="w-[18px] h-[18px] rounded-full bg-border shrink-0" />
)}
- <span style={{ fontWeight: 600, fontSize: 12, color: "#374151" }}>
- Response {idx + 1}
- </span>
- <span
- style={{
- fontSize: 11,
- color: "#9ca3af",
- overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "nowrap",
- flex: 1,
- minWidth: 0,
- }}
- >
+ <span className="font-semibold text-xs text-foreground">Response {idx + 1}</span>
+ <span className="text-[11px] text-muted-foreground overflow-hidden text-ellipsis whitespace-nowrap flex-1 min-w-0">
{model}
</span>
</div>
)}
- {/* Card body */}
- <div style={{ padding: "14px 16px", minHeight: 60, position: "relative" }}>
+ <div className="px-4 py-3.5 min-h-[60px] relative">
{isModelStreaming && (
- <span
- style={{
- position: "absolute",
- top: 10,
- right: 12,
- fontSize: 9,
- color: "#1677ff",
- }}
- >
- ●
- </span>
+ <span className="absolute top-2.5 right-3 text-[9px] text-primary">&#9679;</span>
)}
{responseText ? (
<ReactMarkdown
remarkPlugins={[remarkGfm]}
components={{
p: ({ children }) => (
- <p
- style={{
- margin: "0 0 10px",
- lineHeight: 1.6,
- fontSize: 14,
- color: "#111827",
- }}
- >
- {children}
- </p>
+ <p className="mb-2.5 leading-relaxed text-sm text-foreground">{children}</p>
),
code: ({ className, children }) => {
const isBlock = /language-(\w+)/.exec(className || "");
if (isBlock) {
return (
- <pre
- style={{
- background: "#f8f9fa",
- padding: "10px 12px",
- borderRadius: 6,
- overflow: "auto",
- fontSize: 13,
- margin: "8px 0",
- }}
- >
+ <pre className="bg-muted px-3 py-2.5 rounded-md overflow-auto text-[13px] my-2">
<code>{children}</code>
</pre>
);
}
return (
- <code
- style={{
- background: "#f3f4f6",
- padding: "2px 5px",
- borderRadius: 3,
- fontSize: 13,
- }}
- >
+ <code className="bg-muted px-1.5 py-0.5 rounded text-[13px]">
{children}
</code>
);
@@ -1476,9 +1110,9 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
{responseText}
</ReactMarkdown>
) : isModelStreaming ? (
- <span style={{ color: "#9ca3af", fontSize: 14 }}>Generating…</span>
+ <span className="text-muted-foreground text-sm">Generating&#8230;</span>
) : (
- <span style={{ color: "#9ca3af", fontSize: 14 }}>—</span>
+ <span className="text-muted-foreground text-sm">&#8212;</span>
)}
</div>
</div>
@@ -1508,41 +1142,14 @@ const ChatPage: React.FC<ChatPageProps> = ({ accessToken, userRole, userId, user
}
}
}}
- style={{
- position: "absolute",
- bottom: 100,
- left: "50%",
- transform: "translateX(-50%)",
- width: 34,
- height: 34,
- borderRadius: "50%",
- background: "rgba(255,255,255,0.75)",
- backdropFilter: "blur(6px)",
- WebkitBackdropFilter: "blur(6px)",
- border: "1px solid rgba(0,0,0,0.1)",
- boxShadow: "0 1px 4px rgba(0,0,0,0.08)",
- cursor: "pointer",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "#6b7280",
- zIndex: 10,
- transition: "background 0.15s",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLButtonElement).style.background = "rgba(255,255,255,0.95)";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLButtonElement).style.background = "rgba(255,255,255,0.75)";
- }}
+ className="absolute bottom-[100px] left-1/2 -translate-x-1/2 w-[34px] h-[34px] rounded-full bg-background/75 backdrop-blur-md border border-black/10 shadow-sm cursor-pointer flex items-center justify-center text-muted-foreground z-10 transition-colors hover:bg-background/95"
aria-label="Scroll to bottom"
>
- <DownOutlined style={{ fontSize: 12 }} />
+ <ChevronDown className="h-3 w-3" />
</button>
)}
- {/* Input bar (in conversation) */}
- <div style={{ padding: "12px 0 24px" }}>{inputBar(true)}</div>
+ <div className="py-3 pb-6">{inputBar(true)}</div>
</div>
)}
</div>
diff --git a/ui/litellm-dashboard/src/components/chat/ConversationList.tsx b/ui/litellm-dashboard/src/components/chat/ConversationList.tsx
index 7501c19002d..0080108d0ec 100644
--- a/ui/litellm-dashboard/src/components/chat/ConversationList.tsx
+++ b/ui/litellm-dashboard/src/components/chat/ConversationList.tsx
@@ -1,20 +1,26 @@
"use client";
import React, { useState, useEffect, useRef, useCallback } from "react";
-import { Button, Input, Modal, Popconfirm, Tooltip, Avatar, Typography } from "antd";
+import { Pencil, Trash2, Plus, Search, User, MessageSquare } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Dialog, DialogContent } from "@/components/ui/dialog";
import {
- EditOutlined,
- DeleteOutlined,
- PlusOutlined,
- SearchOutlined,
- UserOutlined,
- MessageOutlined,
-} from "@ant-design/icons";
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from "@/components/ui/alert-dialog";
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
+import { ScrollArea } from "@/components/ui/scroll-area";
import dayjs from "dayjs";
import { Conversation } from "./types";
-const { Text } = Typography;
-
interface Props {
conversations: Conversation[];
activeConversationId: string | null;
@@ -24,14 +30,11 @@ interface Props {
onRename: (id: string, newTitle: string) => void;
}
-// ---- Date grouping helpers ----
-
type DateGroup = "Today" | "Yesterday" | "Last 7 Days" | "Older";
const getDateGroup = (timestamp: number): DateGroup => {
const now = dayjs();
const date = dayjs(timestamp);
-
if (date.isSame(now, "day")) return "Today";
if (date.isSame(now.subtract(1, "day"), "day")) return "Yesterday";
if (date.isAfter(now.subtract(7, "day"))) return "Last 7 Days";
@@ -47,21 +50,17 @@ interface GroupedConversations {
const groupConversations = (conversations: Conversation[]): GroupedConversations[] => {
const map = new Map<DateGroup, Conversation[]>();
-
for (const conv of conversations) {
const group = getDateGroup(conv.updatedAt);
if (!map.has(group)) map.set(group, []);
map.get(group)!.push(conv);
}
-
return DATE_GROUP_ORDER.filter((g) => map.has(g)).map((g) => ({
group: g,
items: map.get(g)!,
}));
};
-// ---- Single conversation row ----
-
interface ConversationRowProps {
conv: Conversation;
isActive: boolean;
@@ -111,102 +110,91 @@ const ConversationRow: React.FC<ConversationRowProps> = ({ conv, isActive, onSel
}
};
- const truncatedTitle = conv.title.length > 40 ? conv.title.slice(0, 40) + "…" : conv.title;
+ const truncatedTitle = conv.title.length > 40 ? conv.title.slice(0, 40) + "\u2026" : conv.title;
return (
<div
onClick={() => !editing && onSelect(conv.id)}
- className="conversation-row group"
- style={{
- display: "flex",
- alignItems: "center",
- padding: "6px 8px",
- borderRadius: 6,
- cursor: editing ? "default" : "pointer",
- backgroundColor: isActive ? "#e6f4ff" : "transparent",
- transition: "background-color 0.15s",
- minHeight: 34,
- position: "relative",
- }}
- onMouseEnter={(e) => {
- if (!isActive) {
- (e.currentTarget as HTMLDivElement).style.backgroundColor = "#f5f5f5";
- }
- }}
- onMouseLeave={(e) => {
- if (!isActive) {
- (e.currentTarget as HTMLDivElement).style.backgroundColor = "transparent";
- }
- }}
+ className={`group flex items-center px-2 py-1.5 rounded-md cursor-pointer transition-colors min-h-[34px] relative ${
+ isActive ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
+ }`}
>
{editing ? (
<Input
- ref={(node) => {
- inputRef.current = node?.input ?? null;
- }}
- size="small"
+ ref={inputRef}
value={editValue}
onChange={(e) => setEditValue(e.target.value)}
onKeyDown={handleKeyDown}
onBlur={commitRename}
onClick={(e) => e.stopPropagation()}
- style={{ flex: 1, fontSize: 13 }}
+ className="h-7 text-[13px] flex-1"
/>
) : (
<>
- <Text
- style={{
- flex: 1,
- fontSize: 13,
- color: isActive ? "#1677ff" : "#333",
- overflow: "hidden",
- whiteSpace: "nowrap",
- textOverflow: "ellipsis",
- fontWeight: isActive ? 500 : 400,
- }}
+ <span
+ className={`flex-1 text-[13px] overflow-hidden whitespace-nowrap text-ellipsis ${
+ isActive ? "font-medium" : ""
+ }`}
title={conv.title}
>
{truncatedTitle}
- </Text>
+ </span>
- {/* Action icons — visible only on hover via CSS opacity */}
<div
- className="conversation-actions"
- style={{
- display: "flex",
- gap: 2,
- opacity: 0,
- transition: "opacity 0.15s",
- flexShrink: 0,
- }}
+ className="flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"
onClick={(e) => e.stopPropagation()}
>
- <Tooltip title="Rename">
- <Button
- type="text"
- size="small"
- icon={<EditOutlined style={{ fontSize: 12 }} />}
- onClick={startEditing}
- style={{ width: 22, height: 22, padding: 0, minWidth: 22 }}
- />
- </Tooltip>
- <Popconfirm
- title="Delete this conversation?"
- onConfirm={() => onDelete(conv.id)}
- okText="Delete"
- cancelText="Cancel"
- okButtonProps={{ danger: true }}
- >
- <Tooltip title="Delete">
- <Button
- type="text"
- size="small"
- danger
- icon={<DeleteOutlined style={{ fontSize: 12 }} />}
- style={{ width: 22, height: 22, padding: 0, minWidth: 22 }}
- />
+ <TooltipProvider delayDuration={300}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ onClick={startEditing}
+ className="w-[22px] h-[22px] p-0 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground transition-colors"
+ style={{ background: "none", border: "none" }}
+ >
+ <Pencil className="h-3 w-3" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="bottom">
+ <p>Rename</p>
+ </TooltipContent>
</Tooltip>
- </Popconfirm>
+ </TooltipProvider>
+
+ <AlertDialog>
+ <TooltipProvider delayDuration={300}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <AlertDialogTrigger asChild>
+ <button
+ className="w-[22px] h-[22px] p-0 flex items-center justify-center rounded-md text-muted-foreground hover:text-destructive transition-colors"
+ style={{ background: "none", border: "none" }}
+ >
+ <Trash2 className="h-3 w-3" />
+ </button>
+ </AlertDialogTrigger>
+ </TooltipTrigger>
+ <TooltipContent side="bottom">
+ <p>Delete</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Delete this conversation?</AlertDialogTitle>
+ <AlertDialogDescription>This action cannot be undone</AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ onClick={() => onDelete(conv.id)}
+ className="bg-destructive text-white hover:bg-destructive/90"
+ >
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</div>
</>
)}
@@ -214,8 +202,6 @@ const ConversationRow: React.FC<ConversationRowProps> = ({ conv, isActive, onSel
);
};
-// ---- Cmd+K search modal ----
-
interface SearchModalProps {
open: boolean;
conversations: Conversation[];
@@ -242,66 +228,46 @@ const SearchModal: React.FC<SearchModalProps> = ({ open, conversations, onSelect
};
return (
- <Modal
- open={open}
- onCancel={onClose}
- footer={null}
- title={null}
- width={480}
- styles={{ body: { padding: "16px 16px 8px" } }}
- >
- <Input
- autoFocus
- prefix={<SearchOutlined style={{ color: "#bbb" }} />}
- placeholder="Search conversations…"
- value={query}
- onChange={(e) => setQuery(e.target.value)}
- style={{ marginBottom: 12 }}
- allowClear
- />
+ <Dialog open={open} onOpenChange={(v) => !v && onClose()}>
+ <DialogContent className="sm:max-w-[480px] p-4 gap-0">
+ <div className="relative mb-3">
+ <Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
+ <Input
+ autoFocus
+ placeholder="Search conversations\u2026"
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ className="pl-9"
+ />
+ </div>
- <div style={{ maxHeight: 320, overflowY: "auto" }}>
- {filtered.length === 0 ? (
- <div style={{ textAlign: "center", padding: "24px 0", color: "#999" }}>No conversations found</div>
- ) : (
- filtered.map((conv) => {
- const truncated = conv.title.length > 55 ? conv.title.slice(0, 55) + "…" : conv.title;
- return (
- <div
- key={conv.id}
- onClick={() => handleSelect(conv.id)}
- style={{
- display: "flex",
- alignItems: "center",
- gap: 8,
- padding: "8px 10px",
- borderRadius: 6,
- cursor: "pointer",
- transition: "background-color 0.1s",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLDivElement).style.backgroundColor = "#f0f5ff";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLDivElement).style.backgroundColor = "transparent";
- }}
- >
- <MessageOutlined style={{ color: "#999", flexShrink: 0 }} />
- <Text style={{ fontSize: 13 }}>{truncated}</Text>
- <Text type="secondary" style={{ fontSize: 11, marginLeft: "auto", flexShrink: 0 }}>
- {dayjs(conv.updatedAt).format("MMM D")}
- </Text>
- </div>
- );
- })
- )}
- </div>
- </Modal>
+ <ScrollArea className="max-h-[320px]">
+ {filtered.length === 0 ? (
+ <div className="text-center py-6 text-muted-foreground text-sm">No conversations found</div>
+ ) : (
+ filtered.map((conv) => {
+ const truncated = conv.title.length > 55 ? conv.title.slice(0, 55) + "\u2026" : conv.title;
+ return (
+ <div
+ key={conv.id}
+ onClick={() => handleSelect(conv.id)}
+ className="flex items-center gap-2 px-2.5 py-2 rounded-md cursor-pointer transition-colors hover:bg-accent/50"
+ >
+ <MessageSquare className="h-4 w-4 text-muted-foreground shrink-0" />
+ <span className="text-[13px] flex-1 truncate">{truncated}</span>
+ <span className="text-[11px] text-muted-foreground shrink-0 ml-auto">
+ {dayjs(conv.updatedAt).format("MMM D")}
+ </span>
+ </div>
+ );
+ })
+ )}
+ </ScrollArea>
+ </DialogContent>
+ </Dialog>
);
};
-// ---- Main ConversationList component ----
-
const ConversationList: React.FC<Props> = ({
conversations,
activeConversationId,
@@ -312,7 +278,6 @@ const ConversationList: React.FC<Props> = ({
}) => {
const [searchModalOpen, setSearchModalOpen] = useState(false);
- // Cmd+K / Ctrl+K listener
const handleGlobalKeyDown = useCallback((e: KeyboardEvent) => {
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
@@ -329,69 +294,34 @@ const ConversationList: React.FC<Props> = ({
return (
<>
- {/* Hover-reveal CSS for action icons */}
- <style>{`
- .conversation-row:hover .conversation-actions {
- opacity: 1 !important;
- }
- `}</style>
-
- <div
- style={{
- display: "flex",
- flexDirection: "column",
- height: "100%",
- width: "100%",
- overflow: "hidden",
- }}
- >
- {/* Top: New Chat button */}
- <div style={{ padding: "12px 10px 8px" }}>
- <Tooltip
- title="Chats are saved locally in this browser. All requests are logged in Spend → Logs."
- placement="right"
- >
- <Button type="primary" icon={<PlusOutlined />} onClick={onNewChat} style={{ width: "100%" }}>
- New Chat
- </Button>
- </Tooltip>
+ <div className="flex flex-col h-full w-full overflow-hidden">
+ <div className="px-2.5 pt-3 pb-2">
+ <TooltipProvider delayDuration={300}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button onClick={onNewChat} className="w-full" size="sm">
+ <Plus className="h-4 w-4 mr-1.5" />
+ New Chat
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent side="right">
+ <p>Chats are saved locally in this browser. All requests are logged in Spend -&gt; Logs</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
</div>
- {/* Conversation list (scrollable) */}
- <div
- style={{
- flex: 1,
- overflowY: "auto",
- padding: "0 6px",
- }}
- >
+ <ScrollArea className="flex-1 px-1.5">
{grouped.length === 0 ? (
- <div
- style={{
- textAlign: "center",
- color: "#bbb",
- fontSize: 12,
- marginTop: 32,
- padding: "0 12px",
- }}
- >
- No conversations yet.
+ <div className="text-center text-muted-foreground/60 text-xs mt-8 px-3">
+ No conversations yet
<br />
- Start a new chat above.
+ Start a new chat above
</div>
) : (
grouped.map(({ group, items }) => (
- <div key={group} style={{ marginBottom: 8 }}>
- <div
- style={{
- fontSize: 11,
- fontWeight: 600,
- color: "#999",
- textTransform: "uppercase",
- letterSpacing: "0.04em",
- padding: "8px 8px 4px",
- }}
- >
+ <div key={group} className="mb-2">
+ <div className="text-[11px] font-semibold text-muted-foreground uppercase tracking-wider px-2 pt-2 pb-1">
{group}
</div>
{items.map((conv) => (
@@ -407,38 +337,18 @@ const ConversationList: React.FC<Props> = ({
</div>
))
)}
- </div>
+ </ScrollArea>
- {/* Bottom: user avatar placeholder */}
- <div
- style={{
- padding: "10px 12px",
- borderTop: "1px solid #f0f0f0",
- display: "flex",
- alignItems: "center",
- gap: 8,
- }}
- >
- <Avatar
- size={28}
- icon={<UserOutlined />}
- style={{ backgroundColor: "#e0e7ff", color: "#4f46e5", flexShrink: 0 }}
- />
- <Text
- style={{
- fontSize: 13,
- color: "#555",
- overflow: "hidden",
- whiteSpace: "nowrap",
- textOverflow: "ellipsis",
- }}
- >
+ <div className="px-3 py-2.5 border-t flex items-center gap-2">
+ <div className="w-7 h-7 rounded-full bg-accent flex items-center justify-center shrink-0">
+ <User className="h-3.5 w-3.5 text-muted-foreground" />
+ </div>
+ <span className="text-[13px] text-muted-foreground overflow-hidden whitespace-nowrap text-ellipsis">
My Account
- </Text>
+ </span>
</div>
</div>
- {/* Cmd+K search modal */}
<SearchModal
open={searchModalOpen}
conversations={conversations}
diff --git a/ui/litellm-dashboard/src/components/chat/KeysPanel.tsx b/ui/litellm-dashboard/src/components/chat/KeysPanel.tsx
new file mode 100644
index 00000000000..654b5c8c698
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/chat/KeysPanel.tsx
@@ -0,0 +1,357 @@
+"use client";
+
+import React, { useState } from "react";
+import { Loader2, RefreshCw, KeyRound, Copy, Check } from "lucide-react";
+import { useQuery, useQueryClient } from "@tanstack/react-query";
+import { CopyToClipboard } from "react-copy-to-clipboard";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Badge } from "@/components/ui/badge";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
+import MessageManager from "@/components/molecules/message_manager";
+import { keyListCall, regenerateKeyCall } from "../networking";
+import { KeyResponse } from "../key_team_helpers/key_list";
+import { formatExpiresUtc, isKeyExpired, calculateExpiryPreviewFromDuration } from "@/utils/keyExpiryUtils";
+
+const KEYS_QUERY_KEY = "chat-user-keys";
+
+const DURATION_RE = /^(\d+(s|m|h|d|w|mo))?$/;
+
+interface Props {
+ accessToken: string;
+ userId: string;
+ premiumUser: boolean;
+}
+
+function maskKey(keyName: string | undefined): string {
+ if (!keyName) return "sk-...";
+ if (keyName.length <= 10) return keyName;
+ return keyName.slice(0, 7) + "..." + keyName.slice(-4);
+}
+
+function relativeTime(isoString: string | null | undefined): string {
+ if (!isoString) return "";
+ try {
+ const date = new Date(isoString);
+ const diffMs = Date.now() - date.getTime();
+ const diffSec = Math.floor(diffMs / 1000);
+ if (diffSec < 60) return "just now";
+ const diffMin = Math.floor(diffSec / 60);
+ if (diffMin < 60) return `${diffMin}m ago`;
+ const diffHr = Math.floor(diffMin / 60);
+ if (diffHr < 24) return `${diffHr}h ago`;
+ return `${Math.floor(diffHr / 24)}d ago`;
+ } catch {
+ return "";
+ }
+}
+
+interface FormState {
+ key_alias: string;
+ max_budget: string;
+ tpm_limit: string;
+ rpm_limit: string;
+ duration: string;
+ grace_period: string;
+}
+
+const KeysPanel: React.FC<Props> = ({ accessToken, userId, premiumUser }) => {
+ const queryClient = useQueryClient();
+ const [rotateTarget, setRotateTarget] = useState<KeyResponse | null>(null);
+ const [regeneratedKey, setRegeneratedKey] = useState<string | null>(null);
+ const [isRegenerating, setIsRegenerating] = useState(false);
+ const [copied, setCopied] = useState(false);
+ const [formState, setFormState] = useState<FormState>({
+ key_alias: "",
+ max_budget: "",
+ tpm_limit: "",
+ rpm_limit: "",
+ duration: "",
+ grace_period: "",
+ });
+ const [formErrors, setFormErrors] = useState<Partial<Record<keyof FormState, string>>>({});
+
+ const { data, isLoading } = useQuery({
+ queryKey: [KEYS_QUERY_KEY, accessToken, userId],
+ queryFn: async () => {
+ const resp = await keyListCall(accessToken, null, null, null, userId, null, 1, 100, null, null, null, null);
+ return (resp?.keys ?? []) as KeyResponse[];
+ },
+ enabled: !!accessToken,
+ });
+
+ const keys = data ?? [];
+
+ const openRotateModal = (key: KeyResponse) => {
+ setRotateTarget(key);
+ setRegeneratedKey(null);
+ setCopied(false);
+ setFormErrors({});
+ setFormState({
+ key_alias: key.key_alias ?? "",
+ max_budget: key.max_budget != null ? String(key.max_budget) : "",
+ tpm_limit: key.tpm_limit != null ? String(key.tpm_limit) : "",
+ rpm_limit: key.rpm_limit != null ? String(key.rpm_limit) : "",
+ duration: key.duration ?? "",
+ grace_period: "",
+ });
+ };
+
+ const validate = (): boolean => {
+ const errors: Partial<Record<keyof FormState, string>> = {};
+ const keyExpired = rotateTarget ? isKeyExpired(rotateTarget.expires) : false;
+
+ if (formState.duration && !DURATION_RE.test(formState.duration)) {
+ errors.duration = "Must be a duration like 30s, 30m, 24h, 2d, 1w, or 1mo";
+ }
+ if (keyExpired && !formState.duration) {
+ errors.duration = "Expiration is required for expired keys";
+ }
+ if (formState.grace_period && !DURATION_RE.test(formState.grace_period)) {
+ errors.grace_period = "Must be a duration like 24h, 2d";
+ }
+
+ setFormErrors(errors);
+ return Object.keys(errors).length === 0;
+ };
+
+ const handleRegenerate = async () => {
+ if (!rotateTarget || !validate()) return;
+ setIsRegenerating(true);
+ try {
+ const payload: Record<string, unknown> = {};
+ if (formState.key_alias) payload.key_alias = formState.key_alias;
+ if (formState.max_budget) payload.max_budget = parseFloat(formState.max_budget);
+ if (formState.tpm_limit) payload.tpm_limit = parseInt(formState.tpm_limit, 10);
+ if (formState.rpm_limit) payload.rpm_limit = parseInt(formState.rpm_limit, 10);
+ if (formState.duration) payload.duration = formState.duration;
+ if (formState.grace_period) payload.grace_period = formState.grace_period;
+
+ const response = await regenerateKeyCall(accessToken, rotateTarget.token || rotateTarget.token_id, payload);
+ setRegeneratedKey(response.key);
+ MessageManager.success("Key rotated successfully");
+ queryClient.invalidateQueries({ queryKey: [KEYS_QUERY_KEY] });
+ } catch {
+ MessageManager.error("Failed to rotate key");
+ } finally {
+ setIsRegenerating(false);
+ }
+ };
+
+ const closeModal = () => {
+ setRotateTarget(null);
+ setRegeneratedKey(null);
+ setCopied(false);
+ setFormErrors({});
+ };
+
+ const keyIsExpired = rotateTarget ? isKeyExpired(rotateTarget.expires) : false;
+ const newExpiryTime =
+ formState.duration && DURATION_RE.test(formState.duration)
+ ? calculateExpiryPreviewFromDuration(formState.duration)
+ : null;
+
+ const updateField = (field: keyof FormState, value: string) => {
+ setFormState((prev) => ({ ...prev, [field]: value }));
+ if (formErrors[field]) setFormErrors((prev) => ({ ...prev, [field]: undefined }));
+ };
+
+ return (
+ <div className="w-full">
+ <div className="mb-4">
+ <h2 className="text-base font-semibold text-foreground mb-0.5">Your API Keys</h2>
+ <p className="text-sm text-muted-foreground m-0">
+ View your virtual keys and spend
+ {premiumUser &&
+ ". Rotate keys to generate new credentials while optionally keeping the old key valid during a grace period"}
+ </p>
+ </div>
+
+ {isLoading ? (
+ <div className="flex justify-center py-12">
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+ </div>
+ ) : keys.length === 0 ? (
+ <div className="text-center text-muted-foreground text-sm py-12 border border-dashed rounded-lg">
+ <KeyRound className="h-6 w-6 mb-3 mx-auto text-muted-foreground/50" />
+ No keys found
+ </div>
+ ) : (
+ <div className="rounded-lg border overflow-hidden">
+ <Table>
+ <TableHeader>
+ <TableRow className="bg-muted/50">
+ <TableHead className="text-xs font-semibold uppercase tracking-wide">Key</TableHead>
+ <TableHead className="text-xs font-semibold uppercase tracking-wide">Spend</TableHead>
+ <TableHead className="text-xs font-semibold uppercase tracking-wide">Expires</TableHead>
+ <TableHead className="text-xs font-semibold uppercase tracking-wide">Created</TableHead>
+ {premiumUser && (
+ <TableHead className="text-xs font-semibold uppercase tracking-wide text-right w-[80px]" />
+ )}
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {keys.map((record) => {
+ const expired = isKeyExpired(record.expires);
+ return (
+ <TableRow key={record.token}>
+ <TableCell>
+ <span className="font-mono text-[13px]">{maskKey(record.key_name)}</span>
+ {record.key_alias && <div className="text-xs text-muted-foreground">{record.key_alias}</div>}
+ </TableCell>
+ <TableCell className="text-[13px]">
+ ${record.spend?.toFixed(2) ?? "0.00"}
+ {record.max_budget != null && record.max_budget > 0 && (
+ <span className="text-muted-foreground"> / ${record.max_budget.toFixed(2)}</span>
+ )}
+ </TableCell>
+ <TableCell>
+ {!record.expires ? (
+ <span className="text-muted-foreground text-[13px]">Never</span>
+ ) : (
+ <Badge variant={expired ? "destructive" : "default"}>
+ {expired ? "Expired" : formatExpiresUtc(record.expires)}
+ </Badge>
+ )}
+ </TableCell>
+ <TableCell className="text-muted-foreground text-[13px]">
+ {relativeTime(record.created_at)}
+ </TableCell>
+ {premiumUser && (
+ <TableCell className="text-right">
+ <button
+ onClick={() => openRotateModal(record)}
+ title="Rotate key"
+ className="inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
+ style={{ background: "none" }}
+ >
+ <RefreshCw className="h-3 w-3" />
+ Rotate
+ </button>
+ </TableCell>
+ )}
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
+ </div>
+ )}
+
+ <Dialog open={!!rotateTarget} onOpenChange={(v) => !v && closeModal()}>
+ <DialogContent className="sm:max-w-[520px]">
+ <DialogHeader>
+ <DialogTitle>Rotate Key</DialogTitle>
+ </DialogHeader>
+
+ {regeneratedKey ? (
+ <div>
+ <div className="rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800 mb-4">
+ Save this key now; you will not see it again
+ </div>
+ <div className="text-xs text-muted-foreground mb-1">New Key</div>
+ <div className="bg-muted border rounded-md px-4 py-3 font-mono text-sm break-all text-foreground">
+ {regeneratedKey}
+ </div>
+ </div>
+ ) : (
+ <div className="flex flex-col gap-4 mt-1">
+ <div>
+ <Label className="text-sm mb-1.5 block">Key Alias</Label>
+ <Input value={formState.key_alias} disabled />
+ </div>
+ <div className="grid grid-cols-3 gap-3">
+ <div>
+ <Label className="text-sm mb-1.5 block">Max Budget (USD)</Label>
+ <Input
+ type="number"
+ step="0.01"
+ value={formState.max_budget}
+ onChange={(e) => updateField("max_budget", e.target.value)}
+ />
+ </div>
+ <div>
+ <Label className="text-sm mb-1.5 block">TPM Limit</Label>
+ <Input
+ type="number"
+ value={formState.tpm_limit}
+ onChange={(e) => updateField("tpm_limit", e.target.value)}
+ />
+ </div>
+ <div>
+ <Label className="text-sm mb-1.5 block">RPM Limit</Label>
+ <Input
+ type="number"
+ value={formState.rpm_limit}
+ onChange={(e) => updateField("rpm_limit", e.target.value)}
+ />
+ </div>
+ </div>
+ <div className="grid grid-cols-2 gap-3">
+ <div>
+ <Label className="text-sm mb-1.5 block">Expire Key</Label>
+ <Input
+ placeholder="e.g. 30s, 30h, 30d"
+ value={formState.duration}
+ onChange={(e) => updateField("duration", e.target.value)}
+ />
+ {formErrors.duration && <p className="text-xs text-destructive mt-1">{formErrors.duration}</p>}
+ <p className={`text-xs mt-1 ${keyIsExpired ? "text-destructive" : "text-muted-foreground"}`}>
+ Current: {rotateTarget?.expires ? formatExpiresUtc(rotateTarget.expires) : "Never"}
+ {keyIsExpired && " (expired)"}
+ </p>
+ {newExpiryTime && <p className="text-xs text-emerald-600 mt-0.5">New: {newExpiryTime}</p>}
+ </div>
+ <div>
+ <Label className="text-sm mb-1.5 block">Grace Period</Label>
+ <Input
+ placeholder="e.g. 24h, 2d"
+ value={formState.grace_period}
+ onChange={(e) => updateField("grace_period", e.target.value)}
+ />
+ {formErrors.grace_period && (
+ <p className="text-xs text-destructive mt-1">{formErrors.grace_period}</p>
+ )}
+ </div>
+ </div>
+ </div>
+ )}
+
+ <DialogFooter>
+ {regeneratedKey ? (
+ <>
+ <Button variant="outline" onClick={closeModal}>
+ Close
+ </Button>
+ <CopyToClipboard text={regeneratedKey} onCopy={() => setCopied(true)}>
+ <Button>
+ {copied ? <Check className="h-4 w-4 mr-1.5" /> : <Copy className="h-4 w-4 mr-1.5" />}
+ {copied ? "Copied" : "Copy Key"}
+ </Button>
+ </CopyToClipboard>
+ </>
+ ) : (
+ <>
+ <Button variant="outline" onClick={closeModal}>
+ Cancel
+ </Button>
+ <Button onClick={handleRegenerate} disabled={isRegenerating}>
+ {isRegenerating ? (
+ <Loader2 className="h-4 w-4 animate-spin mr-1.5" />
+ ) : (
+ <RefreshCw className="h-4 w-4 mr-1.5" />
+ )}
+ Rotate
+ </Button>
+ </>
+ )}
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </div>
+ );
+};
+
+export default KeysPanel;
diff --git a/ui/litellm-dashboard/src/components/chat/MCPAppsPanel.tsx b/ui/litellm-dashboard/src/components/chat/MCPAppsPanel.tsx
index 2e2baee01eb..813a0f70874 100644
--- a/ui/litellm-dashboard/src/components/chat/MCPAppsPanel.tsx
+++ b/ui/litellm-dashboard/src/components/chat/MCPAppsPanel.tsx
@@ -2,8 +2,11 @@
import React, { useCallback, useEffect, useRef, useState } from "react";
import { useQuery } from "@tanstack/react-query";
-import { Spin, Input, Button, Skeleton } from "antd";
-import { SearchOutlined, ArrowLeftOutlined, RightOutlined, ToolOutlined, CheckCircleOutlined } from "@ant-design/icons";
+import { Search, ArrowLeft, ChevronRight, Wrench, CheckCircle, Loader2 } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Skeleton } from "@/components/ui/skeleton";
+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import {
deleteMCPOAuthUserCredential,
fetchMCPServers,
@@ -14,13 +17,10 @@ import { AUTH_TYPE, MCPServer, MCPTool, handleTransport } from "../mcp_tools/typ
import MessageManager from "@/components/molecules/message_manager";
import { useUserMcpOAuthFlow } from "@/hooks/useUserMcpOAuthFlow";
-// ── OAuth2 connect button ─────────────────────────────────────────────────────
-// Wraps useUserMcpOAuthFlow so each server card can hold its own hook instance.
interface OAuth2ConnectButtonProps {
server: MCPServer;
accessToken: string;
onConnect: (serverId: string) => void;
- /** "badge" = small inline chip (grid card), "button" = full Ant Button (detail view) */
variant?: "badge" | "button";
}
@@ -42,13 +42,9 @@ const OAuth2ConnectButton: React.FC<OAuth2ConnectButtonProps> = ({
if (variant === "button") {
return (
- <Button
- type="primary"
- loading={loading}
- onClick={startOAuthFlow}
- style={{ borderRadius: 8, fontWeight: 600, height: 38, minWidth: 110 }}
- >
- {loading ? "Connecting…" : "Connect"}
+ <Button onClick={startOAuthFlow} disabled={loading} className="rounded-lg font-semibold h-[38px] min-w-[110px]">
+ {loading && <Loader2 className="h-4 w-4 animate-spin mr-1.5" />}
+ {loading ? "Connecting\u2026" : "Connect"}
</Button>
);
}
@@ -59,23 +55,16 @@ const OAuth2ConnectButton: React.FC<OAuth2ConnectButtonProps> = ({
e.stopPropagation();
if (!loading) startOAuthFlow();
}}
- style={{
- fontSize: 11,
- fontWeight: 600,
- color: loading ? "#9ca3af" : "#fff",
- background: loading ? "#e5e7eb" : "#1677ff",
- borderRadius: 6,
- padding: "2px 8px",
- cursor: loading ? "default" : "pointer",
- flexShrink: 0,
- whiteSpace: "nowrap",
- }}
+ className={`text-[11px] font-semibold rounded-md px-2 py-0.5 shrink-0 whitespace-nowrap ${
+ loading
+ ? "text-muted-foreground bg-muted cursor-default"
+ : "text-primary-foreground bg-primary cursor-pointer hover:bg-primary/90"
+ }`}
>
- {loading ? "Connecting…" : "Connect"}
+ {loading ? "Connecting\u2026" : "Connect"}
</span>
);
};
-// ─────────────────────────────────────────────────────────────────────────────
interface Props {
accessToken: string;
@@ -113,15 +102,10 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
const [activeTab, setActiveTab] = useState<TabKey>("all");
const [togglingOn, setTogglingOn] = useState<Set<string>>(new Set());
const [detailServer, setDetailServer] = useState<MCPServer | null>(null);
- // tool counts per server name, preloaded in background
const [toolCounts, setToolCounts] = useState<Record<string, number>>({});
const [loadingCounts, setLoadingCounts] = useState(false);
- // OAuth2 connect state — tracks which server_ids have a stored user credential
const [oauthConnected, setOauthConnected] = useState<Set<string>>(new Set());
- // Refs keep the latest values for the auto-enable effect so it always reads
- // the current servers/selectedServers/onChange without needing them as
- // dependencies (which would cause the effect to fire on every render).
const serversRef = useRef<MCPServer[]>([]);
useEffect(() => {
serversRef.current = servers;
@@ -147,7 +131,7 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
const tools: MCPTool[] = Array.isArray(toolsData?.tools) ? toolsData.tools : [];
setToolCounts((prev) => ({ ...prev, [nameOf(server)]: tools.length }));
} catch {
- // ignore — this server's tool count just stays unset
+ // ignore
}
},
[accessToken],
@@ -162,7 +146,7 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
setOauthConnected((prev) => new Set(prev).add(server.server_id));
}
} catch {
- // ignore — server just shows as not connected
+ // ignore
}
},
[accessToken],
@@ -171,7 +155,6 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
useEffect(() => {
fetchLoadCancelledRef.current = false;
- // 1. Load servers first — show the list immediately
fetchMCPServers(accessToken)
.then(async (serverData) => {
if (fetchLoadCancelledRef.current) return;
@@ -179,7 +162,6 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
setServers(list);
setLoading(false);
- // 2. Fetch tools per server, at most TOOLS_FETCH_CONCURRENCY at a time
setLoadingCounts(true);
const chunks = Array.from({ length: Math.ceil(list.length / TOOLS_FETCH_CONCURRENCY) }, (_, i) =>
list.slice(i * TOOLS_FETCH_CONCURRENCY, (i + 1) * TOOLS_FETCH_CONCURRENCY),
@@ -190,7 +172,6 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
}
if (!fetchLoadCancelledRef.current) setLoadingCounts(false);
- // 3. Check OAuth credential status for OAuth2 servers in parallel
const oauthServers = list.filter((s) => s.auth_type === AUTH_TYPE.OAUTH2);
oauthServers.forEach((s) => checkOauthCredential(s));
})
@@ -205,10 +186,6 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
};
}, [accessToken, fetchToolCount, checkOauthCredential]);
- // Auto-enable oauth2 servers for the current chat session when a valid
- // credential is detected (either on mount or after a fresh OAuth sign-in).
- // Uses refs for servers/selectedServers/onChange to avoid stale closures
- // without adding them as dependencies (which would re-fire on every render).
useEffect(() => {
if (oauthConnected.size === 0) return;
const namesToAdd = serversRef.current
@@ -222,7 +199,6 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
const handleToggle = async (serverName: string, checked: boolean, serverId?: string) => {
if (!checked) {
onChange(selectedServers.filter((s) => s !== serverName));
- // Also clear from oauthConnected so the auto-enable effect doesn't re-add it.
if (serverId) {
setOauthConnected((prev) => {
const next = new Set(prev);
@@ -234,15 +210,12 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
}
setTogglingOn((prev) => new Set(prev).add(serverName));
try {
- // Use UUID if available, fall back to name (for connectivity check only)
const idToFetch = serverId ?? serverName;
const result = await listMCPTools(accessToken, idToFetch);
if (result?.error) {
MessageManager.warning(`Could not load tools for ${serverName}`);
return;
}
- // Use the ref so we read the most up-to-date list; guard against duplicates
- // that the oauthConnected effect may have already added while we awaited.
if (!selectedServersRef.current.includes(serverName)) {
onChange([...selectedServersRef.current, serverName]);
}
@@ -257,7 +230,6 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
}
};
- // Fetch tools for the detail view — server_id must be the UUID
const { data: detailToolsResult, isLoading: loadingTools } = useQuery({
queryKey: ["mcp-apps-panel-detail-tools", detailServer?.server_id],
queryFn: () => listMCPTools(accessToken, detailServer!.server_id),
@@ -276,11 +248,8 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
});
const connectedCount = servers.filter((s) => selectedServers.includes(nameOf(s))).length;
-
- // Total tools available across all servers (based on preloaded counts)
const totalTools = Object.values(toolCounts).reduce((sum, n) => sum + n, 0);
- // ── Detail view ──
if (detailServer) {
const name = nameOf(detailServer);
const isConnected = selectedServers.includes(name);
@@ -288,40 +257,22 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
const color = getAvatarColor(name);
return (
- <div style={{ width: "100%" }}>
- {/* Back */}
+ <div className="w-full">
<button
onClick={() => setDetailServer(null)}
- style={{
- display: "flex",
- alignItems: "center",
- gap: 6,
- background: "none",
- border: "none",
- cursor: "pointer",
- color: "#6b7280",
- fontSize: 13,
- padding: "0 0 20px 0",
- }}
+ className="flex items-center gap-1.5 text-muted-foreground text-[13px] pb-5 hover:text-foreground transition-colors"
+ style={{ background: "none", border: "none" }}
>
- <ArrowLeftOutlined style={{ fontSize: 12 }} />
+ <ArrowLeft className="h-3 w-3" />
Back
</button>
- {/* Avatar + name + connect */}
- <div style={{ display: "flex", alignItems: "flex-start", gap: 20, marginBottom: 28 }}>
+ <div className="flex items-start gap-5 mb-7">
{detailServer.mcp_info?.logo_url ? (
<img
src={detailServer.mcp_info.logo_url}
alt={`${name} logo`}
- style={{
- width: 64,
- height: 64,
- borderRadius: 16,
- objectFit: "contain",
- flexShrink: 0,
- background: "#f9fafb",
- }}
+ className="w-16 h-16 rounded-2xl object-contain shrink-0 bg-muted/50"
onError={(e) => {
const el = e.target as HTMLImageElement;
el.style.display = "none";
@@ -330,36 +281,27 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
/>
) : null}
<div
+ className="w-16 h-16 rounded-2xl flex items-center justify-center text-white font-bold text-[28px] shrink-0"
style={{
- width: 64,
- height: 64,
- borderRadius: 16,
background: color,
display: detailServer.mcp_info?.logo_url ? "none" : "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "#fff",
- fontWeight: 700,
- fontSize: 28,
- flexShrink: 0,
}}
>
{name.charAt(0).toUpperCase()}
</div>
- <div style={{ flex: 1 }}>
- <h2 style={{ margin: "0 0 4px", fontSize: 22, fontWeight: 700, color: "#111827" }}>{name}</h2>
- <p style={{ margin: 0, fontSize: 14, color: "#6b7280" }}>{detailServer.description ?? "MCP server"}</p>
+ <div className="flex-1">
+ <h2 className="m-0 mb-1 text-[22px] font-bold text-foreground">{name}</h2>
+ <p className="m-0 text-sm text-muted-foreground">{detailServer.description ?? "MCP server"}</p>
</div>
{detailServer.auth_type === AUTH_TYPE.OAUTH2 ? (
oauthConnected.has(detailServer.server_id) ? (
<Button
- type="default"
- danger
+ variant="destructive"
onClick={async () => {
try {
await deleteMCPOAuthUserCredential(accessToken, detailServer.server_id);
} catch (_) {
- // Ignore — credential may already be gone; update UI regardless.
+ // Ignore
}
setOauthConnected((prev) => {
const n = new Set(prev);
@@ -368,7 +310,7 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
});
onChangeRef.current(selectedServersRef.current.filter((s) => s !== name));
}}
- style={{ borderRadius: 8, fontWeight: 600, height: 38, minWidth: 110 }}
+ className="rounded-lg font-semibold h-[38px] min-w-[110px]"
>
Disconnect
</Button>
@@ -384,19 +326,19 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
)
) : (
<Button
- type={isConnected ? "default" : "primary"}
- loading={isTogglingOn}
+ variant={isConnected ? "outline" : "default"}
+ disabled={isTogglingOn}
onClick={() => handleToggle(name, !isConnected, detailServer.server_id)}
- style={{ borderRadius: 8, fontWeight: 600, height: 38, minWidth: 110 }}
+ className="rounded-lg font-semibold h-[38px] min-w-[110px]"
>
+ {isTogglingOn && <Loader2 className="h-4 w-4 animate-spin mr-1.5" />}
{isConnected ? "Disconnect" : "Connect"}
</Button>
)}
</div>
- {/* Info table */}
- <h3 style={{ margin: "0 0 12px", fontSize: 15, fontWeight: 600, color: "#111827" }}>Information</h3>
- <div style={{ border: "1px solid #e5e7eb", borderRadius: 10, overflow: "hidden", marginBottom: 28 }}>
+ <h3 className="m-0 mb-3 text-[15px] font-semibold text-foreground">Information</h3>
+ <div className="border rounded-xl overflow-hidden mb-7">
{[
["Server ID", detailServer.server_id],
["Transport", handleTransport(detailServer.transport, detailServer.spec_path)],
@@ -404,66 +346,36 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
]
.filter(([, v]) => v)
.map(([label, value], i, arr) => (
- <div
- key={label}
- style={{
- display: "flex",
- padding: "12px 16px",
- borderBottom: i < arr.length - 1 ? "1px solid #f3f4f6" : "none",
- fontSize: 13,
- }}
- >
- <span style={{ width: 140, color: "#9ca3af", flexShrink: 0 }}>{label}</span>
- <span style={{ color: "#111827", fontWeight: 500 }}>{value}</span>
+ <div key={label} className={`flex px-4 py-3 text-[13px] ${i < arr.length - 1 ? "border-b" : ""}`}>
+ <span className="w-[140px] text-muted-foreground shrink-0">{label}</span>
+ <span className="text-foreground font-medium">{value}</span>
</div>
))}
</div>
- {/* Tools section */}
- <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }}>
- <h3 style={{ margin: 0, fontSize: 15, fontWeight: 600, color: "#111827" }}>Available Tools</h3>
+ <div className="flex items-center gap-2 mb-3">
+ <h3 className="m-0 text-[15px] font-semibold text-foreground">Available Tools</h3>
{!loadingTools && (
- <span
- style={{
- fontSize: 11,
- fontWeight: 600,
- color: "#6b7280",
- background: "#f3f4f6",
- borderRadius: 4,
- padding: "1px 6px",
- }}
- >
+ <span className="text-[11px] font-semibold text-muted-foreground bg-muted rounded px-1.5 py-0.5">
{detailTools.length}
</span>
)}
</div>
{loadingTools ? (
- <div style={{ display: "flex", justifyContent: "center", padding: "24px 0" }}>
- <Spin size="small" />
+ <div className="flex justify-center py-6">
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
</div>
) : detailTools.length === 0 ? (
- <div style={{ color: "#9ca3af", fontSize: 13, padding: "8px 0" }}>No tools available</div>
+ <div className="text-muted-foreground text-[13px] py-2">No tools available</div>
) : (
- <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
+ <div className="flex flex-col gap-2">
{detailTools.map((tool) => (
- <div
- key={tool.name}
- style={{
- border: "1px solid #e5e7eb",
- borderRadius: 8,
- padding: "10px 14px",
- background: "#fafafa",
- }}
- >
- <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: tool.description ? 4 : 0 }}>
- <ToolOutlined style={{ fontSize: 13, color: "#6b7280" }} />
- <span style={{ fontSize: 13, fontWeight: 600, color: "#111827", fontFamily: "monospace" }}>
- {tool.name}
- </span>
+ <div key={tool.name} className="border rounded-lg px-3.5 py-2.5 bg-muted/30">
+ <div className={`flex items-center gap-2 ${tool.description ? "mb-1" : ""}`}>
+ <Wrench className="h-3.5 w-3.5 text-muted-foreground" />
+ <span className="text-[13px] font-semibold text-foreground font-mono">{tool.name}</span>
</div>
- {tool.description && (
- <p style={{ margin: 0, fontSize: 12, color: "#6b7280", paddingLeft: 21 }}>{tool.description}</p>
- )}
+ {tool.description && <p className="m-0 text-xs text-muted-foreground pl-[21px]">{tool.description}</p>}
</div>
))}
</div>
@@ -472,113 +384,73 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
);
}
- // ── List view ──
return (
- <div style={{ width: "100%" }}>
- {/* Header row */}
- <div
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- marginBottom: 20,
- gap: 16,
- flexWrap: "wrap",
- }}
- >
+ <div className="w-full">
+ <div className="flex items-center justify-between mb-5 gap-4 flex-wrap">
<div>
- <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 4 }}>
- <h2 style={{ margin: 0, fontSize: 18, fontWeight: 600, color: "#111827" }}>MCP Servers</h2>
- <span
- style={{
- fontSize: 10,
- fontWeight: 600,
- color: "#1677ff",
- background: "#e8f4ff",
- borderRadius: 4,
- padding: "1px 6px",
- letterSpacing: "0.05em",
- textTransform: "uppercase",
- }}
- >
+ <div className="flex items-center gap-2 mb-1">
+ <h2 className="m-0 text-lg font-semibold text-foreground">MCP Servers</h2>
+ <span className="text-[10px] font-semibold text-primary bg-primary/10 rounded px-1.5 py-0.5 uppercase tracking-wider">
Beta
</span>
</div>
- <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
- <p style={{ margin: 0, fontSize: 13, color: "#6b7280" }}>
- Browse tools, authenticate once, use in chat — no setup needed.
- </p>
+ <div className="flex items-center gap-3">
+ <p className="m-0 text-[13px] text-muted-foreground">Browse tools, authenticate once, use in chat</p>
{loadingCounts ? (
- <span style={{ display: "flex", alignItems: "center", gap: 5, fontSize: 12, color: "#9ca3af" }}>
- <Spin size="small" style={{ transform: "scale(0.7)" }} />
+ <span className="flex items-center gap-1.5 text-xs text-muted-foreground">
+ <Loader2 className="h-3 w-3 animate-spin" />
Loading tools...
</span>
) : totalTools > 0 ? (
- <span style={{ display: "flex", alignItems: "center", gap: 4, fontSize: 12, color: "#6b7280" }}>
- <ToolOutlined style={{ fontSize: 11 }} />
+ <span className="flex items-center gap-1 text-xs text-muted-foreground">
+ <Wrench className="h-3 w-3" />
{totalTools} tool{totalTools !== 1 ? "s" : ""} available
</span>
) : null}
</div>
</div>
- <Input
- prefix={<SearchOutlined style={{ color: "#9ca3af", fontSize: 13 }} />}
- placeholder="Search servers..."
- value={query}
- onChange={(e) => setQuery(e.target.value)}
- allowClear
- style={{ width: 220, borderRadius: 8, fontSize: 13 }}
- size="middle"
- />
+ <div className="relative w-[220px]">
+ <Search className="absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" />
+ <Input
+ placeholder="Search servers..."
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ className="pl-9 text-[13px] h-9"
+ />
+ </div>
</div>
- {/* Tabs */}
- <div style={{ display: "flex", borderBottom: "1px solid #e5e7eb", marginBottom: 16 }}>
- {(["all", "connected"] as TabKey[]).map((tab) => (
- <button
- key={tab}
- onClick={() => setActiveTab(tab)}
- style={{
- padding: "8px 16px",
- border: "none",
- borderBottom: activeTab === tab ? "2px solid #1677ff" : "2px solid transparent",
- cursor: "pointer",
- fontSize: 13,
- fontWeight: activeTab === tab ? 600 : 400,
- background: "transparent",
- color: activeTab === tab ? "#1677ff" : "#6b7280",
- marginBottom: -1,
- }}
+ <Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as TabKey)} className="mb-4">
+ <TabsList className="bg-transparent border-b rounded-none w-full justify-start gap-0 h-auto p-0">
+ <TabsTrigger
+ value="all"
+ className="rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none px-4 py-2 text-[13px]"
>
- {tab === "all" ? "All" : `Connected${connectedCount > 0 ? ` (${connectedCount})` : ""}`}
- </button>
- ))}
- </div>
+ All
+ </TabsTrigger>
+ <TabsTrigger
+ value="connected"
+ className="rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none px-4 py-2 text-[13px]"
+ >
+ Connected{connectedCount > 0 ? ` (${connectedCount})` : ""}
+ </TabsTrigger>
+ </TabsList>
+ </Tabs>
- {/* Grid */}
{loading ? (
- <div style={{ display: "flex", justifyContent: "center", padding: "48px 0" }}>
- <Spin />
+ <div className="flex justify-center py-12">
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
</div>
) : filtered.length === 0 ? (
- <div style={{ textAlign: "center", color: "#9ca3af", fontSize: 13, padding: "48px 12px" }}>
+ <div className="text-center text-muted-foreground text-[13px] py-12 px-3">
{servers.length === 0
- ? "No MCP servers configured. Add servers in Tools → MCP Servers."
+ ? "No MCP servers configured. Add servers in Tools -> MCP Servers."
: activeTab === "connected"
? "No servers connected yet."
: "No servers match your search."}
</div>
) : (
- <div
- style={{
- display: "grid",
- gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
- gap: 0,
- border: "1px solid #e5e7eb",
- borderRadius: 10,
- overflow: "hidden",
- }}
- >
+ <div className="grid grid-cols-2 border rounded-xl overflow-hidden">
{filtered.map((server, idx) => {
const name = nameOf(server);
const isConnected = selectedServers.includes(name);
@@ -590,38 +462,15 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
<div
key={server.server_id}
onClick={() => setDetailServer(server)}
- style={{
- display: "flex",
- alignItems: "center",
- gap: 12,
- padding: "14px 16px",
- background: "#fff",
- borderRight: isLeftCol ? "1px solid #f3f4f6" : "none",
- borderBottom:
- Math.floor(idx / 2) < Math.floor((filtered.length - 1) / 2) ? "1px solid #f3f4f6" : "none",
- cursor: "pointer",
- minWidth: 0,
- transition: "background 0.1s",
- }}
- onMouseEnter={(e) => {
- (e.currentTarget as HTMLDivElement).style.background = "#fafafa";
- }}
- onMouseLeave={(e) => {
- (e.currentTarget as HTMLDivElement).style.background = "#fff";
- }}
+ className={`flex items-center gap-3 px-4 py-3.5 bg-background cursor-pointer transition-colors hover:bg-accent/30 min-w-0 ${
+ isLeftCol ? "border-r" : ""
+ } ${Math.floor(idx / 2) < Math.floor((filtered.length - 1) / 2) ? "border-b" : ""}`}
>
{server.mcp_info?.logo_url ? (
<img
src={server.mcp_info.logo_url}
alt={`${name} logo`}
- style={{
- width: 38,
- height: 38,
- borderRadius: 10,
- objectFit: "contain",
- flexShrink: 0,
- background: "#f9fafb",
- }}
+ className="w-[38px] h-[38px] rounded-xl object-contain shrink-0 bg-muted/50"
onError={(e) => {
const el = e.target as HTMLImageElement;
el.style.display = "none";
@@ -630,68 +479,32 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
/>
) : null}
<div
+ className="w-[38px] h-[38px] rounded-xl flex items-center justify-center text-white font-bold text-base shrink-0"
style={{
- width: 38,
- height: 38,
- borderRadius: 10,
background: color,
display: server.mcp_info?.logo_url ? "none" : "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "#fff",
- fontWeight: 700,
- fontSize: 16,
- flexShrink: 0,
}}
>
{name.charAt(0).toUpperCase()}
</div>
- <div style={{ flex: 1, minWidth: 0 }}>
- <div
- style={{
- fontSize: 14,
- fontWeight: 500,
- color: "#111827",
- overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "nowrap",
- }}
- >
- {name}
- </div>
- <div
- style={{
- fontSize: 12,
- color: "#9ca3af",
- marginTop: 1,
- display: "flex",
- alignItems: "center",
- gap: 6,
- }}
- >
- <span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
- {server.description ?? "MCP server"}
- </span>
+ <div className="flex-1 min-w-0">
+ <div className="text-sm font-medium text-foreground truncate">{name}</div>
+ <div className="text-xs text-muted-foreground mt-0.5 flex items-center gap-1.5">
+ <span className="truncate">{server.description ?? "MCP server"}</span>
{count !== undefined ? (
count > 0 ? (
- <span
- style={{ flexShrink: 0, display: "flex", alignItems: "center", gap: 3, color: "#9ca3af" }}
- >
- · <ToolOutlined style={{ fontSize: 10 }} /> {count}
+ <span className="shrink-0 flex items-center gap-1 text-muted-foreground">
+ · <Wrench className="h-2.5 w-2.5" /> {count}
</span>
) : null
) : loadingCounts ? (
- <Skeleton.Input
- active
- size="small"
- style={{ width: 28, height: 12, minWidth: 28, flexShrink: 0 }}
- />
+ <Skeleton className="w-7 h-3 shrink-0" />
) : null}
</div>
</div>
{server.auth_type === AUTH_TYPE.OAUTH2 ? (
oauthConnected.has(server.server_id) ? (
- <CheckCircleOutlined style={{ fontSize: 14, color: "#52c41a", flexShrink: 0 }} />
+ <CheckCircle className="h-3.5 w-3.5 text-emerald-600 shrink-0" />
) : (
<OAuth2ConnectButton
server={server}
@@ -703,9 +516,9 @@ const MCPAppsPanel: React.FC<Props> = ({ accessToken, selectedServers, onChange
/>
)
) : isConnected ? (
- <span style={{ width: 7, height: 7, borderRadius: "50%", background: "#1677ff", flexShrink: 0 }} />
+ <span className="w-[7px] h-[7px] rounded-full bg-primary shrink-0" />
) : null}
- <RightOutlined style={{ fontSize: 11, color: "#d1d5db", flexShrink: 0 }} />
+ <ChevronRight className="h-3 w-3 text-muted-foreground/40 shrink-0" />
</div>
);
})}
diff --git a/ui/litellm-dashboard/src/components/chat/MCPConnectPicker.tsx b/ui/litellm-dashboard/src/components/chat/MCPConnectPicker.tsx
index 3e13ec9dc87..8b816e6a842 100644
--- a/ui/litellm-dashboard/src/components/chat/MCPConnectPicker.tsx
+++ b/ui/litellm-dashboard/src/components/chat/MCPConnectPicker.tsx
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from "react";
-import { Switch, Spin } from "antd";
+import { Loader2 } from "lucide-react";
+import { Switch } from "@/components/ui/switch";
import MessageManager from "@/components/molecules/message_manager";
import { fetchMCPServers, listMCPTools } from "../networking";
import { MCPServer } from "../mcp_tools/types";
@@ -13,7 +14,6 @@ interface Props {
const MCPConnectPicker: React.FC<Props> = ({ accessToken, selectedServers, onChange }) => {
const [servers, setServers] = useState<MCPServer[]>([]);
const [loadingServers, setLoadingServers] = useState(true);
- // Track which individual servers are being toggled on (verifying tools)
const [togglingOn, setTogglingOn] = useState<Set<string>>(new Set());
useEffect(() => {
@@ -24,7 +24,6 @@ const MCPConnectPicker: React.FC<Props> = ({ accessToken, selectedServers, onCha
try {
const data = await fetchMCPServers(accessToken);
if (cancelled) return;
- // API returns { data: MCPServer[] } or MCPServer[]
const list: MCPServer[] = Array.isArray(data) ? data : data?.data ?? [];
setServers(list);
} catch {
@@ -47,25 +46,20 @@ const MCPConnectPicker: React.FC<Props> = ({ accessToken, selectedServers, onCha
const handleToggle = async (serverName: string, checked: boolean) => {
if (!checked) {
- // Toggle OFF — remove immediately, no tool fetch needed
onChange(selectedServers.filter((s) => s !== serverName));
return;
}
- // Toggle ON — verify tools are reachable first
setTogglingOn((prev) => new Set(prev).add(serverName));
try {
const result = await listMCPTools(accessToken, serverName);
- // listMCPTools never throws; it returns { tools, error, message } on failure
if (result?.error) {
- MessageManager.warning(`Could not load tools for ${serverName} — it will be excluded from this message.`);
- // Do not add to selectedServers
+ MessageManager.warning(`Could not load tools for ${serverName} \u2014 it will be excluded from this message.`);
return;
}
onChange([...selectedServers, serverName]);
} catch {
- MessageManager.warning(`Could not load tools for ${serverName} — it will be excluded from this message.`);
- // Do not add to selectedServers
+ MessageManager.warning(`Could not load tools for ${serverName} \u2014 it will be excluded from this message.`);
} finally {
setTogglingOn((prev) => {
const next = new Set(prev);
@@ -76,22 +70,13 @@ const MCPConnectPicker: React.FC<Props> = ({ accessToken, selectedServers, onCha
};
return (
- <div
- style={{
- maxWidth: 320,
- maxHeight: 400,
- overflowY: "auto",
- padding: "8px 0",
- }}
- >
+ <div className="max-w-[320px] max-h-[400px] overflow-y-auto py-2">
{loadingServers ? (
- <div style={{ display: "flex", justifyContent: "center", padding: "24px 0" }}>
- <Spin />
+ <div className="flex justify-center py-6">
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
</div>
) : servers.length === 0 ? (
- <div style={{ padding: "16px 12px", color: "#8c8c8c", fontSize: 13, textAlign: "center" }}>
- No MCP servers configured
- </div>
+ <div className="px-3 py-4 text-muted-foreground text-[13px] text-center">No MCP servers configured</div>
) : (
servers.map((server) => {
const name = server.server_name ?? server.alias ?? server.server_id;
@@ -99,67 +84,34 @@ const MCPConnectPicker: React.FC<Props> = ({ accessToken, selectedServers, onCha
const isTogglingOn = togglingOn.has(name);
return (
- <div
- key={server.server_id}
- style={{
- display: "flex",
- alignItems: "flex-start",
- justifyContent: "space-between",
- padding: "8px 12px",
- gap: 12,
- }}
- >
+ <div key={server.server_id} className="flex items-start justify-between px-3 py-2 gap-3">
{server.mcp_info?.logo_url && (
<img
src={server.mcp_info.logo_url}
alt={`${name} logo`}
- style={{
- width: 24,
- height: 24,
- borderRadius: 6,
- objectFit: "contain",
- flexShrink: 0,
- marginTop: 1,
- }}
+ className="w-6 h-6 rounded-md object-contain shrink-0 mt-0.5"
onError={(e) => {
(e.target as HTMLImageElement).style.display = "none";
}}
/>
)}
- <div style={{ flex: 1, minWidth: 0 }}>
- <div
- style={{
- fontWeight: 500,
- fontSize: 13,
- color: "#1f1f1f",
- whiteSpace: "nowrap",
- overflow: "hidden",
- textOverflow: "ellipsis",
- }}
- >
- {name}
- </div>
+ <div className="flex-1 min-w-0">
+ <div className="font-medium text-[13px] text-foreground truncate">{name}</div>
{server.description && (
- <div
- style={{
- fontSize: 12,
- color: "#8c8c8c",
- marginTop: 2,
- whiteSpace: "nowrap",
- overflow: "hidden",
- textOverflow: "ellipsis",
- }}
- >
- {server.description}
- </div>
+ <div className="text-xs text-muted-foreground mt-0.5 truncate">{server.description}</div>
+ )}
+ </div>
+ <div className="relative shrink-0">
+ {isTogglingOn ? (
+ <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+ ) : (
+ <Switch
+ checked={isSelected}
+ onCheckedChange={(checked) => handleToggle(name, checked)}
+ className="scale-75"
+ />
)}
</div>
- <Switch
- size="small"
- checked={isSelected}
- loading={isTogglingOn}
- onChange={(checked) => handleToggle(name, checked)}
- />
</div>
);
})
diff --git a/ui/litellm-dashboard/src/components/chat/MCPCredentialsTab.tsx b/ui/litellm-dashboard/src/components/chat/MCPCredentialsTab.tsx
index 3f5d4714d10..87f34c33fa5 100644
--- a/ui/litellm-dashboard/src/components/chat/MCPCredentialsTab.tsx
+++ b/ui/litellm-dashboard/src/components/chat/MCPCredentialsTab.tsx
@@ -1,18 +1,11 @@
"use client";
-/**
- * MCPCredentialsTab
- *
- * Shows all OAuth2 MCP connections the calling user has stored.
- * Lives in the Chat sidebar's "Credentials" tab.
- */
-
import React, { useState } from "react";
-import { Spin, Table, Tag } from "antd";
-import type { ColumnsType } from "antd/es/table";
import { useQuery, useQueryClient } from "@tanstack/react-query";
+import { Loader2, Trash2, Link } from "lucide-react";
+import { Badge } from "@/components/ui/badge";
+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import MessageManager from "@/components/molecules/message_manager";
-import { DeleteOutlined, LinkOutlined } from "@ant-design/icons";
import { deleteMCPOAuthUserCredential, listMCPUserCredentials, MCPUserCredentialListItem } from "../networking";
const MCP_CREDENTIALS_QUERY_KEY = "mcp-user-credentials";
@@ -38,21 +31,24 @@ function relativeTime(isoString: string | null | undefined): string {
}
}
-function expiryLabel(isoString: string | null | undefined): string {
- if (!isoString) return "Does not expire";
+function expiryLabel(isoString: string | null | undefined): {
+ text: string;
+ variant: "default" | "destructive" | "outline";
+} {
+ if (!isoString) return { text: "Does not expire", variant: "outline" };
try {
const exp = new Date(isoString);
const diffMs = exp.getTime() - Date.now();
- if (diffMs <= 0) return "Expired";
+ if (diffMs <= 0) return { text: "Expired", variant: "destructive" };
const diffSec = Math.floor(diffMs / 1000);
const diffMin = Math.floor(diffSec / 60);
const diffHr = Math.floor(diffMin / 60);
const diffDay = Math.floor(diffHr / 24);
- if (diffDay > 0) return `Expires in ${diffDay}d`;
- if (diffHr > 0) return `Expires in ${diffHr}h`;
- return `Expires in ${diffMin}m`;
+ if (diffDay > 0) return { text: `Expires in ${diffDay}d`, variant: "default" };
+ if (diffHr > 0) return { text: `Expires in ${diffHr}h`, variant: "default" };
+ return { text: `Expires in ${diffMin}m`, variant: "default" };
} catch {
- return "";
+ return { text: "", variant: "outline" };
}
}
@@ -86,68 +82,70 @@ const MCPCredentialsTab: React.FC<Props> = ({ accessToken }) => {
const displayName = (c: MCPUserCredentialListItem) => c.alias || c.server_name || c.server_id;
- const columns: ColumnsType<MCPUserCredentialListItem> = [
- {
- title: "App",
- key: "app",
- render: (_, cred) => <span className="text-sm font-medium text-gray-900">{displayName(cred)}</span>,
- },
- {
- title: "Connected",
- key: "connected",
- render: (_, cred) => <span className="text-sm text-gray-500">{relativeTime(cred.connected_at) || "—"}</span>,
- },
- {
- title: "Status",
- key: "status",
- render: (_, cred) => {
- const exp = expiryLabel(cred.expires_at);
- return <Tag color={exp === "Expired" ? "red" : "green"}>{exp}</Tag>;
- },
- },
- {
- title: "Actions",
- key: "actions",
- align: "right",
- render: (_, cred) => {
- const isRevoking = revoking.has(cred.server_id);
- return (
- <button
- onClick={() => handleRevoke(cred.server_id)}
- disabled={isRevoking}
- title="Revoke connection"
- className={`inline-flex items-center justify-center rounded-md border border-gray-200 px-2 py-1 text-gray-400 hover:text-red-500 hover:border-red-200 transition-colors ${isRevoking ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`}
- style={{ background: "none" }}
- >
- {isRevoking ? <Spin size="small" /> : <DeleteOutlined className="text-sm" />}
- </button>
- );
- },
- },
- ];
-
return (
<div className="w-full">
- {/* Header */}
<div className="mb-4">
- <h2 className="text-base font-semibold text-gray-900 mb-0.5">App Credentials</h2>
- <p className="text-sm text-gray-500 m-0">Your stored OAuth connections — used automatically in chat.</p>
+ <h2 className="text-base font-semibold text-foreground mb-0.5">App Credentials</h2>
+ <p className="text-sm text-muted-foreground m-0">Your stored OAuth connections; used automatically in chat</p>
</div>
{loading ? (
<div className="flex justify-center py-12">
- <Spin />
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
</div>
) : credentials.length === 0 ? (
- <div className="text-center text-gray-400 text-sm py-12 border border-dashed border-gray-200 rounded-lg">
- <LinkOutlined className="text-2xl mb-3 block text-gray-300" />
- No connections yet.
- <br />
- Go to <strong>Apps</strong> and click <strong>Connect</strong> to authorize an MCP server.
+ <div className="text-center text-muted-foreground text-sm py-12 border border-dashed rounded-lg">
+ <Link className="h-6 w-6 mb-3 mx-auto text-muted-foreground/50" />
+ <p className="m-0">No connections yet</p>
+ <p className="m-0 mt-1 text-xs">
+ Go to <span className="font-medium">Apps</span> and click <span className="font-medium">Connect</span> to
+ authorize an MCP server
+ </p>
</div>
) : (
- <div className="rounded-lg border border-gray-200 overflow-hidden">
- <Table columns={columns} dataSource={credentials} rowKey="server_id" pagination={false} size="small" />
+ <div className="rounded-lg border overflow-hidden">
+ <Table>
+ <TableHeader>
+ <TableRow className="bg-muted/50">
+ <TableHead className="text-xs font-semibold uppercase tracking-wide">App</TableHead>
+ <TableHead className="text-xs font-semibold uppercase tracking-wide">Connected</TableHead>
+ <TableHead className="text-xs font-semibold uppercase tracking-wide">Status</TableHead>
+ <TableHead className="text-xs font-semibold uppercase tracking-wide text-right">Actions</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {credentials.map((cred) => {
+ const isRevoking = revoking.has(cred.server_id);
+ const exp = expiryLabel(cred.expires_at);
+ return (
+ <TableRow key={cred.server_id}>
+ <TableCell className="text-sm font-medium">{displayName(cred)}</TableCell>
+ <TableCell className="text-sm text-muted-foreground">
+ {relativeTime(cred.connected_at) || "\u2014"}
+ </TableCell>
+ <TableCell>
+ <Badge variant={exp.variant}>{exp.text}</Badge>
+ </TableCell>
+ <TableCell className="text-right">
+ <button
+ onClick={() => handleRevoke(cred.server_id)}
+ disabled={isRevoking}
+ title="Revoke connection"
+ className="inline-flex items-center justify-center rounded-md border px-2 py-1 text-muted-foreground hover:text-destructive hover:border-destructive/50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
+ style={{ background: "none" }}
+ >
+ {isRevoking ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : (
+ <Trash2 className="h-3.5 w-3.5" />
+ )}
+ </button>
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
</div>
)}
</div>
diff --git a/ui/litellm-dashboard/src/components/chat/UsagePanel.tsx b/ui/litellm-dashboard/src/components/chat/UsagePanel.tsx
new file mode 100644
index 00000000000..ac9906455ad
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/chat/UsagePanel.tsx
@@ -0,0 +1,192 @@
+"use client";
+
+import React, { useState } from "react";
+import { Loader2, BarChart3 } from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
+import { userDailyActivityAggregatedCall } from "../networking";
+
+const USAGE_QUERY_KEY = "chat-user-usage";
+
+interface Props {
+ accessToken: string;
+ userId: string;
+}
+
+type TimeRange = "7d" | "30d" | "90d";
+
+function getDateRange(range: TimeRange): { start: Date; end: Date } {
+ const end = new Date();
+ const start = new Date();
+ const days = range === "7d" ? 7 : range === "30d" ? 30 : 90;
+ start.setDate(end.getDate() - days);
+ return { start, end };
+}
+
+interface DailyMetrics {
+ spend: number;
+ prompt_tokens: number;
+ completion_tokens: number;
+ total_tokens: number;
+ api_requests: number;
+ successful_requests: number;
+ failed_requests: number;
+}
+
+interface DailySpendEntry {
+ date: string;
+ metrics: DailyMetrics;
+}
+
+interface UsageMetadata {
+ total_spend: number;
+ total_prompt_tokens: number;
+ total_completion_tokens: number;
+ total_tokens: number;
+ total_api_requests: number;
+ total_successful_requests: number;
+ total_failed_requests: number;
+}
+
+interface UsageResponse {
+ results: DailySpendEntry[];
+ metadata: UsageMetadata;
+}
+
+function formatNumber(n: number): string {
+ if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
+ if (n >= 1_000) return `${(n / 1_000).toFixed(1)}K`;
+ return n.toLocaleString();
+}
+
+function SparklineBar({ data, maxVal }: { data: number[]; maxVal: number }) {
+ const barWidth = Math.max(2, Math.floor(200 / Math.max(data.length, 1)));
+ const height = 48;
+ return (
+ <div className="flex items-end gap-px" style={{ height }}>
+ {data.map((val, i) => {
+ const h = maxVal > 0 ? Math.max(2, (val / maxVal) * height) : 2;
+ return (
+ <div
+ key={i}
+ className="bg-primary rounded-[1px]"
+ style={{
+ width: barWidth,
+ height: h,
+ opacity: 0.7 + 0.3 * (val / Math.max(maxVal, 1)),
+ }}
+ />
+ );
+ })}
+ </div>
+ );
+}
+
+const TIME_RANGE_OPTIONS: { value: TimeRange; label: string }[] = [
+ { value: "7d", label: "7d" },
+ { value: "30d", label: "30d" },
+ { value: "90d", label: "90d" },
+];
+
+const UsagePanel: React.FC<Props> = ({ accessToken, userId }) => {
+ const [timeRange, setTimeRange] = useState<TimeRange>("30d");
+ const { start, end } = getDateRange(timeRange);
+
+ const { data, isLoading } = useQuery({
+ queryKey: [USAGE_QUERY_KEY, accessToken, userId, timeRange],
+ queryFn: () => userDailyActivityAggregatedCall(accessToken, start, end, userId),
+ enabled: !!accessToken,
+ });
+
+ const usage = data as UsageResponse | undefined;
+ const meta = usage?.metadata;
+ const dailyData = usage?.results ?? [];
+ const dailySpend = dailyData.map((d) => d.metrics.spend);
+ const dailyRequests = dailyData.map((d) => d.metrics.api_requests);
+ const maxSpend = Math.max(...dailySpend, 0);
+ const maxRequests = Math.max(...dailyRequests, 0);
+
+ const statCards: Array<{ label: string; value: string; sub?: string }> = meta
+ ? [
+ { label: "Total Spend", value: `$${meta.total_spend.toFixed(2)}` },
+ { label: "API Requests", value: formatNumber(meta.total_api_requests) },
+ {
+ label: "Tokens Used",
+ value: formatNumber(meta.total_tokens),
+ sub: `${formatNumber(meta.total_prompt_tokens)} in / ${formatNumber(meta.total_completion_tokens)} out`,
+ },
+ {
+ label: "Success Rate",
+ value:
+ meta.total_api_requests > 0
+ ? `${((meta.total_successful_requests / meta.total_api_requests) * 100).toFixed(1)}%`
+ : "N/A",
+ sub: meta.total_failed_requests > 0 ? `${meta.total_failed_requests} failed` : undefined,
+ },
+ ]
+ : [];
+
+ return (
+ <div className="w-full">
+ <div className="flex items-center justify-between mb-4">
+ <div>
+ <h2 className="text-base font-semibold text-foreground mb-0.5">Your Usage</h2>
+ <p className="text-sm text-muted-foreground m-0">Spend and request activity</p>
+ </div>
+ <div className="flex rounded-md border overflow-hidden">
+ {TIME_RANGE_OPTIONS.map((opt) => (
+ <button
+ key={opt.value}
+ onClick={() => setTimeRange(opt.value)}
+ className={`px-3 py-1.5 text-[13px] transition-colors ${
+ timeRange === opt.value
+ ? "bg-primary text-primary-foreground font-medium"
+ : "bg-background text-muted-foreground hover:bg-accent"
+ }`}
+ style={{ border: "none" }}
+ >
+ {opt.label}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {isLoading ? (
+ <div className="flex justify-center py-12">
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+ </div>
+ ) : !meta || meta.total_api_requests === 0 ? (
+ <div className="text-center text-muted-foreground text-sm py-12 border border-dashed rounded-lg">
+ <BarChart3 className="h-6 w-6 mb-3 mx-auto text-muted-foreground/50" />
+ No usage data for this period
+ </div>
+ ) : (
+ <div>
+ <div className="grid grid-cols-2 gap-3 mb-5">
+ {statCards.map((card) => (
+ <div key={card.label} className="border rounded-lg px-4 py-3.5">
+ <div className="text-xs text-muted-foreground mb-1">{card.label}</div>
+ <div className="text-xl font-semibold text-foreground">{card.value}</div>
+ {card.sub && <div className="text-xs text-muted-foreground mt-0.5">{card.sub}</div>}
+ </div>
+ ))}
+ </div>
+
+ {dailyData.length > 1 && (
+ <div className="grid grid-cols-2 gap-3">
+ <div className="border rounded-lg px-4 py-3.5">
+ <div className="text-xs text-muted-foreground mb-2">Daily Spend</div>
+ <SparklineBar data={dailySpend} maxVal={maxSpend} />
+ </div>
+ <div className="border rounded-lg px-4 py-3.5">
+ <div className="text-xs text-muted-foreground mb-2">Daily Requests</div>
+ <SparklineBar data={dailyRequests} maxVal={maxRequests} />
+ </div>
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default UsagePanel;
diff --git a/ui/litellm-dashboard/src/components/chat/design.md b/ui/litellm-dashboard/src/components/chat/design.md
new file mode 100644
index 00000000000..b357ec7df59
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/chat/design.md
@@ -0,0 +1,360 @@
+# LiteLLM Chat UI Design System
+
+## 1. Vision
+
+A focused, professional chat interface that puts the conversation first. Inspired by the best of Microsoft Copilot, GitHub Copilot Chat, and modern SaaS tooling: clean surfaces, tight typography, restrained color, and purposeful motion. Every pixel earns its place
+
+## 2. Design Principles
+
+**Density over decoration.** Maximize usable space. No ornamental gradients, no heavy shadows, no gratuitous whitespace. The UI should feel like a precision tool, not a marketing page
+
+**Quiet until needed.** Secondary controls (edit, delete, copy) appear on hover or focus. Primary actions (send, new chat) are always visible. Enterprise features (key rotation) surface only for entitled users
+
+**System-native feel.** Use the OS font stack. Respect prefers-reduced-motion. Match native scrollbar behavior. The chat should feel like it belongs on the user's machine
+
+**One layout, many views.** The sidebar + main area split is the single structural pattern. Sidebar switches between views (Chats, Apps, Credentials, API Keys, Usage) without page transitions. The main area hosts either the chat or a full-width panel
+
+## 3. Layout
+
+```
++--sidebar(260px)--+--------main-area--------+
+| logo + collapse | top-bar (model selector) |
+| nav items | |
+| divider | content area |
+| view tabs | (chat / panel view) |
+| divider | |
+| [chats list] | input bar (chat only) |
++------------------+--------------------------+
+```
+
+### Sidebar
+
+- Width: 260px expanded, 56px collapsed
+- Background: `bg-secondary` (the shadcn muted/secondary surface)
+- Border right: `border` (1px, uses --border token)
+- Collapse animation: 200ms cubic-bezier(0.4, 0, 0.2, 1)
+- Nav items: 36px tall, 8px horizontal padding, radius-md, full-width
+- Active nav item: `bg-accent` with `text-accent-foreground`
+- Hover: `bg-accent/50`
+- Icon size in nav: 16px. Label font: 14px/500
+
+### Main area
+
+- Background: `bg-background` (white in light mode)
+- Top bar: 48px tall, bottom border, contains model selector left + settings right
+- Content: flex column, fills remaining space
+- Panel views (Apps, Credentials, Keys, Usage): max-width 800px, centered, 32px vertical padding, 24px horizontal
+
+### Responsive behavior
+
+- Below 768px: sidebar auto-collapses to icon rail
+- Below 480px: sidebar becomes an overlay drawer
+- Input bar sticks to bottom in all viewports
+
+## 4. Color
+
+Use the shadcn/Tailwind CSS variable system already defined in globals.css. No hardcoded hex values in components
+
+| Token | Usage |
+| -------------------------- | ---------------------------------------- |
+| `background` | Main area, input surfaces |
+| `foreground` | Primary text |
+| `muted` | Sidebar background, disabled surfaces |
+| `muted-foreground` | Secondary text, timestamps, placeholders |
+| `primary` | Send button, active indicators, links |
+| `primary-foreground` | Text on primary surfaces |
+| `secondary` | Sidebar surface, subtle backgrounds |
+| `border` | All 1px separators |
+| `accent` | Hover states, active nav items |
+| `destructive` | Delete actions, error states |
+| `card` / `card-foreground` | Elevated surfaces (modals, popovers) |
+
+### Accent colors for status
+
+- Connected/success: `text-emerald-600`
+- Warning/expiring: `text-amber-600`
+- Error/expired: `text-destructive`
+- Info/neutral: `text-muted-foreground`
+
+## 5. Typography
+
+Font stack: system default inherited from body (defined in globals.css, `-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif`)
+
+| Element | Size | Weight | Line Height | Color |
+| ----------------------- | ---- | ------ | ----------- | ------------------ |
+| Page heading (greeting) | 28px | 600 | 1.2 | `foreground` |
+| Section heading | 18px | 600 | 1.3 | `foreground` |
+| Subsection heading | 15px | 600 | 1.4 | `foreground` |
+| Body / message text | 14px | 400 | 1.7 | `foreground` |
+| UI label (nav, button) | 14px | 500 | 1 | varies |
+| Small label | 13px | 400 | 1.4 | `muted-foreground` |
+| Timestamp | 11px | 400 | 1 | `muted-foreground` |
+| Group header (Today) | 11px | 600 | 1 | `muted-foreground` |
+| Code (inline) | 13px | 400 | 1.4 | `foreground` |
+| Code (block) | 13px | 400 | 1.5 | `foreground` |
+
+Monospace stack for code: `ui-monospace, SFMono-Regular, 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace`
+
+## 6. Spacing
+
+Use Tailwind's spacing scale consistently. Avoid arbitrary pixel values
+
+| Context | Value |
+| ----------------------- | ----------------------------------------------- |
+| Sidebar padding (outer) | `p-2` (8px) |
+| Nav item padding | `px-2.5 py-2` (10px, 8px) |
+| Section divider margin | `my-1 mx-2` (4px, 8px) |
+| Content area padding | `p-6` (24px) horizontal, `py-8` (32px) vertical |
+| Card internal padding | `p-3` to `p-4` (12-16px) |
+| Message gap | `gap-4` (16px) between messages |
+| Button internal padding | `px-4 py-2` (16px, 8px) default |
+
+## 7. Component Specifications
+
+### 7.1 Chat Bubbles
+
+**User bubble**
+
+- Alignment: right-aligned, max-width 72%
+- Background: `bg-muted` (light gray)
+- Border radius: 16px (`rounded-2xl`)
+- Padding: 10px 14px
+- Font: 14px, line-height 1.6
+- Edit button appears on hover to the left, icon-only, `text-muted-foreground`
+
+**Assistant bubble**
+
+- Alignment: left-aligned, max-width 80%
+- No background (text renders directly)
+- Markdown rendered with syntax highlighting for code blocks
+- Copy button below, muted until hovered
+
+**Tool call card**
+
+- Collapsible (collapsed by default)
+- Border: `border`, rounded-lg
+- Background: `bg-muted/50`
+- Header: tool icon + tool name, 13px/500
+- Content sections labeled "Arguments" / "Result" in uppercase 11px/600
+
+### 7.2 Input Bar
+
+- Position: bottom of chat area, above-fold
+- Container: `border rounded-xl` with inner padding
+- Textarea: auto-growing, no visible border, inherits font
+- Bottom row: model indicator left, send button right
+- Send button: `bg-primary text-primary-foreground rounded-md px-4 py-1.5`
+- Disabled send: `bg-muted text-muted-foreground cursor-not-allowed`
+- Stop button (during streaming): circular, 32px, border only, square stop icon inside
+
+### 7.3 Model Selector
+
+- Trigger: ghost button in top bar showing model name + provider logo
+- Dropdown: popover with search input + scrollable model list
+- Selected model: checkmark icon, `text-primary`
+- Comparison mode: up to 3 models, shown as pills
+
+### 7.4 Sidebar Navigation
+
+Each nav item is a full-width row:
+
+```
+[icon 16px] [label 14px/500]
+```
+
+- Default: `text-muted-foreground`, transparent background
+- Hover: `bg-accent/50`
+- Active: `bg-accent text-accent-foreground` with `font-medium`
+- Collapsed sidebar: icon only, centered, with tooltip on hover
+
+### 7.5 Conversation List
+
+- Grouped by date: Today, Yesterday, Last 7 Days, Older
+- Group headers: uppercase, 11px/600, `text-muted-foreground`, letter-spacing 0.04em
+- Row: 34px min-height, `rounded-md`, 6px 8px padding
+- Active row: `bg-accent`
+- Hover row: `bg-accent/50`
+- Action icons (edit, delete): appear on hover, opacity transition 150ms
+- Delete confirmation: shadcn AlertDialog, not a popconfirm tooltip
+
+### 7.6 Cmd+K Search
+
+- Trigger: Ctrl/Cmd + K globally
+- Dialog (shadcn Dialog, not Modal): 480px wide, centered vertically
+- Search input at top with search icon prefix
+- Results list: scrollable, max-height 320px
+- Each result: message icon, truncated title, date badge right-aligned
+- Click selects and closes
+
+### 7.7 Data Tables (Keys, Credentials)
+
+Use shadcn's table primitives (Table, TableHeader, TableBody, TableRow, TableCell) with Tailwind styling, not antd Table
+
+- Border: `border rounded-lg overflow-hidden`
+- Header row: `bg-muted/50`, uppercase 11px/600 labels
+- Body rows: 44px min-height, `border-b last:border-0`
+- Hover: `bg-accent/30`
+- Cell text: 13-14px
+- Action buttons: ghost/outline variant, icon-only where possible
+
+### 7.8 Dialogs and Modals
+
+Use shadcn Dialog component
+
+- Overlay: black at 50% opacity
+- Content: `bg-card`, rounded-xl, max-width varies (480px for search, 520px for forms)
+- Header: title left, close X right
+- Footer: action buttons right-aligned, primary action on the right
+- Form inputs: shadcn Input with label above
+- Spacing: 24px padding, 16px between form fields
+
+### 7.9 Status Badges
+
+Use shadcn Badge component
+
+- Default (neutral): `bg-secondary text-secondary-foreground`
+- Active/connected: green outline variant
+- Warning/expiring: amber outline variant
+- Error/expired: destructive variant
+- Enterprise: primary variant with lock icon
+
+### 7.10 Loading States
+
+- Spinner: use a simple CSS spinner or Lucide `Loader2` icon with `animate-spin`, not antd Spin
+- Skeleton: use shadcn Skeleton (pulsing gray bars)
+- Typing indicator: three bouncing dots (keep existing CSS animation)
+- Thinking placeholder: pulsing "Thinking..." text
+
+### 7.11 MCP Server Cards (Apps Panel)
+
+- Grid: 2-column on desktop, 1-column below 640px
+- Card: `border rounded-lg` with padding 14px 16px
+- Avatar: 38px, rounded-xl, either logo image or initial with hash-based color
+- Hover: `bg-accent/30` transition 100ms
+- Detail view: back button, larger avatar (64px), info table, tools list
+
+### 7.12 Keys Panel
+
+- Table with columns: Key Alias, Key (masked), Spend/Budget, Expires, Created
+- Masked key format: `sk-...XXXX` (last 4 chars)
+- Rotate button: outline variant, only rendered when `premiumUser === true`
+- Non-premium users see a muted "Enterprise" badge where rotate would be
+- Rotation modal: form with duration, key alias, max budget, grace period fields
+- After rotation: show new key in a mono-font box with copy button
+
+### 7.13 Usage Panel
+
+- Time range selector: segmented control (7d / 30d / 90d)
+- Stat cards row: 4 cards showing Total Spend, API Requests, Tokens, Success Rate
+- Each card: `border rounded-lg p-4`, label above, large number below, subtitle
+- Charts: simple inline bar charts using divs with percentage widths
+- Colors: `bg-primary` for spend bars, `bg-chart-2` for request bars
+
+### 7.14 Toggle/Switch (MCP Connect Picker)
+
+Use shadcn Switch component
+
+- Size: small (16px height)
+- Track: `bg-input` unchecked, `bg-primary` checked
+- Loading state: spinner overlaid
+
+## 8. Interaction & Motion
+
+| Interaction | Timing | Easing |
+| ------------------- | ----------- | ---------------------------- |
+| Hover background | 150ms | ease |
+| Sidebar collapse | 200ms | cubic-bezier(0.4, 0, 0.2, 1) |
+| Modal open/close | 150ms | ease-out / ease-in |
+| Icon opacity reveal | 150ms | ease |
+| Tooltip appear | 200ms delay | ease |
+| Button press | 100ms | ease |
+
+All motion respects `prefers-reduced-motion: reduce` by collapsing to 0ms
+
+## 9. Accessibility
+
+- All interactive elements have visible focus rings (shadcn default: `ring-ring/50`)
+- Keyboard navigation: Tab through nav items, Enter/Space to activate
+- Cmd+K search is keyboard-accessible end-to-end
+- Tooltip content duplicated in aria-label for icon-only buttons
+- Color contrast: all text meets WCAG 2.1 AA (4.5:1 for body text, 3:1 for large text)
+- Screen reader: conversation list items use role="listbox" + role="option"
+
+## 10. shadcn Components Used
+
+Components to install and use across the chat UI:
+
+| Component | Replaces (antd) | Used in |
+| ----------- | -------------------- | ----------------------------- |
+| Button | antd Button | All buttons |
+| Input | antd Input | Search, rename, form fields |
+| Dialog | antd Modal | Search, key rotation, delete |
+| AlertDialog | antd Popconfirm | Delete confirmation |
+| Popover | antd Popover | Model selector, MCP picker |
+| Tooltip | antd Tooltip | Icon tooltips |
+| Table\* | antd Table | Keys, credentials |
+| Badge | antd Tag | Status indicators |
+| Switch | antd Switch | MCP server toggles |
+| Select | antd Select | Time range, form selects |
+| Skeleton | antd Skeleton | Loading placeholders |
+| ScrollArea | native overflow-auto | Conversation list, model list |
+| Collapsible | antd Collapse | Tool call cards |
+| Separator | div with border | Sidebar dividers |
+| Label | (none) | Form field labels |
+| Tabs | custom tab buttons | Apps panel tabs |
+
+\*For tables, use the shadcn table primitives (Table, TableHeader, TableRow, etc.) which are thin wrappers around native `<table>` with Tailwind classes, not a heavy data-table library
+
+## 11. File Structure
+
+```
+src/components/chat/
+ ChatPage.tsx # Layout shell, routing, state orchestration
+ ConversationList.tsx # Sidebar chat list with date grouping
+ ChatMessages.tsx # Message rendering (user, assistant, tool)
+ MCPAppsPanel.tsx # Apps grid + detail view
+ MCPConnectPicker.tsx # MCP server toggle popover
+ MCPCredentialsTab.tsx # OAuth credentials table
+ KeysPanel.tsx # API key viewing + rotation
+ UsagePanel.tsx # Spend/usage analytics
+ types.ts # Shared TypeScript types
+ useChatHistory.ts # Chat persistence hook
+ design.md # This file
+```
+
+## 12. Migration Notes
+
+The migration from antd to shadcn is component-by-component. Each file should:
+
+1. Replace antd imports with shadcn component imports + Lucide icons
+2. Convert inline `style={{}}` objects to Tailwind classes where practical
+3. Use CSS variables via Tailwind tokens (`bg-primary`, `text-muted-foreground`) instead of hardcoded hex
+4. Keep the same prop interfaces and behavioral contracts
+5. Preserve all keyboard shortcuts and accessibility features
+
+antd's `@ant-design/icons` are replaced by Lucide React icons (already the shadcn default icon library per components.json). Mapping:
+
+| antd icon | Lucide equivalent |
+| ------------------- | ----------------- |
+| EditOutlined | Pencil |
+| DeleteOutlined | Trash2 |
+| PlusOutlined | Plus |
+| SearchOutlined | Search |
+| MenuFoldOutlined | PanelLeftClose |
+| MenuUnfoldOutlined | PanelLeftOpen |
+| MessageOutlined | MessageSquare |
+| AppstoreOutlined | LayoutGrid |
+| KeyOutlined | KeyRound |
+| LockOutlined | Lock |
+| BarChartOutlined | BarChart3 |
+| SettingOutlined | Settings |
+| ArrowLeftOutlined | ArrowLeft |
+| DownOutlined | ChevronDown |
+| CheckOutlined | Check |
+| CopyOutlined | Copy |
+| SyncOutlined | RefreshCw |
+| ToolOutlined | Wrench |
+| RightOutlined | ChevronRight |
+| CheckCircleOutlined | CheckCircle |
+| UserOutlined | User |
+| LinkOutlined | Link |
diff --git a/ui/litellm-dashboard/src/components/ui/alert-dialog.tsx b/ui/litellm-dashboard/src/components/ui/alert-dialog.tsx
new file mode 100644
index 00000000000..1561cc76cb8
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/alert-dialog.tsx
@@ -0,0 +1,163 @@
+"use client";
+
+import * as React from "react";
+import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+import { Button } from "@/components/ui/button";
+
+function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
+}
+
+function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
+ return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;
+}
+
+function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
+ return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />;
+}
+
+function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
+ return (
+ <AlertDialogPrimitive.Overlay
+ data-slot="alert-dialog-overlay"
+ className={cn(
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogContent({
+ className,
+ size = "default",
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
+ size?: "default" | "sm";
+}) {
+ return (
+ <AlertDialogPortal>
+ <AlertDialogOverlay />
+ <AlertDialogPrimitive.Content
+ data-slot="alert-dialog-content"
+ data-size={size}
+ className={cn(
+ "group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
+ className,
+ )}
+ {...props}
+ />
+ </AlertDialogPortal>
+ );
+}
+
+function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="alert-dialog-header"
+ className={cn(
+ "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="alert-dialog-footer"
+ className={cn(
+ "flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
+ return (
+ <AlertDialogPrimitive.Title
+ data-slot="alert-dialog-title"
+ className={cn(
+ "text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogDescription({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
+ return (
+ <AlertDialogPrimitive.Description
+ data-slot="alert-dialog-description"
+ className={cn("text-sm text-muted-foreground", className)}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogMedia({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="alert-dialog-media"
+ className={cn(
+ "mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function AlertDialogAction({
+ className,
+ variant = "default",
+ size = "default",
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
+ return (
+ <Button variant={variant} size={size} asChild>
+ <AlertDialogPrimitive.Action data-slot="alert-dialog-action" className={cn(className)} {...props} />
+ </Button>
+ );
+}
+
+function AlertDialogCancel({
+ className,
+ variant = "outline",
+ size = "default",
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
+ return (
+ <Button variant={variant} size={size} asChild>
+ <AlertDialogPrimitive.Cancel data-slot="alert-dialog-cancel" className={cn(className)} {...props} />
+ </Button>
+ );
+}
+
+export {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogOverlay,
+ AlertDialogPortal,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+};
diff --git a/ui/litellm-dashboard/src/components/ui/badge.tsx b/ui/litellm-dashboard/src/components/ui/badge.tsx
new file mode 100644
index 00000000000..f86e36cb11a
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/badge.tsx
@@ -0,0 +1,40 @@
+import * as React from "react";
+import { cva, type VariantProps } from "class-variance-authority";
+import { Slot } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+const badgeVariants = cva(
+ "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",
+ {
+ variants: {
+ variant: {
+ default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
+ secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
+ destructive:
+ "bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
+ outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
+ ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
+ link: "text-primary underline-offset-4 [a&]:hover:underline",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ },
+);
+
+function Badge({
+ className,
+ variant = "default",
+ asChild = false,
+ ...props
+}: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot.Root : "span";
+
+ return (
+ <Comp data-slot="badge" data-variant={variant} className={cn(badgeVariants({ variant }), className)} {...props} />
+ );
+}
+
+export { Badge, badgeVariants };
diff --git a/ui/litellm-dashboard/src/components/ui/collapsible.tsx b/ui/litellm-dashboard/src/components/ui/collapsible.tsx
new file mode 100644
index 00000000000..7fb672b2efa
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/collapsible.tsx
@@ -0,0 +1,17 @@
+"use client";
+
+import { Collapsible as CollapsiblePrimitive } from "radix-ui";
+
+function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
+}
+
+function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
+ return <CollapsiblePrimitive.CollapsibleTrigger data-slot="collapsible-trigger" {...props} />;
+}
+
+function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
+ return <CollapsiblePrimitive.CollapsibleContent data-slot="collapsible-content" {...props} />;
+}
+
+export { Collapsible, CollapsibleTrigger, CollapsibleContent };
diff --git a/ui/litellm-dashboard/src/components/ui/dialog.tsx b/ui/litellm-dashboard/src/components/ui/dialog.tsx
new file mode 100644
index 00000000000..24dcbc5456c
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/dialog.tsx
@@ -0,0 +1,138 @@
+"use client";
+
+import * as React from "react";
+import { XIcon } from "lucide-react";
+import { Dialog as DialogPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+import { Button } from "@/components/ui/button";
+
+function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
+}
+
+function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
+}
+
+function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
+}
+
+function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
+}
+
+function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
+ return (
+ <DialogPrimitive.Overlay
+ data-slot="dialog-overlay"
+ className={cn(
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function DialogContent({
+ className,
+ children,
+ showCloseButton = true,
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Content> & {
+ showCloseButton?: boolean;
+}) {
+ return (
+ <DialogPortal data-slot="dialog-portal">
+ <DialogOverlay />
+ <DialogPrimitive.Content
+ data-slot="dialog-content"
+ className={cn(
+ "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ {showCloseButton && (
+ <DialogPrimitive.Close
+ data-slot="dialog-close"
+ className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
+ >
+ <XIcon />
+ <span className="sr-only">Close</span>
+ </DialogPrimitive.Close>
+ )}
+ </DialogPrimitive.Content>
+ </DialogPortal>
+ );
+}
+
+function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="dialog-header"
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
+ {...props}
+ />
+ );
+}
+
+function DialogFooter({
+ className,
+ showCloseButton = false,
+ children,
+ ...props
+}: React.ComponentProps<"div"> & {
+ showCloseButton?: boolean;
+}) {
+ return (
+ <div
+ data-slot="dialog-footer"
+ className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
+ {...props}
+ >
+ {children}
+ {showCloseButton && (
+ <DialogPrimitive.Close asChild>
+ <Button variant="outline">Close</Button>
+ </DialogPrimitive.Close>
+ )}
+ </div>
+ );
+}
+
+function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
+ return (
+ <DialogPrimitive.Title
+ data-slot="dialog-title"
+ className={cn("text-lg leading-none font-semibold", className)}
+ {...props}
+ />
+ );
+}
+
+function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {
+ return (
+ <DialogPrimitive.Description
+ data-slot="dialog-description"
+ className={cn("text-sm text-muted-foreground", className)}
+ {...props}
+ />
+ );
+}
+
+export {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogOverlay,
+ DialogPortal,
+ DialogTitle,
+ DialogTrigger,
+};
diff --git a/ui/litellm-dashboard/src/components/ui/input.tsx b/ui/litellm-dashboard/src/components/ui/input.tsx
new file mode 100644
index 00000000000..71764ec27b2
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/input.tsx
@@ -0,0 +1,21 @@
+import * as React from "react";
+
+import { cn } from "@/lib/cva.config";
+
+function Input({ className, type, ...props }: React.ComponentProps<"input">) {
+ return (
+ <input
+ type={type}
+ data-slot="input"
+ className={cn(
+ "h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export { Input };
diff --git a/ui/litellm-dashboard/src/components/ui/label.tsx b/ui/litellm-dashboard/src/components/ui/label.tsx
new file mode 100644
index 00000000000..77c2cc6254d
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/label.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import * as React from "react";
+import { Label as LabelPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
+ return (
+ <LabelPrimitive.Root
+ data-slot="label"
+ className={cn(
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export { Label };
diff --git a/ui/litellm-dashboard/src/components/ui/popover.tsx b/ui/litellm-dashboard/src/components/ui/popover.tsx
new file mode 100644
index 00000000000..a4437c0573a
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/popover.tsx
@@ -0,0 +1,54 @@
+"use client";
+
+import * as React from "react";
+import { Popover as PopoverPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
+ return <PopoverPrimitive.Root data-slot="popover" {...props} />;
+}
+
+function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
+ return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
+}
+
+function PopoverContent({
+ className,
+ align = "center",
+ sideOffset = 4,
+ ...props
+}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
+ return (
+ <PopoverPrimitive.Portal>
+ <PopoverPrimitive.Content
+ data-slot="popover-content"
+ align={align}
+ sideOffset={sideOffset}
+ className={cn(
+ "z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
+ className,
+ )}
+ {...props}
+ />
+ </PopoverPrimitive.Portal>
+ );
+}
+
+function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
+ return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
+}
+
+function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return <div data-slot="popover-header" className={cn("flex flex-col gap-1 text-sm", className)} {...props} />;
+}
+
+function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
+ return <div data-slot="popover-title" className={cn("font-medium", className)} {...props} />;
+}
+
+function PopoverDescription({ className, ...props }: React.ComponentProps<"p">) {
+ return <p data-slot="popover-description" className={cn("text-muted-foreground", className)} {...props} />;
+}
+
+export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverHeader, PopoverTitle, PopoverDescription };
diff --git a/ui/litellm-dashboard/src/components/ui/scroll-area.tsx b/ui/litellm-dashboard/src/components/ui/scroll-area.tsx
new file mode 100644
index 00000000000..b23d2daebc3
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/scroll-area.tsx
@@ -0,0 +1,48 @@
+"use client";
+
+import * as React from "react";
+import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
+ return (
+ <ScrollAreaPrimitive.Root data-slot="scroll-area" className={cn("relative", className)} {...props}>
+ <ScrollAreaPrimitive.Viewport
+ data-slot="scroll-area-viewport"
+ className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
+ >
+ {children}
+ </ScrollAreaPrimitive.Viewport>
+ <ScrollBar />
+ <ScrollAreaPrimitive.Corner />
+ </ScrollAreaPrimitive.Root>
+ );
+}
+
+function ScrollBar({
+ className,
+ orientation = "vertical",
+ ...props
+}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
+ return (
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
+ data-slot="scroll-area-scrollbar"
+ orientation={orientation}
+ className={cn(
+ "flex touch-none p-px transition-colors select-none",
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
+ className,
+ )}
+ {...props}
+ >
+ <ScrollAreaPrimitive.ScrollAreaThumb
+ data-slot="scroll-area-thumb"
+ className="relative flex-1 rounded-full bg-border"
+ />
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
+ );
+}
+
+export { ScrollArea, ScrollBar };
diff --git a/ui/litellm-dashboard/src/components/ui/select.tsx b/ui/litellm-dashboard/src/components/ui/select.tsx
new file mode 100644
index 00000000000..be6bf72c744
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/select.tsx
@@ -0,0 +1,162 @@
+"use client";
+
+import * as React from "react";
+import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
+import { Select as SelectPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
+ return <SelectPrimitive.Root data-slot="select" {...props} />;
+}
+
+function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />;
+}
+
+function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />;
+}
+
+function SelectTrigger({
+ className,
+ size = "default",
+ children,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
+ size?: "sm" | "default";
+}) {
+ return (
+ <SelectPrimitive.Trigger
+ data-slot="select-trigger"
+ data-size={size}
+ className={cn(
+ "flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <SelectPrimitive.Icon asChild>
+ <ChevronDownIcon className="size-4 opacity-50" />
+ </SelectPrimitive.Icon>
+ </SelectPrimitive.Trigger>
+ );
+}
+
+function SelectContent({
+ className,
+ children,
+ position = "item-aligned",
+ align = "center",
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Content>) {
+ return (
+ <SelectPrimitive.Portal>
+ <SelectPrimitive.Content
+ data-slot="select-content"
+ className={cn(
+ "relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
+ position === "popper" &&
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
+ className,
+ )}
+ position={position}
+ align={align}
+ {...props}
+ >
+ <SelectScrollUpButton />
+ <SelectPrimitive.Viewport
+ className={cn(
+ "p-1",
+ position === "popper" &&
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
+ )}
+ >
+ {children}
+ </SelectPrimitive.Viewport>
+ <SelectScrollDownButton />
+ </SelectPrimitive.Content>
+ </SelectPrimitive.Portal>
+ );
+}
+
+function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
+ return (
+ <SelectPrimitive.Label
+ data-slot="select-label"
+ className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
+ {...props}
+ />
+ );
+}
+
+function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
+ return (
+ <SelectPrimitive.Item
+ data-slot="select-item"
+ className={cn(
+ "relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
+ className,
+ )}
+ {...props}
+ >
+ <span data-slot="select-item-indicator" className="absolute right-2 flex size-3.5 items-center justify-center">
+ <SelectPrimitive.ItemIndicator>
+ <CheckIcon className="size-4" />
+ </SelectPrimitive.ItemIndicator>
+ </span>
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
+ </SelectPrimitive.Item>
+ );
+}
+
+function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
+ return (
+ <SelectPrimitive.Separator
+ data-slot="select-separator"
+ className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
+ {...props}
+ />
+ );
+}
+
+function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
+ return (
+ <SelectPrimitive.ScrollUpButton
+ data-slot="select-scroll-up-button"
+ className={cn("flex cursor-default items-center justify-center py-1", className)}
+ {...props}
+ >
+ <ChevronUpIcon className="size-4" />
+ </SelectPrimitive.ScrollUpButton>
+ );
+}
+
+function SelectScrollDownButton({
+ className,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
+ return (
+ <SelectPrimitive.ScrollDownButton
+ data-slot="select-scroll-down-button"
+ className={cn("flex cursor-default items-center justify-center py-1", className)}
+ {...props}
+ >
+ <ChevronDownIcon className="size-4" />
+ </SelectPrimitive.ScrollDownButton>
+ );
+}
+
+export {
+ Select,
+ SelectContent,
+ SelectGroup,
+ SelectItem,
+ SelectLabel,
+ SelectScrollDownButton,
+ SelectScrollUpButton,
+ SelectSeparator,
+ SelectTrigger,
+ SelectValue,
+};
diff --git a/ui/litellm-dashboard/src/components/ui/separator.tsx b/ui/litellm-dashboard/src/components/ui/separator.tsx
new file mode 100644
index 00000000000..6a1a78d1022
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/separator.tsx
@@ -0,0 +1,28 @@
+"use client";
+
+import * as React from "react";
+import { Separator as SeparatorPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function Separator({
+ className,
+ orientation = "horizontal",
+ decorative = true,
+ ...props
+}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
+ return (
+ <SeparatorPrimitive.Root
+ data-slot="separator"
+ decorative={decorative}
+ orientation={orientation}
+ className={cn(
+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+export { Separator };
diff --git a/ui/litellm-dashboard/src/components/ui/skeleton.tsx b/ui/litellm-dashboard/src/components/ui/skeleton.tsx
new file mode 100644
index 00000000000..e27145708a2
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/skeleton.tsx
@@ -0,0 +1,7 @@
+import { cn } from "@/lib/cva.config";
+
+function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
+ return <div data-slot="skeleton" className={cn("animate-pulse rounded-md bg-accent", className)} {...props} />;
+}
+
+export { Skeleton };
diff --git a/ui/litellm-dashboard/src/components/ui/switch.tsx b/ui/litellm-dashboard/src/components/ui/switch.tsx
new file mode 100644
index 00000000000..cf9c75898fb
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/switch.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import * as React from "react";
+import { Switch as SwitchPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function Switch({
+ className,
+ size = "default",
+ ...props
+}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
+ size?: "sm" | "default";
+}) {
+ return (
+ <SwitchPrimitive.Root
+ data-slot="switch"
+ data-size={size}
+ className={cn(
+ "peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
+ className,
+ )}
+ {...props}
+ >
+ <SwitchPrimitive.Thumb
+ data-slot="switch-thumb"
+ className={cn(
+ "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground",
+ )}
+ />
+ </SwitchPrimitive.Root>
+ );
+}
+
+export { Switch };
diff --git a/ui/litellm-dashboard/src/components/ui/table.tsx b/ui/litellm-dashboard/src/components/ui/table.tsx
new file mode 100644
index 00000000000..aff687f432d
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/table.tsx
@@ -0,0 +1,78 @@
+"use client";
+
+import * as React from "react";
+
+import { cn } from "@/lib/cva.config";
+
+function Table({ className, ...props }: React.ComponentProps<"table">) {
+ return (
+ <div data-slot="table-container" className="relative w-full overflow-x-auto">
+ <table data-slot="table" className={cn("w-full caption-bottom text-sm", className)} {...props} />
+ </div>
+ );
+}
+
+function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
+ return <thead data-slot="table-header" className={cn("[&_tr]:border-b", className)} {...props} />;
+}
+
+function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
+ return <tbody data-slot="table-body" className={cn("[&_tr:last-child]:border-0", className)} {...props} />;
+}
+
+function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
+ return (
+ <tfoot
+ data-slot="table-footer"
+ className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)}
+ {...props}
+ />
+ );
+}
+
+function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
+ return (
+ <tr
+ data-slot="table-row"
+ className={cn(
+ "border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TableHead({ className, ...props }: React.ComponentProps<"th">) {
+ return (
+ <th
+ data-slot="table-head"
+ className={cn(
+ "h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TableCell({ className, ...props }: React.ComponentProps<"td">) {
+ return (
+ <td
+ data-slot="table-cell"
+ className={cn(
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
+ return (
+ <caption data-slot="table-caption" className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} />
+ );
+}
+
+export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
diff --git a/ui/litellm-dashboard/src/components/ui/tabs.tsx b/ui/litellm-dashboard/src/components/ui/tabs.tsx
new file mode 100644
index 00000000000..1f6ccca5f73
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/tabs.tsx
@@ -0,0 +1,71 @@
+"use client";
+
+import * as React from "react";
+import { cva, type VariantProps } from "class-variance-authority";
+import { Tabs as TabsPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function Tabs({ className, orientation = "horizontal", ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {
+ return (
+ <TabsPrimitive.Root
+ data-slot="tabs"
+ data-orientation={orientation}
+ orientation={orientation}
+ className={cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className)}
+ {...props}
+ />
+ );
+}
+
+const tabsListVariants = cva(
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",
+ {
+ variants: {
+ variant: {
+ default: "bg-muted",
+ line: "gap-1 bg-transparent",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ },
+);
+
+function TabsList({
+ className,
+ variant = "default",
+ ...props
+}: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>) {
+ return (
+ <TabsPrimitive.List
+ data-slot="tabs-list"
+ data-variant={variant}
+ className={cn(tabsListVariants({ variant }), className)}
+ {...props}
+ />
+ );
+}
+
+function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
+ return (
+ <TabsPrimitive.Trigger
+ data-slot="tabs-trigger"
+ className={cn(
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent",
+ "data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground",
+ "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>) {
+ return <TabsPrimitive.Content data-slot="tabs-content" className={cn("flex-1 outline-none", className)} {...props} />;
+}
+
+export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
diff --git a/ui/litellm-dashboard/src/components/ui/tooltip.tsx b/ui/litellm-dashboard/src/components/ui/tooltip.tsx
new file mode 100644
index 00000000000..569ff709bc8
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/ui/tooltip.tsx
@@ -0,0 +1,44 @@
+"use client";
+
+import * as React from "react";
+import { Tooltip as TooltipPrimitive } from "radix-ui";
+
+import { cn } from "@/lib/cva.config";
+
+function TooltipProvider({ delayDuration = 0, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
+ return <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} />;
+}
+
+function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
+ return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
+}
+
+function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
+}
+
+function TooltipContent({
+ className,
+ sideOffset = 0,
+ children,
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
+ return (
+ <TooltipPrimitive.Portal>
+ <TooltipPrimitive.Content
+ data-slot="tooltip-content"
+ sideOffset={sideOffset}
+ className={cn(
+ "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
+ </TooltipPrimitive.Content>
+ </TooltipPrimitive.Portal>
+ );
+}
+
+export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };