From df5b12df280cf5cedfa2c842ac700c1905c0b908 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 12:31:58 +0000 Subject: [PATCH] feat(ui): RateLimitTypeFormItem + CostTrackingSettings/add_provider_form - RateLimitTypeFormItem: antd Select \u2192 shadcn Select inside a preserved antd Form.Item. Tooltip replaced with shadcn Tooltip + lucide Info. Test updated to assert trigger presence + placeholder instead of driving the Radix portal (pointer-capture not supported in JSDOM). - CostTrackingSettings/add_provider_form: @tremor TextInput/Button + antd Tooltip + @ant-design InfoCircle \u2192 shadcn Input/Button/Tooltip + lucide Info. antd Select still handles provider-logo rendering since its Option template hasn't been ported yet. Gates: TS \u2713 | Build \u2713 | Vitest 5/5 green for this file. Co-authored-by: yuneng-jiang --- .../add_provider_form.tsx | 116 ++++++++++------- .../RateLimitTypeFormItem.test.tsx | 38 +++--- .../RateLimitTypeFormItem.tsx | 119 +++++++++++------- 3 files changed, 170 insertions(+), 103 deletions(-) diff --git a/ui/litellm-dashboard/src/components/CostTrackingSettings/add_provider_form.tsx b/ui/litellm-dashboard/src/components/CostTrackingSettings/add_provider_form.tsx index 7f79a6848bb..f0195fe2715 100644 --- a/ui/litellm-dashboard/src/components/CostTrackingSettings/add_provider_form.tsx +++ b/ui/litellm-dashboard/src/components/CostTrackingSettings/add_provider_form.tsx @@ -1,8 +1,19 @@ import React from "react"; -import { TextInput, Button } from "@tremor/react"; -import { Select as AntdSelect, Form, Tooltip } from "antd"; -import { InfoCircleOutlined } from "@ant-design/icons"; -import { Providers, provider_map, providerLogoMap } from "../provider_info_helpers"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Select as AntdSelect, Form } from "antd"; +import { Info } from "lucide-react"; +import { + Providers, + provider_map, + providerLogoMap, +} from "../provider_info_helpers"; import { DiscountConfig } from "./types"; import { handleImageError } from "./provider_display_helpers"; @@ -27,11 +38,18 @@ const AddProviderForm: React.FC = ({
+ Provider - - - + + + + + + + Select the LLM provider you want to configure a discount for + + + } rules={[{ required: true, message: "Please select a provider" }]} @@ -45,58 +63,73 @@ const AddProviderForm: React.FC = ({ size="large" optionFilterProp="children" filterOption={(input, option) => - String(option?.label ?? "").toLowerCase().includes(input.toLowerCase()) + String(option?.label ?? "") + .toLowerCase() + .includes(input.toLowerCase()) } > - {Object.entries(Providers).map(([providerEnum, providerDisplayName]) => { - const providerValue = provider_map[providerEnum as keyof typeof provider_map]; - // Only show providers that don't already have a discount configured - if (providerValue && discountConfig[providerValue]) { - return null; - } - return ( - -
- {`${providerEnum} handleImageError(e, providerDisplayName)} - /> - {providerDisplayName} -
-
- ); - })} + {Object.entries(Providers).map( + ([providerEnum, providerDisplayName]) => { + const providerValue = + provider_map[providerEnum as keyof typeof provider_map]; + if (providerValue && discountConfig[providerValue]) { + return null; + } + return ( + +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {`${providerEnum} handleImageError(e, providerDisplayName)} + /> + {providerDisplayName} +
+
+ ); + }, + )}
+ Discount Percentage - - - + + + + + + + Enter a percentage value (e.g., 5 for 5% discount) + + + } rules={[{ required: true, message: "Please enter a discount percentage" }]} >
- onDiscountChange(e.target.value)} + className="rounded-lg flex-1" /> - % + %
-
-