From 6d50a85b98324f3584fc59ca7edafc4bb858d953 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 12:03:06 +0000 Subject: [PATCH] feat(ui): guardrails/content_filter batch to shadcn - KeywordModal / CustomPatternModal: antd Modal/Select/Space/Button/ Input \u2192 shadcn Dialog/Select/Button/Input/Textarea/Label. Footer buttons use outline + default variants. - KeywordTable: antd Table/Select/Button + @ant-design DeleteOutlined \u2192 shadcn Table/Select/Button + lucide Trash2. Delete column is a destructive-tinted ghost button. Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- .../content_filter/CustomPatternModal.tsx | 128 ++++++++++-------- .../content_filter/KeywordModal.tsx | 125 +++++++++-------- .../content_filter/KeywordTable.tsx | 125 ++++++++--------- 3 files changed, 207 insertions(+), 171 deletions(-) diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.tsx b/ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.tsx index f88e5db59a4..107d988bf61 100644 --- a/ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.tsx +++ b/ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.tsx @@ -1,8 +1,21 @@ import React from "react"; -import { Typography, Select, Modal, Space, Button, Input } from "antd"; - -const { Text } = Typography; -const { Option } = Select; +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; interface CustomPatternModalProps { visible: boolean; @@ -28,64 +41,67 @@ const CustomPatternModal: React.FC = ({ onCancel, }) => { return ( - (!o ? onCancel() : undefined)} > - -
- Pattern name - onNameChange(e.target.value)} - style={{ marginTop: 8 }} - /> -
+ + + Add custom regex pattern + +
+
+ + onNameChange(e.target.value)} + className="mt-2" + /> +
-
- Regex pattern - onRegexChange(e.target.value)} - style={{ marginTop: 8 }} - /> - - Enter a valid regular expression to match sensitive data - -
+
+ + onRegexChange(e.target.value)} + className="mt-2" + /> +

+ Enter a valid regular expression to match sensitive data +

+
-
- Action - - Choose what action the guardrail should take when this pattern is detected - - +
+ +

+ Choose what action the guardrail should take when this pattern is + detected +

+ +
- - -
- - -
- + + + + + + ); }; export default CustomPatternModal; - diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordModal.tsx b/ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordModal.tsx index 8bdbfb326d9..3653696b3f5 100644 --- a/ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordModal.tsx +++ b/ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordModal.tsx @@ -1,8 +1,22 @@ import React from "react"; -import { Typography, Select, Modal, Space, Button, Input } from "antd"; - -const { Text } = Typography; -const { Option } = Select; +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Textarea } from "@/components/ui/textarea"; interface KeywordModalProps { visible: boolean; @@ -28,62 +42,65 @@ const KeywordModal: React.FC = ({ onCancel, }) => { return ( - (!o ? onCancel() : undefined)} > - -
- Keyword - onKeywordChange(e.target.value)} - style={{ marginTop: 8 }} - /> -
+ + + Add blocked keyword + +
+
+ + onKeywordChange(e.target.value)} + className="mt-2" + /> +
-
- Action - - Choose what action the guardrail should take when this keyword is detected - - -
+
+ +

+ Choose what action the guardrail should take when this keyword is + detected +

+ +
-
- Description (optional) - onDescriptionChange(e.target.value)} - rows={3} - style={{ marginTop: 8 }} - /> +
+ +