From 9fe8047f567af1664161f326ca0fe1f799e24c88 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 20:55:13 +0000 Subject: [PATCH] feat(ui): playground/ComparisonPanel to shadcn - antd Checkbox/Divider/Popover \u2192 shadcn Checkbox/Popover + native
. antd Slider preserved as AntSlider (shadcn Slider has a different API). - Swept bg-white/bg-gray-100/text-gray-700/bg-red-50/text-red-600 to background/muted/foreground + destructive tokens. - Popover open state now driven by Radix onOpenChange (tracks outside clicks) instead of the custom hand-rolled toggle. Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- .../compareUI/components/ComparisonPanel.tsx | 163 +++++++++++------- 1 file changed, 104 insertions(+), 59 deletions(-) diff --git a/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.tsx b/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.tsx index 5073d4549cc..33dbd941547 100644 --- a/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.tsx +++ b/ui/litellm-dashboard/src/components/playground/compareUI/components/ComparisonPanel.tsx @@ -6,7 +6,14 @@ import { UnifiedSelector } from "./UnifiedSelector"; import TagSelector from "../../../tag_management/TagSelector"; import VectorStoreSelector from "../../../vector_store_management/VectorStoreSelector"; import GuardrailSelector from "../../../guardrails/GuardrailSelector"; -import { Checkbox, Divider, Popover, Slider } from "antd"; +import { Slider as AntSlider } from "antd"; +import { Checkbox } from "@/components/ui/checkbox"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { cn } from "@/lib/utils"; import { SelectorOption, EndpointConfig, isAgentEndpoint, getComparisonSelection } from "../endpoint_config"; interface ComparisonPanelProps { @@ -80,11 +87,9 @@ export function ComparisonPanel({ }; const disabledOpacity = comparison.useAdvancedParams ? 1 : 0.4; - const disabledTextColor = comparison.useAdvancedParams ? "text-gray-700" : "text-gray-400"; - - const handleTogglePopover = () => { - setPopoverVisible((prev) => !prev); - }; + const disabledTextColor = comparison.useAdvancedParams + ? "text-foreground/90" + : "text-muted-foreground"; const handleClosePopover = () => { setPopoverVisible(false); @@ -94,28 +99,37 @@ export function ComparisonPanel({
{/* Close button in top right */}
- {/* Sync Checkbox */} -
- handleSyncChange(e.target.checked)}> - Sync Settings Across Models - -
+ - +
{/* General Settings */}
-

General Settings

+

+ General Settings +

- + handleSettingChange("tags", value)} @@ -123,15 +137,21 @@ export function ComparisonPanel({ />
- + handleSettingChange("vectorStores", value)} + onChange={(value) => + handleSettingChange("vectorStores", value) + } accessToken={apiKey} />
- + handleSettingChange("guardrails", value)} @@ -142,30 +162,47 @@ export function ComparisonPanel({
{/* Advanced Settings */}
-

Advanced Settings

+

+ Advanced Settings +

-
+
-
+ onCheckedChange={(c) => + handleAdvancedParamsChange(c === true) + } + /> + + Use Advanced Parameters + + +
- - {comparison.temperature.toFixed(2)} + + + {comparison.temperature.toFixed(2)} +
- { const nextValue = Array.isArray(value) ? value[0] : value; - const clamped = Math.min(2, Math.max(0, Number(nextValue.toFixed(2)))); + const clamped = Math.min( + 2, + Math.max(0, Number(nextValue.toFixed(2))), + ); handleSettingChange("temperature", clamped); }} disabled={!comparison.useAdvancedParams} @@ -173,17 +210,26 @@ export function ComparisonPanel({
- - {comparison.maxTokens} + + + {comparison.maxTokens} +
- { const nextValue = Array.isArray(value) ? value[0] : value; - const clamped = Math.min(32768, Math.max(1, Math.round(nextValue))); + const clamped = Math.min( + 32768, + Math.max(1, Math.round(nextValue)), + ); handleSettingChange("maxTokens", clamped); }} disabled={!comparison.useAdvancedParams} @@ -197,8 +243,8 @@ export function ComparisonPanel({ ); return ( -
-
+
+
- { - // Prevent automatic closing - we control it manually - }} - placement="bottomRight" - destroyTooltipOnHide={false} - > - + + + + + + {settingsContent} +
{canRemove && (