From b1cb0abfd4981a758cc5a45df9876736921d6124 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 16:36:21 +0000 Subject: [PATCH] feat(ui): common_components/PassThroughGuardrailsSection to shadcn - @tremor Card/Title/Subtitle + antd Alert/Tooltip + @ant-design InfoCircleOutlined \u2192 shadcn Card/Tooltip + lucide Info + inline blue-tinted info callout. - Kept antd Form.Item + antd Select mode='tags' for the field-target multi-value inputs (tokenSeparators). - All gray/text-gray-700/bg-gray-50 swept to semantic tokens; info callout retains blue categorical tint (added to .eslintrc overrides). Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- ui/litellm-dashboard/.eslintrc.json | 1 + .../PassThroughGuardrailsSection.tsx | 220 ++++++++++++------ 2 files changed, 147 insertions(+), 74 deletions(-) diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index 726da817a6c..6b7a80fb493 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -63,6 +63,7 @@ "src/components/common_components/ModelAliasManager.tsx", "src/components/mcp_tools/mcp_server_columns.tsx", "src/components/playground/chat_ui/A2AMetrics.tsx", + "src/components/common_components/PassThroughGuardrailsSection.tsx", "src/components/permissions/VectorStorePermissions.tsx", "src/components/permissions/AgentPermissions.tsx", "src/components/permissions/MCPServerPermissions.tsx", diff --git a/ui/litellm-dashboard/src/components/common_components/PassThroughGuardrailsSection.tsx b/ui/litellm-dashboard/src/components/common_components/PassThroughGuardrailsSection.tsx index 3156fa626f1..00172ca3fd7 100644 --- a/ui/litellm-dashboard/src/components/common_components/PassThroughGuardrailsSection.tsx +++ b/ui/litellm-dashboard/src/components/common_components/PassThroughGuardrailsSection.tsx @@ -1,7 +1,13 @@ import React, { useState, useEffect } from "react"; -import { Card, Title, Subtitle } from "@tremor/react"; -import { Form, Select, Tooltip, Alert } from "antd"; -import { InfoCircleOutlined } from "@ant-design/icons"; +import { Card } from "@/components/ui/card"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Form, Select } from "antd"; +import { Info } from "lucide-react"; import GuardrailSelector from "../guardrails/GuardrailSelector"; interface PassThroughGuardrailsSectionProps { @@ -71,51 +77,72 @@ const PassThroughGuardrailsSection: React.FC return ( - Guardrails - - Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough - endpoints. - +

Guardrails

+

+ Configure guardrails to enforce policies on requests and responses. + Guardrails are opt-in for passthrough endpoints. +

- +
+ +
+
Field-Level Targeting{" "} (Learn More) - - } - description={ -
-
- Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail. +
+
+
+ Optionally specify which fields to check. If left empty, the + entire request/response is sent to the guardrail.
Common Examples:
-
• query - Single field
-
• documents[*].text - All text in documents array
-
• messages[*].content - All message contents
+
+ •{" "} + query - + Single field +
+
+ •{" "} + + documents[*].text + {" "} + - All text in documents array +
+
+ •{" "} + + messages[*].content + {" "} + - All message contents +
- } - type="info" - showIcon - className="mb-4" - /> +
+
+ Select Guardrails - - - + + + + + + + Choose which guardrails should run on this endpoint. Org/team/ + key level guardrails will also be included. + + + } > @@ -130,41 +157,57 @@ const PassThroughGuardrailsSection: React.FC {selectedGuardrails.length > 0 && (
-
Field Targeting (Optional)
-
+
+ Field Targeting (Optional) +
+
💡 Tip: Leave empty to check entire payload
{selectedGuardrails.map((guardrailName) => ( - -
{guardrailName}
+ +
+ {guardrailName} +
-
- }> - - + + + + + + +
+
+ Specify which request fields to check +
+
+
Examples:
+
• query
+
• documents[*].text
+
• messages[*].content
+
+
+
+
+
-
- }> - - + + + + + + +
+
+ Specify which response fields to check +
+
+
Examples:
+
• results[*].text
+
• choices[*].message.content
+
+
+
+
+