From 11314f4baea3665d01625d64a77e46a1f851d6c0 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 3 Jul 2026 20:15:33 +0000 Subject: [PATCH 1/7] feat(ui): migrate chat UI from antd to shadcn/ui Replace all Ant Design components (Table, Modal, Popover, Tooltip, Skeleton, Select, Spin, Popconfirm, Switch) with shadcn/ui primitives and Lucide React icons across all chat components: - ChatPage: sidebar, model selector, input bar, comparison mode - ConversationList: search dialog, delete confirmation, scroll area - ChatMessages: message bubbles, tool cards, copy button - MCPAppsPanel: list/detail views, OAuth2 flow, tabs - MCPConnectPicker: server toggle switches - MCPCredentialsTab: credentials table with delete - KeysPanel: API key management with rotation dialog (enterprise) - UsagePanel: spend/request stats with sparkline charts Add design.md as the design specification guiding the migration. Install 15 shadcn/ui components (dialog, popover, tooltip, table, etc.). All existing functionality preserved; no backend changes. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- ui/litellm-dashboard/eslint-metrics.json | 2 +- .../src/app/chat/page.test.tsx | 1 + ui/litellm-dashboard/src/app/chat/page.tsx | 3 +- .../src/components/chat/ChatMessages.tsx | 331 ++---- .../src/components/chat/ChatPage.tsx | 985 ++++++------------ .../src/components/chat/ConversationList.tsx | 374 +++---- .../src/components/chat/KeysPanel.tsx | 357 +++++++ .../src/components/chat/MCPAppsPanel.tsx | 397 ++----- .../src/components/chat/MCPConnectPicker.tsx | 96 +- .../src/components/chat/MCPCredentialsTab.tsx | 134 ++- .../src/components/chat/UsagePanel.tsx | 192 ++++ .../src/components/chat/design.md | 360 +++++++ .../src/components/ui/alert-dialog.tsx | 163 +++ .../src/components/ui/badge.tsx | 40 + .../src/components/ui/collapsible.tsx | 17 + .../src/components/ui/dialog.tsx | 138 +++ .../src/components/ui/input.tsx | 21 + .../src/components/ui/label.tsx | 21 + .../src/components/ui/popover.tsx | 54 + .../src/components/ui/scroll-area.tsx | 48 + .../src/components/ui/select.tsx | 162 +++ .../src/components/ui/separator.tsx | 28 + .../src/components/ui/skeleton.tsx | 7 + .../src/components/ui/switch.tsx | 35 + .../src/components/ui/table.tsx | 78 ++ .../src/components/ui/tabs.tsx | 71 ++ .../src/components/ui/tooltip.tsx | 44 + 27 files changed, 2557 insertions(+), 1602 deletions(-) create mode 100644 ui/litellm-dashboard/src/components/chat/KeysPanel.tsx create mode 100644 ui/litellm-dashboard/src/components/chat/UsagePanel.tsx create mode 100644 ui/litellm-dashboard/src/components/chat/design.md create mode 100644 ui/litellm-dashboard/src/components/ui/alert-dialog.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/badge.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/collapsible.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/dialog.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/input.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/label.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/popover.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/scroll-area.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/select.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/separator.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/skeleton.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/switch.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/table.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/tabs.tsx create mode 100644 ui/litellm-dashboard/src/components/ui/tooltip.tsx diff --git a/ui/litellm-dashboard/eslint-metrics.json b/ui/litellm-dashboard/eslint-metrics.json index cf754a1bb75b..23774254b7db 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 658142d47a6d..af85b6b8c7f0 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: "user@example.com", + 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 f1053bec78da..21f34ba9f6ef 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 f29adcfb6a51..c92b9494e2cc 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): Record { @@ -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$/, "")} ) : ( - + {children} ); } -// ------- 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 ( -
-
+
+