From 11049a1141cfe9948f54d9f9230853316ac2a4c7 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 14:22:17 +0000 Subject: [PATCH] feat(ui): guardrails/GuardrailTestPanel to shadcn - @tremor Button + antd Input.TextArea/Typography/Tooltip + @ant-design Copy/InfoCircle \u2192 shadcn Button/Textarea/Tooltip + lucide Copy/Info. - Blue guardrail-name chips preserved as categorical accent (file added to .eslintrc.json overrides). Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- ui/litellm-dashboard/.eslintrc.json | 1 + .../guardrails/GuardrailTestPanel.tsx | 89 ++++++++++++------- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index ae9a0137548..1251a9e924e 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -63,6 +63,7 @@ "src/components/prompts/variable_textarea.tsx", "src/components/chat/MCPCredentialsTab.tsx", "src/components/common_components/KeyLifecycleSettings.tsx", + "src/components/guardrails/GuardrailTestPanel.tsx", "src/components/prompts/prompt_editor_view/PromptEditorHeader.tsx", "src/components/prompts/prompt_editor_view/VersionHistorySidePanel.tsx", "src/app/(dashboard)/teams/components/TeamsTable/ModelsCell.tsx", diff --git a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.tsx b/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.tsx index 8cda73790c6..c2d119f2db6 100644 --- a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.tsx +++ b/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.tsx @@ -1,19 +1,26 @@ import React, { useState } from "react"; -import { Button } from "@tremor/react"; -import { Input, Typography, Tooltip } from "antd"; -import { CopyOutlined, InfoCircleOutlined } from "@ant-design/icons"; +import { Button } from "@/components/ui/button"; +import { Textarea } from "@/components/ui/textarea"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Copy, Info } from "lucide-react"; import NotificationsManager from "../molecules/notifications_manager"; import GuardrailTestResults from "./GuardrailTestResults"; -const { TextArea } = Input; -const { Text } = Typography; - interface GuardrailTestPanelProps { guardrailNames: string[]; onSubmit: (text: string) => void; isLoading: boolean; - results: Array<{ guardrailName: string; response_text: string; latency: number }> | null; - errors: Array<{ guardrailName: string; error: Error; latency: number }> | null; + results: + | Array<{ guardrailName: string; response_text: string; latency: number }> + | null; + errors: + | Array<{ guardrailName: string; error: Error; latency: number }> + | null; onClose: () => void; } @@ -23,7 +30,6 @@ export function GuardrailTestPanel({ isLoading, results, errors, - onClose, }: GuardrailTestPanelProps) { const [inputText, setInputText] = useState(""); @@ -82,53 +88,65 @@ export function GuardrailTestPanel({ return (
- {/* Header */} -
+
-

Test Guardrails:

+

+ Test Guardrails: +

{guardrailNames.map((name) => (
- {name} + + {name} +
))}
-

- Test {guardrailNames.length > 1 ? "guardrails" : "guardrail"} and compare results +

+ Test {guardrailNames.length > 1 ? "guardrails" : "guardrail"}{" "} + and compare results

- {/* Input Section */}
- - - - + + + + + + + + Press Enter to submit. Use Shift+Enter for new line. + + +
{inputText && ( )}
-