Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(ui): migrate the remaining dashboard pages off antd (#37524)

ryan-crabbe-berri5d6033f8b4b6
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx
index d37065317c2..c507d56a63b 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useMemo } from "react";
-import { Spin, Descriptions } from "antd";
+import { cx } from "@/lib/cva.config";
import { FormProvider, useForm, useWatch } from "react-hook-form";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
@@ -40,6 +40,26 @@ interface AgentInfoViewProps {
isAdmin: boolean;
}
+const DetailList: React.FC<{ children: React.ReactNode; className?: string }> = ({ children, className }) => (
+ <dl
+ className={cx(
+ "grid grid-cols-[minmax(0,14rem)_minmax(0,1fr)] overflow-hidden rounded-lg border border-border text-sm",
+ className,
+ )}
+ >
+ {children}
+ </dl>
+);
+
+const DetailItem: React.FC<{ label: React.ReactNode; children: React.ReactNode }> = ({ label, children }) => (
+ <>
+ <dt className="border-b border-border bg-muted px-4 py-3 font-medium text-foreground last-of-type:border-b-0">
+ {label}
+ </dt>
+ <dd className="border-b border-border px-4 py-3 break-words text-foreground last-of-type:border-b-0">{children}</dd>
+ </>
+);
+
const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessToken, isAdmin }) => {
const [agent, setAgent] = useState<Agent | null>(null);
const [selectedKey, setSelectedKey] = useState<KeyResponse | null>(null);
@@ -195,7 +215,7 @@ const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessT
return (
<div className="p-4">
<div className="flex justify-center items-center h-64">
- <Spin size="large" />
+ <UiLoadingSpinner className="size-8 text-primary" />
</div>
</div>
);
@@ -276,51 +296,41 @@ const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessT
<div>
{/* Overview Panel */}
<TabsContent value="overview" keepMounted>
- <Descriptions bordered column={1}>
- <Descriptions.Item label="Agent ID">{agent.agent_id}</Descriptions.Item>
- <Descriptions.Item label="Agent Name">{agent.agent_name}</Descriptions.Item>
- <Descriptions.Item label="Display Name">{agent.agent_card_params?.name || "-"}</Descriptions.Item>
- <Descriptions.Item label="Description">{agent.agent_card_params?.description || "-"}</Descriptions.Item>
- <Descriptions.Item label="URL">{agent.agent_card_params?.url || "-"}</Descriptions.Item>
- <Descriptions.Item label="Version">{agent.agent_card_params?.version || "-"}</Descriptions.Item>
- <Descriptions.Item label="Protocol Version">
- {agent.agent_card_params?.protocolVersion || "-"}
- </Descriptions.Item>
- <Descriptions.Item label="Streaming">
+ <DetailList>
+ <DetailItem label="Agent ID">{agent.agent_id}</DetailItem>
+ <DetailItem label="Agent Name">{agent.agent_name}</DetailItem>
+ <DetailItem label="Display Name">{agent.agent_card_params?.name || "-"}</DetailItem>
+ <DetailItem label="Description">{agent.agent_card_params?.description || "-"}</DetailItem>
+ <DetailItem label="URL">{agent.agent_card_params?.url || "-"}</DetailItem>
+ <DetailItem label="Version">{agent.agent_card_params?.version || "-"}</DetailItem>
+ <DetailItem label="Protocol Version">{agent.agent_card_params?.protocolVersion || "-"}</DetailItem>
+ <DetailItem label="Streaming">
{agent.agent_card_params?.capabilities?.streaming ? "Yes" : "No"}
- </Descriptions.Item>
+ </DetailItem>
{agent.agent_card_params?.capabilities?.pushNotifications && (
- <Descriptions.Item label="Push Notifications">Yes</Descriptions.Item>
+ <DetailItem label="Push Notifications">Yes</DetailItem>
)}
{agent.agent_card_params?.capabilities?.stateTransitionHistory && (
- <Descriptions.Item label="State Transition History">Yes</Descriptions.Item>
- )}
- <Descriptions.Item label="Skills">
- {agent.agent_card_params?.skills?.length || 0} configured
- </Descriptions.Item>
- {agent.litellm_params?.model && (
- <Descriptions.Item label="Model">{agent.litellm_params.model}</Descriptions.Item>
+ <DetailItem label="State Transition History">Yes</DetailItem>
)}
+ <DetailItem label="Skills">{agent.agent_card_params?.skills?.length || 0} configured</DetailItem>
+ {agent.litellm_params?.model && <DetailItem label="Model">{agent.litellm_params.model}</DetailItem>}
{agent.litellm_params?.make_public !== undefined && (
- <Descriptions.Item label="Make Public">
- {agent.litellm_params.make_public ? "Yes" : "No"}
- </Descriptions.Item>
+ <DetailItem label="Make Public">{agent.litellm_params.make_public ? "Yes" : "No"}</DetailItem>
)}
{agent.agent_card_params?.iconUrl && (
- <Descriptions.Item label="Icon URL">{agent.agent_card_params.iconUrl}</Descriptions.Item>
+ <DetailItem label="Icon URL">{agent.agent_card_params.iconUrl}</DetailItem>
)}
{agent.agent_card_params?.documentationUrl && (
- <Descriptions.Item label="Documentation URL">
- {agent.agent_card_params.documentationUrl}
- </Descriptions.Item>
+ <DetailItem label="Documentation URL">{agent.agent_card_params.documentationUrl}</DetailItem>
)}
- <Descriptions.Item label="TPM Limit">{agent.tpm_limit ?? "Unlimited"}</Descriptions.Item>
- <Descriptions.Item label="RPM Limit">{agent.rpm_limit ?? "Unlimited"}</Descriptions.Item>
- <Descriptions.Item label="Session TPM Limit">{agent.session_tpm_limit ?? "Unlimited"}</Descriptions.Item>
- <Descriptions.Item label="Session RPM Limit">{agent.session_rpm_limit ?? "Unlimited"}</Descriptions.Item>
- <Descriptions.Item label="Created At">{formatDate(agent.created_at)}</Descriptions.Item>
- <Descriptions.Item label="Updated At">{formatDate(agent.updated_at)}</Descriptions.Item>
- </Descriptions>
+ <DetailItem label="TPM Limit">{agent.tpm_limit ?? "Unlimited"}</DetailItem>
+ <DetailItem label="RPM Limit">{agent.rpm_limit ?? "Unlimited"}</DetailItem>
+ <DetailItem label="Session TPM Limit">{agent.session_tpm_limit ?? "Unlimited"}</DetailItem>
+ <DetailItem label="Session RPM Limit">{agent.session_rpm_limit ?? "Unlimited"}</DetailItem>
+ <DetailItem label="Created At">{formatDate(agent.created_at)}</DetailItem>
+ <DetailItem label="Updated At">{formatDate(agent.updated_at)}</DetailItem>
+ </DetailList>
<AgentVirtualKeys keys={agentKeys} isLoading={keysLoading} onKeyClick={setSelectedKey} />
@@ -331,21 +341,19 @@ const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessT
Object.keys(agent.object_permission.mcp_tool_permissions).length > 0)) && (
<div style={{ marginTop: 24 }}>
<h3 className="text-lg font-medium">MCP Tool Permissions</h3>
- <Descriptions bordered column={1} style={{ marginTop: 16 }}>
+ <DetailList className="mt-4">
{agent.object_permission.mcp_servers && agent.object_permission.mcp_servers.length > 0 && (
- <Descriptions.Item label="MCP Servers">
- {agent.object_permission.mcp_servers.join(", ")}
- </Descriptions.Item>
+ <DetailItem label="MCP Servers">{agent.object_permission.mcp_servers.join(", ")}</DetailItem>
)}
{agent.object_permission.mcp_access_groups &&
agent.object_permission.mcp_access_groups.length > 0 && (
- <Descriptions.Item label="MCP Access Groups">
+ <DetailItem label="MCP Access Groups">
{agent.object_permission.mcp_access_groups.join(", ")}
- </Descriptions.Item>
+ </DetailItem>
)}
{agent.object_permission.mcp_tool_permissions &&
Object.keys(agent.object_permission.mcp_tool_permissions).length > 0 && (
- <Descriptions.Item label="Tool permissions per server">
+ <DetailItem label="Tool permissions per server">
<div className="space-y-1">
{Object.entries(agent.object_permission.mcp_tool_permissions).map(([serverId, tools]) => (
<div key={serverId}>
@@ -354,9 +362,9 @@ const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessT
</div>
))}
</div>
- </Descriptions.Item>
+ </DetailItem>
)}
- </Descriptions>
+ </DetailList>
</div>
)}
@@ -365,9 +373,9 @@ const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessT
{agent.agent_card_params?.skills && agent.agent_card_params.skills.length > 0 && (
<div style={{ marginTop: 24 }}>
<h3 className="text-lg font-medium">Skills</h3>
- <Descriptions bordered column={1} style={{ marginTop: 16 }}>
+ <DetailList className="mt-4">
{agent.agent_card_params.skills.map((skill: any, index: number) => (
- <Descriptions.Item label={skill.name || `Skill ${index + 1}`} key={index}>
+ <DetailItem label={skill.name || `Skill ${index + 1}`} key={index}>
<div>
<div>
<strong>ID:</strong> {skill.id}
@@ -385,9 +393,9 @@ const AgentInfoView: React.FC<AgentInfoViewProps> = ({ agentId, onClose, accessT
</div>
)}
</div>
- </Descriptions.Item>
+ </DetailItem>
))}
- </Descriptions>
+ </DetailList>
</div>
)}
</TabsContent>
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/add_provider_form.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/add_provider_form.integration.test.tsx
index 83875cfc676..4680a4d504a 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/add_provider_form.integration.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/add_provider_form.integration.test.tsx
@@ -1,5 +1,3 @@
-// eslint-disable-next-line no-restricted-imports -- the parent cost_tracking_settings still owns this antd Form, and the point of this test is that AddProviderForm registers nothing in it
-import { Form } from "antd";
import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest";
@@ -10,42 +8,31 @@ import { DiscountConfig } from "./types";
const onAddProvider = vi.fn();
const onParentFinish = vi.fn();
-const readParentStore = vi.fn();
-const ParentOwnedForm = () => {
- const [form] = Form.useForm();
- return (
- <Form form={form} onFinish={onParentFinish} layout="vertical" className="space-y-6">
- <AddProviderForm
- discountConfig={{} as DiscountConfig}
- selectedProvider="OpenAI"
- newDiscount="5"
- onProviderChange={vi.fn()}
- onDiscountChange={vi.fn()}
- onAddProvider={() => {
- readParentStore(form.getFieldsValue());
- onAddProvider();
- }}
- />
- </Form>
- );
-};
-
-describe("AddProviderForm inside the antd form its parent owns", () => {
+const ParentOwnedForm = () => (
+ <form
+ onSubmit={(event) => {
+ event.preventDefault();
+ onParentFinish();
+ }}
+ className="space-y-6"
+ >
+ <AddProviderForm
+ discountConfig={{} as DiscountConfig}
+ selectedProvider="OpenAI"
+ newDiscount="5"
+ onProviderChange={vi.fn()}
+ onDiscountChange={vi.fn()}
+ onAddProvider={onAddProvider}
+ />
+ </form>
+);
+
+describe("AddProviderForm inside the form its parent owns", () => {
beforeEach(() => {
vi.clearAllMocks();
});
- it("registers no field in the parent FormInstance, so the parent's resetFields is a no-op", async () => {
- const user = userEvent.setup();
- renderWithProviders(<ParentOwnedForm />);
-
- await user.click(screen.getByRole("button", { name: /add provider discount/i }));
-
- expect(readParentStore).toHaveBeenCalledTimes(1);
- expect(readParentStore.mock.calls[0][0]).toEqual({});
- });
-
it("drives both the onAddProvider prop and the parent form submit from one click", async () => {
const user = userEvent.setup();
renderWithProviders(<ParentOwnedForm />);
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.integration.test.tsx
index f811b55bc86..d4fbb7e153e 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.integration.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.integration.test.tsx
@@ -72,7 +72,7 @@ describe("CostTrackingSettings submit paths", () => {
const header = screen.getByText("Provider Discounts").closest("button");
if (header) await user.click(header);
await user.click(await screen.findByRole("button", { name: /add provider discount/i }));
- await screen.findByText("Add Provider Discount", { selector: "h2" });
+ await screen.findByRole("dialog", { name: "Add Provider Discount" });
};
const submitDiscount = () =>
@@ -101,7 +101,7 @@ describe("CostTrackingSettings submit paths", () => {
const header = screen.getByText("Fee/Price Margin").closest("button");
if (header) await user.click(header);
await user.click(await screen.findByRole("button", { name: /add provider margin/i }));
- await screen.findByText("Add Provider Margin", { selector: "h2" });
+ await screen.findByRole("dialog", { name: "Add Provider Margin" });
await user.click(screen.getAllByRole("combobox")[0]);
await user.click((await screen.findAllByRole("option"))[0]);
@@ -136,7 +136,7 @@ describe("CostTrackingSettings submit paths", () => {
const header = screen.getByText("Fee/Price Margin").closest("button");
if (header) await user.click(header);
await user.click(await screen.findByRole("button", { name: /add provider margin/i }));
- await screen.findByText("Add Provider Margin", { selector: "h2" });
+ await screen.findByRole("dialog", { name: "Add Provider Margin" });
await user.click(screen.getAllByRole("combobox")[0]);
await user.click((await screen.findAllByRole("option"))[0]);
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.test.tsx
index 9cdc8509fbf..a8609aef629 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.test.tsx
@@ -136,7 +136,7 @@ describe("CostTrackingSettings", () => {
const addButton = await screen.findByRole("button", { name: /add provider discount/i });
await user.click(addButton);
- expect(await screen.findByText("Add Provider Discount", { selector: "h2" })).toBeInTheDocument();
+ expect(await screen.findByRole("dialog", { name: "Add Provider Discount" })).toBeInTheDocument();
});
});
@@ -153,7 +153,7 @@ describe("CostTrackingSettings", () => {
const addButton = await screen.findByRole("button", { name: /add provider margin/i });
await user.click(addButton);
- expect(await screen.findByText("Add Provider Margin", { selector: "h2" })).toBeInTheDocument();
+ expect(await screen.findByRole("dialog", { name: "Add Provider Margin" })).toBeInTheDocument();
});
});
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.test.tsx
index 78526251049..60bf235040f 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.test.tsx
@@ -45,19 +45,7 @@ describe("GuardrailConfig", () => {
it("should show custom code textarea when custom code override is toggled on", async () => {
const user = userEvent.setup();
render(<GuardrailConfig {...defaultProps} />);
- // Walk up from "Custom Code Override" heading to find the enclosing section,
- // then locate the switch within it
- const heading = screen.getByText("Custom Code Override");
- let container = heading.parentElement;
- let customCodeSwitch: Element | null = null;
- while (container && !customCodeSwitch) {
- customCodeSwitch = container.querySelector('[role="switch"]');
- container = container.parentElement;
- }
- if (!customCodeSwitch) {
- throw new Error("Could not find the Custom Code Override switch via DOM traversal");
- }
- await user.click(customCodeSwitch);
+ await user.click(screen.getByRole("switch", { name: "Custom Code Override" }));
expect(screen.getByPlaceholderText(/async def evaluate/)).toBeInTheDocument();
});
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.tsx
index 667c52087f1..619ccd8d974 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailConfig.tsx
@@ -5,9 +5,13 @@ import {
RollbackOutlined,
SaveOutlined,
} from "@ant-design/icons";
-import { Input, Select, Switch } from "antd";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Button } from "@/components/ui/button";
-import React, { useState } from "react";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Switch } from "@/components/ui/switch";
+import { Textarea } from "@/components/ui/textarea";
+import React, { useId, useState } from "react";
interface GuardrailConfigProps {
guardrailName: string;
@@ -27,6 +31,28 @@ const versions = [
{ id: "v1", label: "v1", date: "2026-01-28", author: "[email protected]", changes: "Initial configuration" },
];
+const ACTION_ITEMS = [
+ { value: "block", label: "Block Request" },
+ { value: "flag", label: "Flag for Review" },
+ { value: "log", label: "Log Only" },
+ { value: "fallback", label: "Use Fallback Response" },
+];
+
+const PROVIDER_ITEMS = [
+ { value: "bedrock", label: "AWS Bedrock Guardrails" },
+ { value: "google", label: "Google Cloud AI Safety" },
+ { value: "litellm", label: "LiteLLM Built-in" },
+ { value: "custom", label: "Custom Code" },
+];
+
+const GUARDRAIL_TYPE_ITEMS = [
+ { value: "Content Safety", label: "Content Safety" },
+ { value: "PII", label: "PII Detection" },
+ { value: "Topic", label: "Topic Restriction" },
+ { value: "prompt_injection", label: "Prompt Injection" },
+ { value: "custom", label: "Custom" },
+];
+
export function GuardrailConfig({ guardrailName, guardrailType, provider }: GuardrailConfigProps) {
const [action, setAction] = useState("block");
const [enabled, setEnabled] = useState(true);
@@ -35,6 +61,7 @@ export function GuardrailConfig({ guardrailName, guardrailType, provider }: Guar
const [rerunStatus, setRerunStatus] = useState<"idle" | "running" | "success" | "error">("idle");
const [version, setVersion] = useState("v3");
const [showVersionHistory, setShowVersionHistory] = useState(false);
+ const enabledToggleId = useId();
const handleRerun = () => {
setRerunStatus("running");
@@ -52,11 +79,21 @@ export function GuardrailConfig({ guardrailName, guardrailType, provider }: Guar
<div className="flex items-center gap-3">
<span className="text-sm font-medium text-gray-700">Version:</span>
<Select
+ items={versions.map((v) => ({ value: v.id, label: v.label }))}
value={version}
- onChange={setVersion}
- options={versions.map((v) => ({ value: v.id, label: v.label }))}
- style={{ width: 140 }}
- />
+ onValueChange={(value: string | null) => value && setVersion(value)}
+ >
+ <SelectTrigger className="w-[140px]">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {versions.map((v) => (
+ <SelectItem key={v.id} value={v.id}>
+ {v.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
<Button variant="link" size="sm" onClick={() => setShowVersionHistory(!showVersionHistory)}>
{showVersionHistory ? "Hide history" : "View history"}
</Button>
@@ -109,45 +146,53 @@ export function GuardrailConfig({ guardrailName, guardrailType, provider }: Guar
<div>
<label className="block text-sm font-medium text-gray-700 mb-1.5">Action on Failure</label>
<Select
+ items={ACTION_ITEMS}
value={action}
- onChange={setAction}
- style={{ width: "100%" }}
- options={[
- { value: "block", label: "Block Request" },
- { value: "flag", label: "Flag for Review" },
- { value: "log", label: "Log Only" },
- { value: "fallback", label: "Use Fallback Response" },
- ]}
- />
+ onValueChange={(value: string | null) => value && setAction(value)}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {ACTION_ITEMS.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1.5">Provider</label>
- <Select
- style={{ width: "100%" }}
- defaultValue={provider}
- options={[
- { value: "bedrock", label: "AWS Bedrock Guardrails" },
- { value: "google", label: "Google Cloud AI Safety" },
- { value: "litellm", label: "LiteLLM Built-in" },
- { value: "custom", label: "Custom Code" },
- ]}
- />
+ <Select items={PROVIDER_ITEMS} defaultValue={provider}>
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {PROVIDER_ITEMS.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1.5">Guardrail Type</label>
- <Select
- style={{ width: "100%" }}
- defaultValue={guardrailType}
- options={[
- { value: "Content Safety", label: "Content Safety" },
- { value: "PII", label: "PII Detection" },
- { value: "Topic", label: "Topic Restriction" },
- { value: "prompt_injection", label: "Prompt Injection" },
- { value: "custom", label: "Custom" },
- ]}
- />
+ <Select items={GUARDRAIL_TYPE_ITEMS} defaultValue={guardrailType}>
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {GUARDRAIL_TYPE_ITEMS.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div className="md:col-span-2">
@@ -156,8 +201,10 @@ export function GuardrailConfig({ guardrailName, guardrailType, provider }: Guar
</div>
<div className="md:col-span-2 flex items-center gap-3">
- <Switch checked={enabled} onChange={setEnabled} />
- <span className="text-sm text-gray-700">Guardrail enabled in production</span>
+ <Switch id={enabledToggleId} checked={enabled} onCheckedChange={setEnabled} />
+ <Label htmlFor={enabledToggleId} className="font-normal text-gray-700">
+ Guardrail enabled in production
+ </Label>
</div>
</div>
</div>
@@ -172,11 +219,11 @@ export function GuardrailConfig({ guardrailName, guardrailType, provider }: Guar
</h3>
<p className="text-xs text-gray-500 mt-0.5">Replace the built-in guardrail with custom evaluation code</p>
</div>
- <Switch checked={useCustomCode} onChange={setUseCustomCode} />
+ <Switch aria-label="Custom Code Override" checked={useCustomCode} onCheckedChange={setUseCustomCode} />
</div>
{useCustomCode && (
- <Input.TextArea
+ <Textarea
value={customCode}
onChange={(e) => setCustomCode(e.target.value)}
placeholder={`async def evaluate(input_text: str, context: dict) -> dict:
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx
index 5c34eca9804..ef1746310ae 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx
@@ -136,7 +136,7 @@ describe("TeamGuardrailsTab submit payload", () => {
await openSubmitModal(user);
await fillRequiredFields(user, "https://guard.example.com/v1/check");
- await user.click(screen.getAllByRole("combobox")[1]);
+ await user.click(screen.getByRole("combobox", { name: "Mode" }));
const options = await screen.findAllByText("During Call");
await user.click(options[options.length - 1]);
await submit(user);
@@ -149,13 +149,13 @@ describe("TeamGuardrailsTab submit payload", () => {
const user = userEvent.setup();
await openSubmitModal(user);
- const mode = screen.getAllByRole("combobox")[1];
+ const mode = screen.getByRole("combobox", { name: "Mode" });
expect(mode).toHaveTextContent("Pre Call");
await user.click(mode);
await user.click(await screen.findByRole("option", { name: "During Call" }));
- expect(screen.getAllByRole("combobox")[1]).toHaveTextContent("During Call");
+ expect(screen.getByRole("combobox", { name: "Mode" })).toHaveTextContent("During Call");
});
it("blocks an empty submit and reports every required field", async () => {
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx
index fc77562e932..4edef302f13 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx
@@ -1001,6 +1001,7 @@ export function TeamGuardrailsTab({ accessToken }: TeamGuardrailsTabProps) {
/>
</div>
<select
+ aria-label="Filter by status"
value={statusFilter}
onChange={(e) => setStatusFilter(e.target.value as typeof statusFilter)}
className="border border-border rounded-md px-3 py-2 text-sm text-foreground focus:outline-hidden focus:ring-1 focus:ring-blue-500 focus:border-blue-500 bg-background"
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.test.tsx
index 9c01521e77a..1c5a3cedb6b 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.test.tsx
@@ -1,4 +1,4 @@
-import { fireEvent, render, screen } from "@testing-library/react";
+import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest";
import { ModelSelector } from "./ModelSelector";
@@ -17,7 +17,7 @@ describe("ModelSelector", () => {
render(<ModelSelector value="" onChange={onChange} models={MODELS} />);
await user.click(screen.getByRole("combobox"));
- await user.click(await screen.findByTitle("gpt-4"));
+ await user.click(await screen.findByRole("option", { name: "gpt-4" }));
expect(onChange).toHaveBeenCalledWith("gpt-4");
});
@@ -25,7 +25,7 @@ describe("ModelSelector", () => {
it("displays a custom value that is not one of the known models", () => {
render(<ModelSelector value="custom-model-123" onChange={vi.fn()} models={MODELS} />);
- expect(screen.getByTitle("custom-model-123")).toHaveTextContent("custom-model-123");
+ expect(screen.getByRole("combobox")).toHaveValue("custom-model-123");
});
it("reports a custom model typed into the custom name field", async () => {
@@ -34,17 +34,28 @@ describe("ModelSelector", () => {
render(<ModelSelector value="" onChange={onChange} models={MODELS} />);
await user.click(screen.getByRole("combobox"));
- fireEvent.click(await screen.findByTitle("+ Add custom model"));
+ await user.click(await screen.findByRole("option", { name: "+ Add custom model" }));
await user.type(await screen.findByPlaceholderText("Custom Model Name (Enter to add)"), "my-custom-model{Enter}");
expect(onChange).toHaveBeenCalledWith("my-custom-model");
});
- it("disables the control when disabled is set", () => {
- const { rerender } = render(<ModelSelector value="custom-model-123" onChange={vi.fn()} models={MODELS} />);
+ it("disables the control when disabled is set", async () => {
+ const user = userEvent.setup();
+ const onChange = vi.fn();
+ const { rerender } = render(<ModelSelector value="custom-model-123" onChange={onChange} models={MODELS} />);
expect(screen.getByRole("combobox")).toBeEnabled();
- rerender(<ModelSelector value="custom-model-123" onChange={vi.fn()} models={MODELS} disabled={true} />);
- expect(screen.getByRole("combobox")).toBeDisabled();
+ rerender(<ModelSelector value="custom-model-123" onChange={onChange} models={MODELS} disabled={true} />);
+
+ const combobox = screen.getByRole("combobox");
+ expect(combobox).toBeDisabled();
+
+ await user.click(combobox);
+ await user.keyboard("gpt-4");
+
+ expect(combobox).toHaveValue("custom-model-123");
+ expect(screen.queryByRole("option")).not.toBeInTheDocument();
+ expect(onChange).not.toHaveBeenCalled();
});
});
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.tsx
index c88560ab4f5..5659875cf82 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/compareUI/components/ModelSelector.tsx
@@ -1,5 +1,5 @@
import React, { useMemo, useState } from "react";
-import { Select } from "antd";
+import { SearchSelect } from "@/components/shared/SearchSelect";
import { Input } from "@/components/ui/input";
interface ModelSelectorProps {
value: string;
@@ -50,23 +50,19 @@ export function ModelSelector({ value, onChange, models, loading, disabled }: Mo
};
return (
<div className="flex-1 min-w-0">
- <Select<string>
- value={selectValue}
- onChange={handleSelectChange}
+ <SearchSelect
+ options={[
+ ...displayOptions.map((model) => ({ label: model, value: model })),
+ { label: "+ Add custom model", value: "__custom__" },
+ ]}
+ value={selectValue ?? ""}
+ onValueChange={handleSelectChange}
disabled={disabled}
- loading={loading}
placeholder={loading ? "Loading models..." : "Select a model"}
- className="w-full rounded-md"
- showSearch
- optionFilterProp="children"
- >
- {displayOptions.map((model) => (
- <Select.Option key={model} value={model}>
- {model}
- </Select.Option>
- ))}
- <Select.Option value="__custom__">+ Add custom model</Select.Option>
- </Select>
+ emptyText="No models found"
+ allowClear={false}
+ className="rounded-md"
+ />
{isAddingCustom && (
<Input
className="mt-2"
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_test_panel.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_test_panel.tsx
index 9c234a7a70c..d8a6601e3d4 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_test_panel.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_test_panel.tsx
@@ -1,7 +1,6 @@
import React, { useState, useEffect } from "react";
import { useForm } from "react-hook-form";
-import { Empty } from "antd";
-import { CircleAlert } from "lucide-react";
+import { CircleAlert, Inbox } from "lucide-react";
import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { resolvePoliciesCall, teamListCall, keyListCall, modelAvailableCall } from "@/components/networking";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
@@ -260,7 +259,10 @@ const PolicyTestPanel: React.FC<PolicyTestPanelProps> = ({ accessToken }) => {
{hasSearched && result && (
<div className="bg-card border border-border rounded-lg p-6">
{result.matched_policies.length === 0 ? (
- <Empty description="No policies matched this context" />
+ <div className="py-6 text-center">
+ <Inbox className="mx-auto mb-2 size-8 text-muted-foreground" aria-hidden="true" />
+ <p className="text-sm text-muted-foreground">No policies matched this context</p>
+ </div>
) : (
<>
<div className="mb-4">
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/CreateVectorStore.tsx b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/CreateVectorStore.tsx
index 271ef31a68e..eae4a3fd799 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/CreateVectorStore.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/CreateVectorStore.tsx
@@ -1,9 +1,7 @@
-import React, { useState } from "react";
-import { Upload } from "antd";
+import React, { useId, useState } from "react";
import { toast } from "@/lib/toast";
-import { InboxOutlined } from "@ant-design/icons";
-import type { UploadProps } from "antd";
-import { CircleCheck, CircleHelp, X } from "lucide-react";
+import { CircleCheck, CircleHelp, Inbox, X } from "lucide-react";
+import { v4 as uuidv4 } from "uuid";
import { Alert, AlertAction, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { ragIngestCall } from "@/components/networking";
import { DocumentUpload, RAGIngestResponse } from "@/components/vector_store_management/types";
@@ -26,7 +24,17 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import S3VectorsConfig from "./S3VectorsConfig";
-const { Dragger } = Upload;
+const ACCEPTED_DOCUMENT_EXTENSIONS = ".pdf,.txt,.docx,.md,.doc";
+
+const ACCEPTED_DOCUMENT_TYPES = [
+ "application/pdf",
+ "text/plain",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ "application/msword",
+ "text/markdown",
+];
+
+const MAX_DOCUMENT_BYTES = 50 * 1024 * 1024;
const RAG_INGEST_UNSUPPORTED_PROVIDERS = new Set(["valkey"]);
@@ -39,6 +47,36 @@ const providerItems = Object.entries(VectorStoreProviders)
const asText = (value: unknown): string => (typeof value === "string" ? value : "");
+const IngestSuccessAlert: React.FC<{ ingestResults: RAGIngestResponse[] }> = ({ ingestResults }) => {
+ const [dismissed, setDismissed] = useState(false);
+
+ if (dismissed) {
+ return null;
+ }
+
+ return (
+ <Alert variant="success">
+ <CircleCheck />
+ <AlertTitle>Vector Store Created Successfully</AlertTitle>
+ <AlertDescription>
+ <div>
+ <p>
+ <strong>Vector Store ID:</strong> {ingestResults[0]?.vector_store_id}
+ </p>
+ <p>
+ <strong>Documents Ingested:</strong> {ingestResults.length}
+ </p>
+ </div>
+ </AlertDescription>
+ <AlertAction>
+ <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={() => setDismissed(true)}>
+ <X className="size-4" />
+ </Button>
+ </AlertAction>
+ </Alert>
+ );
+};
+
const labelWithHint = (label: string, hint: string): React.ReactNode => (
<>
{label}
@@ -62,53 +100,33 @@ const CreateVectorStore: React.FC<CreateVectorStoreProps> = ({ accessToken, onSu
const [vectorStoreDescription, setVectorStoreDescription] = useState<string>("");
const [ingestResults, setIngestResults] = useState<RAGIngestResponse[]>([]);
const [providerParams, setProviderParams] = useState<Record<string, unknown>>({});
+ const documentsInputId = useId();
- const uploadProps: UploadProps = {
- name: "file",
- multiple: true,
- accept: ".pdf,.txt,.docx,.md,.doc",
- beforeUpload: (file) => {
- const isValidType = [
- "application/pdf",
- "text/plain",
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
- "application/msword",
- "text/markdown",
- ].includes(file.type);
-
- if (!isValidType) {
- toast.error(`${file.name} is not a supported file type. Please upload PDF, TXT, DOCX, or MD files.`);
- return Upload.LIST_IGNORE;
- }
-
- const isLt50M = file.size / 1024 / 1024 < 50;
- if (!isLt50M) {
- toast.error(`${file.name} must be smaller than 50MB!`);
- return Upload.LIST_IGNORE;
- }
+ const isSupportedDocument = (file: File): boolean => {
+ if (!ACCEPTED_DOCUMENT_TYPES.includes(file.type)) {
+ toast.error(`${file.name} is not a supported file type. Please upload PDF, TXT, DOCX, or MD files.`);
+ return false;
+ }
+ if (file.size >= MAX_DOCUMENT_BYTES) {
+ toast.error(`${file.name} must be smaller than 50MB!`);
+ return false;
+ }
+ return true;
+ };
- const newDoc: DocumentUpload = {
- uid: file.uid,
- name: file.name,
- status: "done",
- size: file.size,
- type: file.type,
- originFileObj: file,
- };
-
- setDocuments((prev) => [...prev, newDoc]);
- return false; // Prevent auto upload
- },
- onRemove: (file) => {
- setDocuments((prev) => prev.filter((doc) => doc.uid !== file.uid));
- },
- fileList: documents.map((doc) => ({
- uid: doc.uid,
- name: doc.name,
- status: doc.status,
- size: doc.size,
- })),
- showUploadList: false, // We'll use our custom table
+ const handleAddDocuments = (files: readonly File[]) => {
+ const accepted: DocumentUpload[] = files.filter(isSupportedDocument).map((file) => ({
+ uid: uuidv4(),
+ name: file.name,
+ status: "done",
+ size: file.size,
+ type: file.type,
+ originFileObj: file,
+ }));
+
+ if (accepted.length > 0) {
+ setDocuments((prev) => [...prev, ...accepted]);
+ }
};
const handleRemoveDocument = (uid: string) => {
@@ -235,15 +253,32 @@ const CreateVectorStore: React.FC<CreateVectorStoreProps> = ({ accessToken, onSu
Upload one or more documents (PDF, TXT, DOCX, MD). Maximum file size: 50MB per file.
</p>
</div>
- <Dragger {...uploadProps}>
- <p className="ant-upload-drag-icon">
- <InboxOutlined style={{ fontSize: "48px", color: "#1890ff" }} />
- </p>
- <p className="ant-upload-text">Click or drag files to this area to upload</p>
- <p className="ant-upload-hint">
+ <label
+ htmlFor={documentsInputId}
+ className="flex cursor-pointer flex-col items-center gap-2 rounded-md border border-dashed border-input bg-muted/30 px-6 py-10 text-center transition-colors hover:border-primary hover:bg-muted/50 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50"
+ onDragOver={(event) => event.preventDefault()}
+ onDrop={(event) => {
+ event.preventDefault();
+ handleAddDocuments(Array.from(event.dataTransfer.files));
+ }}
+ >
+ <Inbox className="size-12 text-primary" />
+ <span className="text-base">Click or drag files to this area to upload</span>
+ <span className="text-sm text-muted-foreground">
Support for single or bulk upload. Supported formats: PDF, TXT, DOCX, MD
- </p>
- </Dragger>
+ </span>
+ <input
+ id={documentsInputId}
+ type="file"
+ multiple
+ accept={ACCEPTED_DOCUMENT_EXTENSIONS}
+ className="sr-only"
+ onChange={(event) => {
+ handleAddDocuments(Array.from(event.target.files ?? []));
+ event.target.value = "";
+ }}
+ />
+ </label>
</CardContent>
</Card>
@@ -359,25 +394,7 @@ const CreateVectorStore: React.FC<CreateVectorStoreProps> = ({ accessToken, onSu
</Card>
{/* Success Message */}
- {ingestResults.length > 0 && (
- <Alert>
- <CircleCheck />
- <AlertTitle>Vector Store Created Successfully</AlertTitle>
- <AlertDescription>
- <p>
- <strong>Vector Store ID:</strong> {ingestResults[0]?.vector_store_id}
- </p>
- <p>
- <strong>Documents Ingested:</strong> {ingestResults.length}
- </p>
- </AlertDescription>
- <AlertAction>
- <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={() => setIngestResults([])}>
- <X />
- </Button>
- </AlertAction>
- </Alert>
- )}
+ {ingestResults.length > 0 && <IngestSuccessAlert ingestResults={ingestResults} />}
</div>
</TooltipProvider>
);
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/S3VectorsConfig.tsx b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/S3VectorsConfig.tsx
index cdc63e8b7ec..7243291d740 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/S3VectorsConfig.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/S3VectorsConfig.tsx
@@ -76,22 +76,24 @@ const S3VectorsConfig: React.FC<S3VectorsConfigProps> = ({ accessToken, provider
<Info />
<AlertTitle>AWS S3 Vectors Setup</AlertTitle>
<AlertDescription>
- <p>AWS S3 Vectors allows you to store and query vector embeddings directly in S3:</p>
- <ul style={{ marginLeft: "16px", marginTop: "8px" }}>
- <li>Vector buckets and indexes will be automatically created if they don&apos;t exist</li>
- <li>Vector dimensions are auto-detected from your selected embedding model</li>
- <li>Ensure your AWS credentials have permissions for S3 Vectors operations</li>
- <li>
- Learn more:{" "}
- <a
- href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-vector-buckets.html"
- target="_blank"
- rel="noopener noreferrer"
- >
- AWS S3 Vectors Documentation
- </a>
- </li>
- </ul>
+ <div>
+ <p>AWS S3 Vectors allows you to store and query vector embeddings directly in S3:</p>
+ <ul style={{ marginLeft: "16px", marginTop: "8px" }}>
+ <li>Vector buckets and indexes will be automatically created if they don&apos;t exist</li>
+ <li>Vector dimensions are auto-detected from your selected embedding model</li>
+ <li>Ensure your AWS credentials have permissions for S3 Vectors operations</li>
+ <li>
+ Learn more:{" "}
+ <a
+ href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-vector-buckets.html"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ AWS S3 Vectors Documentation
+ </a>
+ </li>
+ </ul>
+ </div>
</AlertDescription>
</Alert>
diff --git a/ui/litellm-dashboard/src/app/login/LoginPage.tsx b/ui/litellm-dashboard/src/app/login/LoginPage.tsx
index d303a3da87f..3a1d120c8a5 100644
--- a/ui/litellm-dashboard/src/app/login/LoginPage.tsx
+++ b/ui/litellm-dashboard/src/app/login/LoginPage.tsx
@@ -32,8 +32,11 @@ const loginSchema = z.object({
type LoginFormValues = z.infer<typeof loginSchema>;
function SsoEnabledNotice() {
- const [isDismissed, setIsDismissed] = useState(false);
- if (isDismissed) return null;
+ const [dismissed, setDismissed] = useState(false);
+
+ if (dismissed) {
+ return null;
+ }
return (
<Alert variant="info" className="mt-4">
@@ -45,8 +48,8 @@ function SsoEnabledNotice() {
environment configuration.
</AlertTitle>
<AlertAction>
- <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={() => setIsDismissed(true)}>
- <X />
+ <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={() => setDismissed(true)}>
+ <X className="size-4" />
</Button>
</AlertAction>
</Alert>
diff --git a/ui/litellm-dashboard/src/app/onboarding/OnboardingFormBody.tsx b/ui/litellm-dashboard/src/app/onboarding/OnboardingFormBody.tsx
index 0a03cc6a591..77fae186c90 100644
--- a/ui/litellm-dashboard/src/app/onboarding/OnboardingFormBody.tsx
+++ b/ui/litellm-dashboard/src/app/onboarding/OnboardingFormBody.tsx
@@ -1,5 +1,5 @@
-import { CircleAlert, Info } from "lucide-react";
import React from "react";
+import { CircleAlert, Info } from "lucide-react";
import { z } from "zod/v4";
import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { PasswordInput } from "@/components/shared/PasswordInput";
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.test.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.test.tsx
index 46aaa2b4f98..94a6d389db2 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.test.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.test.tsx
@@ -500,9 +500,7 @@ describe("LoggingSettings", () => {
expect(screen.queryByPlaceholderText("e.g., 7d, 30d")).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Save Settings" })).not.toBeInTheDocument();
- // eslint-disable-next-line local/no-antd-class-selectors -- antd Skeleton exposes no role, label or aria-busy to query the loading affordance by
- const skeletons = document.querySelectorAll(".ant-skeleton");
- expect(skeletons.length).toBeGreaterThan(0);
+ expect(document.querySelectorAll('[data-slot="skeleton"]').length).toBeGreaterThan(0);
});
it("should report an error and not claim success when clearing a field fails", async () => {
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.tsx
index f67406a4204..20dfb3d96fb 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/LoggingSettings/LoggingSettings.tsx
@@ -21,7 +21,8 @@ import { Switch } from "@/components/ui/switch";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { ClockCircleOutlined } from "@ant-design/icons";
-import { Card, Skeleton, Space, Typography } from "antd";
+import { Skeleton } from "@/components/ui/skeleton";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { CircleHelp } from "lucide-react";
import React, { useCallback, useMemo } from "react";
import { useForm } from "react-hook-form";
@@ -317,23 +318,34 @@ const LoggingSettings: React.FC = () => {
};
return (
- <Card title="Logging Settings">
- <Space direction="vertical" size="large" style={{ width: "100%" }}>
- <Typography.Paragraph style={{ marginBottom: 0 }} type="secondary">
- Proxy-wide settings that control how request and response data are written to spend logs.
- </Typography.Paragraph>
+ <Card>
+ <CardHeader className="border-b">
+ <CardTitle>Logging Settings</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <div className="flex w-full flex-col gap-6">
+ <p className="mb-0 text-muted-foreground">
+ Proxy-wide settings that control how request and response data are written to spend logs.
+ </p>
- {isLoadingConfig ? (
- <Skeleton active paragraph={{ rows: 4 }} />
- ) : (
- <LoggingSettingsForm
- initialValues={initialValues}
- describeField={describeField}
- isSaving={isPending || isDeletingField}
- onSubmit={handleFormSubmit}
- />
- )}
- </Space>
+ {isLoadingConfig ? (
+ <div className="flex flex-col gap-3">
+ <Skeleton className="h-4 w-2/5" />
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/5" />
+ </div>
+ ) : (
+ <LoggingSettingsForm
+ initialValues={initialValues}
+ describeField={describeField}
+ isSaving={isPending || isDeletingField}
+ onSubmit={handleFormSubmit}
+ />
+ )}
+ </div>
+ </CardContent>
</Card>
);
};
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/MCPSemanticFilterSettings/MCPSemanticFilterSettings.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/MCPSemanticFilterSettings/MCPSemanticFilterSettings.tsx
index ba0b3a5037a..f7ec5238a9d 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/MCPSemanticFilterSettings/MCPSemanticFilterSettings.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/MCPSemanticFilterSettings/MCPSemanticFilterSettings.tsx
@@ -3,7 +3,7 @@
import { useMCPSemanticFilterSettings } from "@/app/(dashboard)/hooks/mcpSemanticFilterSettings/useMCPSemanticFilterSettings";
import { useUpdateMCPSemanticFilterSettings } from "@/app/(dashboard)/hooks/mcpSemanticFilterSettings/useUpdateMCPSemanticFilterSettings";
import { toast } from "@/lib/toast";
-import { Card, Col, Row, Skeleton } from "antd";
+import { Skeleton } from "@/components/ui/skeleton";
import { CircleCheck, CircleHelp, Info, Save, X } from "lucide-react";
import { Alert, AlertAction, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { useEffect, useState } from "react";
@@ -13,6 +13,7 @@ import { FieldGroup } from "@/components/shared/form/field";
import { FormField } from "@/components/shared/form/FormField";
import { SearchSelect } from "@/components/shared/SearchSelect";
import { Button } from "@/components/ui/button";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Slider } from "@/components/ui/slider";
import { Switch } from "@/components/ui/switch";
@@ -79,6 +80,26 @@ const clampTopK = (value: number | null): number | null =>
const parseTopK = (raw: string, rawAsNumber: number): number | null =>
raw === "" || Number.isNaN(rawAsNumber) ? null : rawAsNumber;
+const SaveSuccessAlert = () => {
+ const [dismissed, setDismissed] = useState(false);
+
+ if (dismissed) {
+ return null;
+ }
+
+ return (
+ <Alert variant="success" className="mb-4">
+ <CircleCheck />
+ <AlertTitle>Settings saved successfully</AlertTitle>
+ <AlertAction>
+ <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={() => setDismissed(true)}>
+ <X className="size-4" />
+ </Button>
+ </AlertAction>
+ </Alert>
+ );
+};
+
export default function MCPSemanticFilterSettings({ accessToken }: MCPSemanticFilterSettingsProps) {
const { data, isLoading, isError, error } = useMCPSemanticFilterSettings();
const {
@@ -175,7 +196,12 @@ export default function MCPSemanticFilterSettings({ accessToken }: MCPSemanticFi
return (
<div style={{ width: "100%" }}>
{isLoading ? (
- <Skeleton active />
+ <div className="flex flex-col gap-3">
+ <Skeleton className="h-4 w-2/5" />
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/5" />
+ </div>
) : isError ? (
<Alert variant="error" className="mb-6">
<AlertTitle>Could not load MCP Semantic Filter settings</AlertTitle>
@@ -193,17 +219,7 @@ export default function MCPSemanticFilterSettings({ accessToken }: MCPSemanticFi
</AlertDescription>
</Alert>
- {saveSuccess && (
- <Alert className="mb-4">
- <CircleCheck />
- <AlertTitle>Settings saved successfully</AlertTitle>
- <AlertAction>
- <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={() => setSaveSuccess(false)}>
- <X />
- </Button>
- </AlertAction>
- </Alert>
- )}
+ {saveSuccess && <SaveSuccessAlert />}
{updateError && (
<Alert variant="error" className="mb-4">
@@ -212,121 +228,128 @@ export default function MCPSemanticFilterSettings({ accessToken }: MCPSemanticFi
</Alert>
)}
- <Row gutter={24}>
+ <div className="grid grid-cols-1 gap-x-6 lg:grid-cols-2">
{/* Left Column - Settings */}
- <Col xs={24} lg={12}>
+ <div>
<TooltipProvider>
<form onSubmit={(event) => event.preventDefault()} noValidate>
- <Card style={{ marginBottom: 16 }}>
- <FieldGroup>
- <FormField
- control={form.control}
- name="enabled"
- label={labelWithHint(
- "Enable Semantic Filtering",
- "When enabled, only the most relevant MCP tools will be included in requests based on semantic similarity",
- )}
- description={schema?.properties?.enabled?.description}
- >
- {({ value, onChange, onBlur, id }) => (
- <Switch
- id={id}
- checked={value}
- onCheckedChange={(checked) => commitChange(onChange, checked)}
- onBlur={onBlur}
- disabled={isUpdating}
- />
- )}
- </FormField>
- </FieldGroup>
+ <Card className="mb-4">
+ <CardContent>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="enabled"
+ label={labelWithHint(
+ "Enable Semantic Filtering",
+ "When enabled, only the most relevant MCP tools will be included in requests based on semantic similarity",
+ )}
+ description={schema?.properties?.enabled?.description}
+ >
+ {({ value, onChange, onBlur, id }) => (
+ <Switch
+ id={id}
+ checked={value}
+ onCheckedChange={(checked) => commitChange(onChange, checked)}
+ onBlur={onBlur}
+ disabled={isUpdating}
+ />
+ )}
+ </FormField>
+ </FieldGroup>
+ </CardContent>
</Card>
- <Card title="Configuration" style={{ marginBottom: 16 }}>
- <FieldGroup>
- <FormField
- control={form.control}
- name="embedding_model"
- label={labelWithHint(
- "Embedding Model",
- "The model used to generate embeddings for semantic matching",
- )}
- >
- {({ value, onChange, id }) => (
- <SearchSelect
- inputId={id}
- options={embeddingModels.map((model) => ({
- label: model.model_group,
- value: model.model_group,
- }))}
- value={value}
- onValueChange={(selected) => commitChange(onChange, selected)}
- allowClear={false}
- placeholder={loadingModels ? "Loading models..." : "Select embedding model"}
- emptyText={loadingModels ? "Loading..." : "No embedding models available"}
- disabled={isUpdating || loadingModels}
- />
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="top_k"
- label={labelWithHint("Top K Results", "Maximum number of tools to return after filtering")}
- >
- {({ ref, value, onChange, onBlur, id }) => (
- <Input
- id={id}
- ref={ref}
- type="number"
- min={TOP_K_MIN}
- max={TOP_K_MAX}
- value={value ?? ""}
- onChange={(event) =>
- commitChange(onChange, parseTopK(event.target.value, event.target.valueAsNumber))
- }
- onBlur={() => {
- onChange(clampTopK(value));
- onBlur();
- }}
- disabled={isUpdating}
- />
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="similarity_threshold"
- label={labelWithHint(
- "Similarity Threshold",
- "Minimum similarity score (0-1) for a tool to be included",
- )}
- >
- {({ value, onChange, id }) => (
- <div className="w-full">
- <Slider
+ <Card className="mb-4">
+ <CardHeader className="border-b">
+ <CardTitle>Configuration</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="embedding_model"
+ label={labelWithHint(
+ "Embedding Model",
+ "The model used to generate embeddings for semantic matching",
+ )}
+ >
+ {({ value, onChange, id }) => (
+ <SearchSelect
+ inputId={id}
+ options={embeddingModels.map((model) => ({
+ label: model.model_group,
+ value: model.model_group,
+ }))}
+ value={value}
+ onValueChange={(selected) => commitChange(onChange, selected)}
+ allowClear={false}
+ placeholder={loadingModels ? "Loading models..." : "Select embedding model"}
+ emptyText={loadingModels ? "Loading..." : "No embedding models available"}
+ disabled={isUpdating || loadingModels}
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="top_k"
+ label={labelWithHint("Top K Results", "Maximum number of tools to return after filtering")}
+ >
+ {({ ref, value, onChange, onBlur, id }) => (
+ <Input
id={id}
- min={0}
- max={1}
- step={0.05}
- value={[value]}
- onValueChange={(next) => commitChange(onChange, Array.isArray(next) ? next[0] : next)}
+ ref={ref}
+ type="number"
+ min={TOP_K_MIN}
+ max={TOP_K_MAX}
+ value={value ?? ""}
+ onChange={(event) =>
+ commitChange(onChange, parseTopK(event.target.value, event.target.valueAsNumber))
+ }
+ onBlur={() => {
+ onChange(clampTopK(value));
+ onBlur();
+ }}
disabled={isUpdating}
/>
- <div className="relative mt-2 h-4 text-xs text-muted-foreground">
- {SIMILARITY_THRESHOLD_MARKS.map((mark) => (
- <span
- key={mark.value}
- className="absolute -translate-x-1/2"
- style={{ left: `${mark.value * 100}%` }}
- >
- {mark.label}
- </span>
- ))}
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="similarity_threshold"
+ label={labelWithHint(
+ "Similarity Threshold",
+ "Minimum similarity score (0-1) for a tool to be included",
+ )}
+ >
+ {({ value, onChange, id }) => (
+ <div className="w-full">
+ <Slider
+ id={id}
+ min={0}
+ max={1}
+ step={0.05}
+ value={[value]}
+ onValueChange={(next) => commitChange(onChange, Array.isArray(next) ? next[0] : next)}
+ disabled={isUpdating}
+ />
+ <div className="relative mt-2 h-4 text-xs text-muted-foreground">
+ {SIMILARITY_THRESHOLD_MARKS.map((mark) => (
+ <span
+ key={mark.value}
+ className="absolute -translate-x-1/2"
+ style={{ left: `${mark.value * 100}%` }}
+ >
+ {mark.label}
+ </span>
+ ))}
+ </div>
</div>
- </div>
- )}
- </FormField>
- </FieldGroup>
+ )}
+ </FormField>
+ </FieldGroup>
+ </CardContent>
</Card>
<div style={{ display: "flex", justifyContent: "flex-end", gap: 8 }}>
@@ -341,10 +364,10 @@ export default function MCPSemanticFilterSettings({ accessToken }: MCPSemanticFi
</div>
</form>
</TooltipProvider>
- </Col>
+ </div>
{/* Right Column - Test Configuration */}
- <Col xs={24} lg={12}>
+ <div>
<MCPSemanticFilterTestPanel
accessToken={accessToken}
testQuery={testQuery}
@@ -358,8 +381,8 @@ export default function MCPSemanticFilterSettings({ accessToken }: MCPSemanticFi
testError={testError}
curlCommand={getCurlCommand(testModel, testQuery)}
/>
- </Col>
- </Row>
+ </div>
+ </div>
</>
)}
</div>
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.integration.test.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.integration.test.tsx
index 998fa0ecd99..9f23fc4897c 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.integration.test.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.integration.test.tsx
@@ -33,7 +33,7 @@ describe("PluginSettings config payload", () => {
const user = userEvent.setup();
getConfigFieldSettingMock.mockResolvedValue({ field_value: [] });
render(<PluginSettings />);
- expect(await screen.findAllByText("No data")).not.toHaveLength(0);
+ expect(await screen.findByText("No data", { ignore: "title" })).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: /add plugin/i }));
fireEvent.change(await screen.findByLabelText(/Name \(identifier\)/), { target: { value: "beta" } });
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/RoleMappings.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/RoleMappings.tsx
index 3750ee88183..b99cb59618f 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/RoleMappings.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/RoleMappings.tsx
@@ -1,74 +1,83 @@
import type { RoleMappings as RoleMappingsType } from "@/app/(dashboard)/hooks/sso/useSSOSettings";
-import { Card, Divider, Table, Tag, Typography } from "antd";
+import type { ColumnDef } from "@tanstack/react-table";
+import { DataTable } from "@/components/shared/DataTable";
+import { Badge } from "@/components/ui/badge";
+import { Card, CardContent } from "@/components/ui/card";
+import { Separator } from "@/components/ui/separator";
import { Users } from "lucide-react";
import { defaultRoleDisplayNames } from "./constants";
-const { Title, Text } = Typography;
+
+const inlineCodeClass = "rounded-sm border border-border bg-muted px-1 py-0.5 font-mono text-xs";
+
+interface RoleMappingRow {
+ role: string;
+ groups: string[];
+}
export default function RoleMappings({ roleMappings }: { roleMappings: RoleMappingsType | undefined }) {
if (!roleMappings) {
return null;
}
- const roleMappingsColumns = [
+ const roleMappingsColumns: ColumnDef<RoleMappingRow>[] = [
{
- title: "Role",
- dataIndex: "role",
- key: "role",
- render: (text: string) => <Text strong>{defaultRoleDisplayNames[text]}</Text>,
+ id: "role",
+ accessorKey: "role",
+ header: "Role",
+ cell: ({ row }) => <strong className="font-semibold">{defaultRoleDisplayNames[row.original.role]}</strong>,
},
{
- title: "Mapped Groups",
- dataIndex: "groups",
- key: "groups",
- render: (groups: string[]) => (
- <>
- {groups.length > 0 ? (
- groups.map((group, index) => (
- <Tag key={index} color="blue">
+ id: "groups",
+ accessorKey: "groups",
+ header: "Mapped Groups",
+ cell: ({ row }) =>
+ row.original.groups.length > 0 ? (
+ <div className="flex flex-wrap gap-1">
+ {row.original.groups.map((group, index) => (
+ <Badge key={index} variant="info">
{group}
- </Tag>
- ))
- ) : (
- <Text className="text-gray-400 italic">No groups mapped</Text>
- )}
- </>
- ),
+ </Badge>
+ ))}
+ </div>
+ ) : (
+ <span className="text-gray-400 italic">No groups mapped</span>
+ ),
},
];
return (
<Card>
- <div className="flex items-center gap-3">
- <Users className="w-6 h-6 text-gray-400 mb-2" />
- <Title level={3}>Role Mappings</Title>
- </div>
- <div className="space-y-8">
- <div className="grid grid-cols-2 gap-4">
- <div>
- <Title level={5}>Group Claim</Title>
+ <CardContent>
+ <div className="flex items-center gap-3">
+ <Users className="w-6 h-6 text-gray-400 mb-2" />
+ <h3 className="mb-2 text-2xl font-semibold text-foreground">Role Mappings</h3>
+ </div>
+ <div className="space-y-8">
+ <div className="grid grid-cols-2 gap-4">
<div>
- <Text code>{roleMappings.group_claim}</Text>
+ <h5 className="mb-2 text-base font-semibold text-foreground">Group Claim</h5>
+ <div>
+ <code className={inlineCodeClass}>{roleMappings.group_claim}</code>
+ </div>
</div>
- </div>
- <div>
- <Title level={5}>Default Role</Title>
<div>
- <Text strong>{defaultRoleDisplayNames[roleMappings.default_role]}</Text>
+ <h5 className="mb-2 text-base font-semibold text-foreground">Default Role</h5>
+ <div>
+ <strong className="font-semibold">{defaultRoleDisplayNames[roleMappings.default_role]}</strong>
+ </div>
</div>
</div>
+ <Separator className="my-6" />
+ <DataTable
+ columns={roleMappingsColumns}
+ data={Object.entries(roleMappings.roles).map(([role, groups]) => ({
+ role,
+ groups,
+ }))}
+ getRowId={(row) => row.role}
+ size="compact"
+ />
</div>
- <Divider />
- <Table
- columns={roleMappingsColumns}
- dataSource={Object.entries(roleMappings.roles).map(([role, groups]) => ({
- role,
- groups,
- }))}
- pagination={false}
- bordered
- size="small"
- className="w-full"
- />
- </div>
+ </CardContent>
</Card>
);
}
diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.test.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.test.tsx
index dda1b805582..504e4e45e10 100644
--- a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.test.tsx
+++ b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.test.tsx
@@ -180,19 +180,11 @@ describe("TopKeyView", () => {
expect(tableViewButton).toHaveClass("bg-blue-100");
});
- it("should call setTopKeysLimit when limit is changed via Segmented control", async () => {
+ it("should call setTopKeysLimit when limit is changed via the segmented control", async () => {
const user = userEvent.setup();
render(<TopKeyView {...baseProps} />);
- const limit10Radio = screen.getByRole("radio", { name: "10" });
- const limit10Label = limit10Radio.closest("label");
- if (limit10Label) {
- await user.click(limit10Label);
- } else {
- // Fallback: click the div with title="10"
- const limit10Div = screen.getByTitle("10");
- await user.click(limit10Div);
- }
+ await user.click(screen.getByRole("radio", { name: "10" }));
expect(mockSetTopKeysLimit).toHaveBeenCalledWith(10);
});
diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx
index b3c1be62e88..3f181435e09 100644
--- a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx
+++ b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx
@@ -3,8 +3,9 @@ import { BarChart } from "@/components/shared/charts";
import { DataTable } from "@/components/shared/DataTable";
import { IdCell, MoneyCell } from "@/components/shared/table_cells";
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/outline";
+import { Label } from "@/components/ui/label";
+import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { SimpleTooltip } from "@/components/ui/tooltip";
-import { Segmented } from "antd";
import React, { useState } from "react";
import { formatNumberWithCommas } from "../../../../utils/dataUtils";
import { transformKeyInfo } from "../../../key_team_helpers/transform_key_info";
@@ -12,6 +13,8 @@ import { keyInfoV1Call } from "../../../networking";
import KeyInfoView from "../../../templates/key_info_view";
import { TagUsage } from "../../types";
+const TOP_KEYS_LIMITS = [5, 10, 25, 50] as const;
+
interface TopKeyViewProps {
topKeys: any[];
teams: any[] | null;
@@ -167,16 +170,22 @@ const TopKeyView: React.FC<TopKeyViewProps> = ({ topKeys, teams, showTags = fals
return (
<>
<div className="mb-4 flex justify-between items-center">
- <Segmented
- options={[
- { label: "5", value: 5 },
- { label: "10", value: 10 },
- { label: "25", value: 25 },
- { label: "50", value: 50 },
- ]}
- value={topKeysLimit}
- onChange={(value) => setTopKeysLimit(value as number)}
- />
+ <RadioGroup
+ aria-label="Number of top keys to show"
+ value={String(topKeysLimit)}
+ onValueChange={(limit: unknown) => setTopKeysLimit(Number(limit))}
+ className="inline-flex w-fit items-center gap-1 rounded-lg bg-muted p-[3px]"
+ >
+ {TOP_KEYS_LIMITS.map((limit) => (
+ <Label
+ key={limit}
+ className="cursor-pointer rounded-md px-3 py-1 font-medium text-foreground/60 transition-colors has-data-checked:bg-background has-data-checked:text-foreground has-data-checked:shadow-sm"
+ >
+ <RadioGroupItem value={String(limit)} className="sr-only" />
+ {limit}
+ </Label>
+ ))}
+ </RadioGroup>
<div className="flex space-x-2">
<button
onClick={() => setViewMode("table")}
diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/keyTableColumns.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/keyTableColumns.tsx
index 48eb4dd08d5..8c500607ec4 100644
--- a/ui/litellm-dashboard/src/components/VirtualKeysPage/keyTableColumns.tsx
+++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/keyTableColumns.tsx
@@ -2,10 +2,10 @@
import { InfoCircleOutlined } from "@ant-design/icons";
import { ColumnDef } from "@tanstack/react-table";
-import { Popover, Typography } from "antd";
import { DataTableMultiSortHeader, DataTableSortHeader, type DataTableSortField } from "@/components/shared/DataTable";
import { inheritedBudgetGates } from "@/components/shared/InheritedBudgetHint";
+import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card";
import { Skeleton } from "@/components/ui/skeleton";
import {
DateCell,
@@ -78,9 +78,7 @@ const UserPopoverCell = ({
<div key={label} className="flex flex-col min-w-0">
<span className="text-gray-400">{label}</span>
{value ? (
- <Typography.Text className="font-mono text-xs" ellipsis={{ tooltip: value }} copyable>
- {value}
- </Typography.Text>
+ <IdCell value={value} variant="plain" copyable className="max-w-full" />
) : (
<span className="font-mono">-</span>
)}
@@ -91,29 +89,39 @@ const UserPopoverCell = ({
if (isDefaultAdmin && !userAlias && !userEmail) {
return (
- <Popover content={popoverContent} trigger="hover" placement="bottomLeft">
- <span className="cursor-default">
+ <HoverCard>
+ <HoverCardTrigger render={<span className="cursor-default" />}>
<DefaultProxyAdminTag userId={userId} />
- </span>
- </Popover>
+ </HoverCardTrigger>
+ <HoverCardContent align="start">{popoverContent}</HoverCardContent>
+ </HoverCard>
);
}
return (
- <Popover content={popoverContent} trigger="hover" placement="bottomLeft">
- <span className="font-mono text-xs truncate block cursor-default" style={{ maxWidth: width, overflow: "hidden" }}>
+ <HoverCard>
+ <HoverCardTrigger
+ render={
+ <span
+ className="font-mono text-xs truncate block cursor-default"
+ style={{ maxWidth: width, overflow: "hidden" }}
+ />
+ }
+ >
{displayValue || "-"}
- </span>
- </Popover>
+ </HoverCardTrigger>
+ <HoverCardContent align="start">{popoverContent}</HoverCardContent>
+ </HoverCard>
);
};
const InfoHeader = ({ label, tooltip }: { label: string; tooltip: string }) => (
<span className="flex items-center gap-1">
{label}
- <Popover content={tooltip} trigger="hover">
- <InfoCircleOutlined className="text-gray-400 text-xs cursor-help" />
- </Popover>
+ <HoverCard>
+ <HoverCardTrigger render={<InfoCircleOutlined className="text-gray-400 text-xs cursor-help" />} />
+ <HoverCardContent className="w-auto">{tooltip}</HoverCardContent>
+ </HoverCard>
</span>
);
diff --git a/ui/litellm-dashboard/src/components/agent_management/AgentSelector.test.tsx b/ui/litellm-dashboard/src/components/agent_management/AgentSelector.test.tsx
index a41167df673..ed022711ab2 100644
--- a/ui/litellm-dashboard/src/components/agent_management/AgentSelector.test.tsx
+++ b/ui/litellm-dashboard/src/components/agent_management/AgentSelector.test.tsx
@@ -1,4 +1,5 @@
import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi, beforeEach } from "vitest";
// Mock networking module
@@ -7,35 +8,6 @@ vi.mock("../networking", () => ({
getAgentsList: (...args: any[]) => mockGetAgentsList(...args),
}));
-// Mock antd Select
-vi.mock("antd", () => {
- const SelectComponent = ({ children, onChange, value, mode, placeholder, loading, disabled, ...props }: any) => (
- <div data-testid="agent-select" data-loading={loading} data-disabled={disabled}>
- <select
- data-testid="select-input"
- multiple={mode === "multiple"}
- value={value || []}
- onChange={(e) => {
- const selected = Array.from(e.target.selectedOptions, (opt: any) => opt.value);
- onChange?.(selected);
- }}
- disabled={disabled}
- >
- {children}
- </select>
- {loading && <span data-testid="loading-indicator">Loading</span>}
- </div>
- );
-
- SelectComponent.Option = ({ children, value, ...props }: any) => (
- <option value={value} {...props}>
- {children}
- </option>
- );
-
- return { Select: SelectComponent };
-});
-
import AgentSelector from "./AgentSelector";
describe("AgentSelector", () => {
@@ -56,7 +28,7 @@ describe("AgentSelector", () => {
it("renders the selector", () => {
render(<AgentSelector {...defaultProps} />);
- expect(screen.getByTestId("agent-select")).toBeInTheDocument();
+ expect(screen.getByRole("combobox")).toBeInTheDocument();
});
it("fetches agents on mount with access token", async () => {
@@ -81,34 +53,38 @@ describe("AgentSelector", () => {
);
render(<AgentSelector {...defaultProps} />);
- expect(screen.getByTestId("agent-select")).toHaveAttribute("data-loading", "true");
+ expect(screen.getByRole("combobox")).toHaveAttribute("placeholder", "Loading...");
// Resolve to clean up
resolve({ agents: [] });
await waitFor(() => {
- expect(screen.getByTestId("agent-select")).toHaveAttribute("data-loading", "false");
+ expect(screen.getByRole("combobox")).toHaveAttribute("placeholder", "Select agents");
});
});
it("renders agent options after fetch", async () => {
+ const user = userEvent.setup();
render(<AgentSelector {...defaultProps} />);
- await waitFor(() => {
- expect(screen.getByText("Agent One")).toBeInTheDocument();
- expect(screen.getByText("Agent Two")).toBeInTheDocument();
- });
+
+ await user.click(screen.getByRole("combobox"));
+
+ expect(await screen.findByRole("option", { name: /Agent One/ })).toBeInTheDocument();
+ expect(screen.getByRole("option", { name: /Agent Two/ })).toBeInTheDocument();
});
it("renders access group options with group prefix", async () => {
+ const user = userEvent.setup();
render(<AgentSelector {...defaultProps} />);
- await waitFor(() => {
- expect(screen.getByText("group-a")).toBeInTheDocument();
- expect(screen.getByText("group-b")).toBeInTheDocument();
- });
+
+ await user.click(screen.getByRole("combobox"));
+
+ expect(await screen.findByRole("option", { name: /group-a/ })).toBeInTheDocument();
+ expect(screen.getByRole("option", { name: /group-b/ })).toBeInTheDocument();
});
it("respects disabled prop", () => {
render(<AgentSelector {...defaultProps} disabled />);
- expect(screen.getByTestId("agent-select")).toHaveAttribute("data-disabled", "true");
+ expect(screen.getByRole("combobox")).toBeDisabled();
});
it("handles API error gracefully", async () => {
@@ -123,20 +99,20 @@ describe("AgentSelector", () => {
consoleSpy.mockRestore();
});
- it("passes value as flattened selectedValues", async () => {
+ // An agent and an access group are stored under separate keys but share one control, so the
+ // chips are what prove both halves reached it.
+ it("shows both a selected agent and a selected access group", async () => {
render(<AgentSelector {...defaultProps} value={{ agents: ["agent-1"], accessGroups: ["group-a"] }} />);
- await waitFor(() => {
- const select = screen.getByTestId("select-input");
- // The value should contain agent-1 and group:group-a
- expect(select).toBeInTheDocument();
- });
+
+ expect(await screen.findByLabelText("Agent One")).toBeInTheDocument();
+ expect(screen.getByLabelText("group-a")).toBeInTheDocument();
});
it("handles null response from API", async () => {
mockGetAgentsList.mockResolvedValue(null);
render(<AgentSelector {...defaultProps} />);
await waitFor(() => {
- expect(screen.getByTestId("agent-select")).toHaveAttribute("data-loading", "false");
+ expect(screen.getByRole("combobox")).toHaveAttribute("placeholder", "Select agents");
});
});
});
diff --git a/ui/litellm-dashboard/src/components/agent_management/AgentSelector.tsx b/ui/litellm-dashboard/src/components/agent_management/AgentSelector.tsx
index 6dfbff5fbac..d26772d5c9a 100644
--- a/ui/litellm-dashboard/src/components/agent_management/AgentSelector.tsx
+++ b/ui/litellm-dashboard/src/components/agent_management/AgentSelector.tsx
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
-import { Select } from "antd";
+import { MultiSelect, type MultiSelectOption } from "@/components/shared/MultiSelect";
import { getAgentsList } from "../networking";
interface Agent {
@@ -61,18 +61,16 @@ const AgentSelector: React.FC<AgentSelectorProps> = ({
}, [accessToken]);
// Combine options, access groups first
- const options = [
+ const options: MultiSelectOption[] = [
...accessGroups.map((group) => ({
label: group,
value: `group:${group}`,
- isAccessGroup: true,
- searchText: `${group} Access Group`,
+ description: "Access Group",
})),
...agents.map((agent) => ({
label: `${agent.agent_name || agent.agent_id}`,
value: agent.agent_id,
- isAccessGroup: false,
- searchText: `${agent.agent_name || agent.agent_id} ${agent.agent_id} Agent`,
+ description: "Agent",
})),
];
@@ -88,50 +86,16 @@ const AgentSelector: React.FC<AgentSelectorProps> = ({
return (
<div>
- <Select
- mode="multiple"
- placeholder={placeholder}
- onChange={handleChange}
+ <MultiSelect
+ options={options}
value={selectedValues}
+ onValueChange={handleChange}
+ placeholder={placeholder}
+ emptyText="No agents found"
loading={loading}
- className={className}
- allowClear
- showSearch
- style={{ width: "100%" }}
disabled={disabled}
- filterOption={(input, option) => {
- const searchText = options.find((opt) => opt.value === option?.value)?.searchText || "";
- return searchText.toLowerCase().includes(input.toLowerCase());
- }}
- >
- {options.map((opt) => (
- <Select.Option key={opt.value} value={opt.value} label={opt.label}>
- <div style={{ display: "flex", alignItems: "center", gap: "8px" }}>
- <span
- style={{
- display: "inline-block",
- width: 8,
- height: 8,
- borderRadius: "50%",
- background: opt.isAccessGroup ? "#52c41a" : "#722ed1",
- flexShrink: 0,
- }}
- />
- <span style={{ flex: 1 }}>{opt.label}</span>
- <span
- style={{
- color: opt.isAccessGroup ? "#52c41a" : "#722ed1",
- fontSize: "12px",
- fontWeight: 500,
- opacity: 0.8,
- }}
- >
- {opt.isAccessGroup ? "Access Group" : "Agent"}
- </span>
- </div>
- </Select.Option>
- ))}
- </Select>
+ className={`w-full ${className ?? ""}`}
+ />
</div>
);
};
diff --git a/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx b/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx
index d0add6fb12a..9117cf41910 100644
--- a/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx
+++ b/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx
@@ -538,7 +538,7 @@ describe("CreateKey", () => {
await openModal();
await nameTheKey();
await openSection(/Optional Settings/i);
- await userEvent.click(await screen.findByLabelText("Disable Global Guardrails"));
+ await userEvent.click(await screen.findByRole("switch", { name: /Disable Global Guardrails/ }));
await submit();
expect((await createdPayload()).disable_global_guardrails).toBe(true);
@@ -1085,7 +1085,7 @@ describe("CreateKey", () => {
await openModal();
await nameTheKey();
await openSection(/Optional Settings/i);
- await userEvent.click(await screen.findByLabelText("Enable Prompt Caching"));
+ await userEvent.click(await screen.findByRole("switch", { name: /Enable Prompt Caching/ }));
await submit();
expect((await createdPayload()).enable_prompt_caching).toBe(true);
diff --git a/ui/litellm-dashboard/src/components/shared/Alert.tsx b/ui/litellm-dashboard/src/components/shared/Alert.tsx
index 718957b4f08..0098d261cfd 100644
--- a/ui/litellm-dashboard/src/components/shared/Alert.tsx
+++ b/ui/litellm-dashboard/src/components/shared/Alert.tsx
@@ -10,6 +10,7 @@ const alertVariants = cva({
default: "bg-card text-card-foreground",
destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
info: "border-info/20 bg-info/5 text-info *:[svg]:text-current",
+ success: "border-success/20 bg-success/5 text-success *:[svg]:text-current",
warning: "border-warning/20 bg-warning/5 text-warning *:[svg]:text-current",
error: "border-red-200 bg-red-50 text-red-900 *:data-[slot=alert-description]:text-red-800 *:[svg]:text-red-600",
},
diff --git a/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsx b/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsx
index c241bc4fe04..ab9c21e1de5 100644
--- a/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsx
+++ b/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsx
@@ -68,4 +68,20 @@ describe("SearchSelect", () => {
await user.click(await screen.findByText("Growth"));
expect(onValueChange).toHaveBeenCalledWith("team-2");
});
+
+ it("makes the field non-interactive when disabled", async () => {
+ const onValueChange = vi.fn();
+ const user = userEvent.setup();
+ render(<SearchSelect options={OPTIONS} value="team-1" onValueChange={onValueChange} disabled />);
+
+ const input = screen.getByRole("combobox");
+ expect(input).toBeDisabled();
+
+ await user.click(input);
+ await user.keyboard("Growth");
+
+ expect(input).toHaveValue("Acme Prod");
+ expect(screen.queryByText("Growth")).not.toBeInTheDocument();
+ expect(onValueChange).not.toHaveBeenCalled();
+ });
});
diff --git a/ui/litellm-dashboard/src/components/team/LoggingSettings.test.tsx b/ui/litellm-dashboard/src/components/team/LoggingSettings.test.tsx
index ae02a26ddb0..efdef4c2536 100644
--- a/ui/litellm-dashboard/src/components/team/LoggingSettings.test.tsx
+++ b/ui/litellm-dashboard/src/components/team/LoggingSettings.test.tsx
@@ -194,8 +194,8 @@ describe("LoggingSettings", () => {
renderWithProviders(<LoggingSettings value={initialValue} onChange={mockOnChange} />);
- await user.click(screen.getByTitle("Success Only"));
- await user.click(await screen.findByTitle("Failure Only"));
+ await user.click(screen.getByRole("combobox", { name: "Event Type" }));
+ await user.click(await screen.findByRole("option", { name: "Failure Only" }));
expect(mockOnChange).toHaveBeenCalledWith([expect.objectContaining({ callback_type: "failure" })]);
});
diff --git a/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx b/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx
index 159f8fa0b74..e9ec3ce9439 100644
--- a/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx
+++ b/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx
@@ -1,7 +1,8 @@
/* eslint-disable react/no-unescaped-entities */
import React from "react";
import { SimpleTooltip } from "@/components/ui/tooltip";
-import { Select, Divider } from "antd";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import { Separator } from "@/components/ui/separator";
import { InfoCircleOutlined } from "@ant-design/icons";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
@@ -14,7 +15,11 @@ import { callbackInfo, callback_map, mapDisplayToInternalNames } from "../callba
import { Logo } from "@/components/molecules/logo/Logo";
import NumericalInput from "../shared/numerical_input";
-const { Option } = Select;
+const CALLBACK_TYPE_ITEMS = [
+ { value: "success", label: "Success Only" },
+ { value: "failure", label: "Failure Only" },
+ { value: "success_and_failure", label: "Success & Failure" },
+];
const CallbackVarInput: React.FC<{
sensitive: boolean;
@@ -199,31 +204,31 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
<div className="space-y-2">
<label className="text-sm font-medium text-foreground">Disabled Callbacks</label>
- <Select
- mode="multiple"
- placeholder="Select callbacks to disable"
- value={disabledCallbacks}
- onChange={handleDisabledCallbacksChange}
- style={{ width: "100%" }}
- optionLabelProp="label"
- >
- {allCallbacks.map((callbackName) => {
- const description = callbackInfo[callbackName]?.description;
- return (
- <Option key={callbackName} value={callbackName} label={callbackName}>
- <SimpleTooltip content={description} side="right">
- <div className="flex items-center space-x-2">
- <Logo
- src={callbackInfo[callbackName]?.logo}
- label={callbackName}
- className="w-4 h-4 object-contain"
- />
- <span>{callbackName}</span>
- </div>
- </SimpleTooltip>
- </Option>
- );
- })}
+ <Select multiple value={disabledCallbacks} onValueChange={handleDisabledCallbacksChange}>
+ <SelectTrigger className="w-full">
+ <SelectValue placeholder="Select callbacks to disable">
+ {(selected: string[]) => (selected.length === 0 ? "Select callbacks to disable" : selected.join(", "))}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {allCallbacks.map((callbackName) => {
+ const description = callbackInfo[callbackName]?.description;
+ return (
+ <SelectItem key={callbackName} value={callbackName}>
+ <SimpleTooltip content={description} side="right">
+ <div className="flex items-center space-x-2">
+ <Logo
+ src={callbackInfo[callbackName]?.logo}
+ label={callbackName}
+ className="w-4 h-4 object-contain"
+ />
+ <span>{callbackName}</span>
+ </div>
+ </SimpleTooltip>
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
</Select>
<div className="text-xs text-muted-foreground">
Select callbacks that should be disabled for this key. These callbacks will not receive any logging data.
@@ -231,7 +236,7 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
</div>
</div>
- <Divider />
+ <Separator className="my-6" />
{/* Logging Integrations Section */}
<div className="flex justify-between items-center">
@@ -286,42 +291,55 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
<div className="space-y-2">
<label className="text-sm font-medium text-foreground">Integration Type</label>
<Select
- value={callbackDisplayName}
- placeholder="Select integration"
- onChange={(value) => updateLoggingConfig(index, "callback_name", value)}
- className="w-full"
- optionLabelProp="label"
+ value={callbackDisplayName ?? null}
+ onValueChange={(value: string | null) =>
+ value && updateLoggingConfig(index, "callback_name", value)
+ }
>
- {supportedCallbacks.map((callbackName) => {
- const description = callbackInfo[callbackName]?.description;
- return (
- <Option key={callbackName} value={callbackName} label={callbackName}>
- <SimpleTooltip content={description} side="right">
- <div className="flex items-center space-x-2">
- <Logo
- src={callbackInfo[callbackName]?.logo}
- label={callbackName}
- className="w-4 h-4 object-contain"
- />
- <span>{callbackName}</span>
- </div>
- </SimpleTooltip>
- </Option>
- );
- })}
+ <SelectTrigger className="w-full">
+ <SelectValue placeholder="Select integration" />
+ </SelectTrigger>
+ <SelectContent>
+ {supportedCallbacks.map((callbackName) => {
+ const description = callbackInfo[callbackName]?.description;
+ return (
+ <SelectItem key={callbackName} value={callbackName}>
+ <SimpleTooltip content={description} side="right">
+ <div className="flex items-center space-x-2">
+ <Logo
+ src={callbackInfo[callbackName]?.logo}
+ label={callbackName}
+ className="w-4 h-4 object-contain"
+ />
+ <span>{callbackName}</span>
+ </div>
+ </SimpleTooltip>
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
</Select>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-foreground">Event Type</label>
<Select
+ items={CALLBACK_TYPE_ITEMS}
value={config.callback_type}
- onChange={(value) => updateLoggingConfig(index, "callback_type", value)}
- className="w-full"
+ onValueChange={(value: string | null) =>
+ value && updateLoggingConfig(index, "callback_type", value)
+ }
>
- <Option value="success">Success Only</Option>
- <Option value="failure">Failure Only</Option>
- <Option value="success_and_failure">Success &amp; Failure</Option>
+ <SelectTrigger aria-label="Event Type" className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {CALLBACK_TYPE_ITEMS.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
</Select>
</div>
</div>
diff --git a/ui/litellm-dashboard/src/components/team/TeamInfo.tsx b/ui/litellm-dashboard/src/components/team/TeamInfo.tsx
index 1684c3b1225..7c6f03e91aa 100644
--- a/ui/litellm-dashboard/src/components/team/TeamInfo.tsx
+++ b/ui/litellm-dashboard/src/components/team/TeamInfo.tsx
@@ -30,7 +30,7 @@ import { Input as UIInput } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
-import { TooltipProvider } from "@/components/ui/tooltip";
+import { SimpleTooltip, TooltipProvider } from "@/components/ui/tooltip";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { Field, FieldDescription, FieldGroup, FieldLabel } from "@/components/shared/form/field";
import { FormField } from "@/components/shared/form/FormField";
@@ -39,7 +39,8 @@ import { MultiSelect } from "@/components/shared/MultiSelect";
import { SearchSelect } from "@/components/shared/SearchSelect";
import { useZodForm } from "@/lib/forms/useZodForm";
import { TagsInput } from "@/app/(dashboard)/guardrails/_components/content_filter/TagsInput";
-import { Tabs, Tooltip } from "antd";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { useVisitedTabs } from "@/hooks/useVisitedTabs";
import { toast } from "@/lib/toast";
import { CheckIcon, ChevronDown, CircleMinus, CopyIcon, Plus, Save } from "lucide-react";
import React, { useEffect, useMemo, useState } from "react";
@@ -475,6 +476,7 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
const canEditTeam = is_team_admin || is_proxy_admin || is_org_admin || isOrgAdminForTeam || isTeamAdminFromTeamData;
const visibleTabs = useMemo(() => getTeamInfoVisibleTabs(canEditTeam), [canEditTeam]);
const defaultTabKey = useMemo(() => getTeamInfoDefaultTab(editTeam, canEditTeam), [editTeam, canEditTeam]);
+ const { onTabChange, hasVisited } = useVisitedTabs(defaultTabKey);
const teamFormValues = (): TeamUpdateFormValues => {
const info = teamData?.team_info;
@@ -946,1034 +948,1006 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
}
};
- return (
- <div className="p-4">
- <div className="flex justify-between items-center mb-6">
- <div>
- <Button variant="ghost" onClick={onClose} className="mb-4">
- <ArrowLeftIcon className="h-4 w-4" />
- Back to Teams
- </Button>
- <h1 className="text-2xl font-semibold">{info.team_alias}</h1>
- <div className="flex items-center">
- <p className="text-sm text-gray-500 font-mono">{info.team_id}</p>
- <Button
- variant="ghost"
- size="icon-xs"
- onClick={() => copyToClipboard(info.team_id, "team-id")}
- className={`left-2 z-10 transition-all duration-200 ${
- copiedStates["team-id"]
- ? "text-green-600 bg-green-50 border-green-200"
- : "text-gray-500 hover:text-gray-700 hover:bg-gray-100"
- }`}
- >
- {copiedStates["team-id"] ? <CheckIcon size={12} /> : <CopyIcon size={12} />}
- </Button>
- </div>
- </div>
- </div>
-
- <Tabs
- defaultActiveKey={defaultTabKey}
- className="mb-4"
- items={[
- {
- key: TEAM_INFO_TAB_KEYS.OVERVIEW,
- label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.OVERVIEW],
- children: (
- <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
- <Card className="block p-6">
- <p>Budget Status</p>
- <div className="mt-2">
- <h3 className="text-lg font-medium">${formatNumberWithCommas(info.spend, 2)}</h3>
- <p>
- of {info.max_budget === null ? "Unlimited" : `$${formatNumberWithCommas(info.max_budget, 2)}`}
- </p>
- {info.budget_duration && <p className="text-gray-500">Reset: {info.budget_duration}</p>}
- <br />
- {info.team_member_budget_table && (
- <p className="text-gray-500">
- Team Member Budget: ${formatNumberWithCommas(info.team_member_budget_table.max_budget, 2)}
+ const tabItems = [
+ {
+ key: TEAM_INFO_TAB_KEYS.OVERVIEW,
+ label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.OVERVIEW],
+ children: (
+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
+ <Card className="block p-6">
+ <p>Budget Status</p>
+ <div className="mt-2">
+ <h3 className="text-lg font-medium">${formatNumberWithCommas(info.spend, 2)}</h3>
+ <p>of {info.max_budget === null ? "Unlimited" : `$${formatNumberWithCommas(info.max_budget, 2)}`}</p>
+ {info.budget_duration && <p className="text-gray-500">Reset: {info.budget_duration}</p>}
+ <br />
+ {info.team_member_budget_table && (
+ <p className="text-gray-500">
+ Team Member Budget: ${formatNumberWithCommas(info.team_member_budget_table.max_budget, 2)}
+ </p>
+ )}
+ </div>
+ </Card>
+
+ <Card className="block p-6">
+ <p>Rate Limits</p>
+ <div className="mt-2">
+ <p>TPM: {info.tpm_limit || "Unlimited"}</p>
+ <p>RPM: {info.rpm_limit || "Unlimited"}</p>
+ {info.max_parallel_requests && <p>Max Parallel Requests: {info.max_parallel_requests}</p>}
+ {(() => {
+ const modelTpm = (info.metadata?.model_tpm_limit ?? {}) as Record<string, number>;
+ const modelRpm = (info.metadata?.model_rpm_limit ?? {}) as Record<string, number>;
+ const models = Array.from(new Set([...Object.keys(modelTpm), ...Object.keys(modelRpm)]));
+ if (models.length === 0) return null;
+ return (
+ <div className="mt-3">
+ <p className="text-gray-500">Per-model limits:</p>
+ {models.map((m) => (
+ <p key={m} className="text-xs">
+ {m}: TPM {modelTpm[m] ?? "—"}, RPM {modelRpm[m] ?? "—"}
</p>
- )}
+ ))}
</div>
- </Card>
-
- <Card className="block p-6">
- <p>Rate Limits</p>
- <div className="mt-2">
- <p>TPM: {info.tpm_limit || "Unlimited"}</p>
- <p>RPM: {info.rpm_limit || "Unlimited"}</p>
- {info.max_parallel_requests && <p>Max Parallel Requests: {info.max_parallel_requests}</p>}
- {(() => {
- const modelTpm = (info.metadata?.model_tpm_limit ?? {}) as Record<string, number>;
- const modelRpm = (info.metadata?.model_rpm_limit ?? {}) as Record<string, number>;
- const models = Array.from(new Set([...Object.keys(modelTpm), ...Object.keys(modelRpm)]));
- if (models.length === 0) return null;
- return (
- <div className="mt-3">
- <p className="text-gray-500">Per-model limits:</p>
- {models.map((m) => (
- <p key={m} className="text-xs">
- {m}: TPM {modelTpm[m] ?? "—"}, RPM {modelRpm[m] ?? "—"}
- </p>
+ );
+ })()}
+ <p>Estimated Output Tokens: {info.metadata?.default_estimated_output_tokens ?? "Default"}</p>
+ <p>
+ Estimated Output Tokens Per Model:{" "}
+ {info.metadata?.default_estimated_output_tokens_per_model
+ ? JSON.stringify(info.metadata.default_estimated_output_tokens_per_model)
+ : "Default"}
+ </p>
+ </div>
+ </Card>
+
+ <Card className="block p-6">
+ <p>Models</p>
+ <div className="mt-2 flex flex-wrap gap-2">
+ {computeTeamModelBadges(info.models, info.access_group_models || [], info.access_group_details).map(
+ (badge, index) => (
+ <SimpleTooltip key={`${badge.kind}-${badge.label}-${index}`} content={badge.tooltip}>
+ <span>
+ <StatusBadge tone={TEAM_MODEL_BADGE_TONES[badge.kind]} label={badge.label} />
+ </span>
+ </SimpleTooltip>
+ ),
+ )}
+ </div>
+ </Card>
+
+ <Card className="block p-6">
+ <p className="font-semibold text-gray-900">Virtual Keys</p>
+ <div className="mt-2">
+ <p>User Keys: {teamData.keys.filter((key) => key.user_id).length}</p>
+ <p>Service Account Keys: {teamData.keys.filter((key) => !key.user_id).length}</p>
+ <p className="text-gray-500">Total: {teamData.keys.length}</p>
+ </div>
+ </Card>
+
+ <ObjectPermissionsView objectPermission={info.object_permission} variant="card" accessToken={accessToken} />
+
+ <Card className="block p-6">
+ <GuardrailSettingsView
+ globalGuardrailNames={globalGuardrailNames}
+ teamGuardrails={Array.isArray(info.metadata?.guardrails) ? info.metadata.guardrails : []}
+ optedOutGlobalGuardrails={
+ Array.isArray(info.metadata?.opted_out_global_guardrails)
+ ? info.metadata.opted_out_global_guardrails
+ : []
+ }
+ killSwitchOn={initialKillSwitchOn}
+ variant="inline"
+ />
+ </Card>
+
+ <Card className="block p-6">
+ <p className="font-semibold text-gray-900 mb-3">Policies</p>
+ {info.policies && info.policies.length > 0 ? (
+ <div className="space-y-4">
+ {info.policies.map((policy: string, index: number) => (
+ <div key={index} className="space-y-2">
+ <div className="flex items-center gap-2">
+ <Badge variant="secondary">{policy}</Badge>
+ {loadingPolicies && <p className="text-xs text-gray-400">Loading guardrails...</p>}
+ </div>
+ {!loadingPolicies && policyGuardrails[policy] && policyGuardrails[policy].length > 0 && (
+ <div className="ml-4 pl-3 border-l-2 border-gray-200">
+ <p className="text-xs text-gray-500 mb-1">Resolved Guardrails:</p>
+ <div className="flex flex-wrap gap-1">
+ {policyGuardrails[policy].map((guardrail: string, gIndex: number) => (
+ <Badge key={gIndex} variant="secondary">
+ {guardrail}
+ </Badge>
))}
</div>
- );
- })()}
- <p>Estimated Output Tokens: {info.metadata?.default_estimated_output_tokens ?? "Default"}</p>
- <p>
- Estimated Output Tokens Per Model:{" "}
- {info.metadata?.default_estimated_output_tokens_per_model
- ? JSON.stringify(info.metadata.default_estimated_output_tokens_per_model)
- : "Default"}
- </p>
- </div>
- </Card>
-
- <Card className="block p-6">
- <p>Models</p>
- <div className="mt-2 flex flex-wrap gap-2">
- {computeTeamModelBadges(info.models, info.access_group_models || [], info.access_group_details).map(
- (badge, index) => (
- <Tooltip key={`${badge.kind}-${badge.label}-${index}`} title={badge.tooltip}>
- <span>
- <StatusBadge tone={TEAM_MODEL_BADGE_TONES[badge.kind]} label={badge.label} />
- </span>
- </Tooltip>
- ),
+ </div>
)}
</div>
- </Card>
-
- <Card className="block p-6">
- <p className="font-semibold text-gray-900">Virtual Keys</p>
- <div className="mt-2">
- <p>User Keys: {teamData.keys.filter((key) => key.user_id).length}</p>
- <p>Service Account Keys: {teamData.keys.filter((key) => !key.user_id).length}</p>
- <p className="text-gray-500">Total: {teamData.keys.length}</p>
- </div>
- </Card>
-
- <ObjectPermissionsView
- objectPermission={info.object_permission}
- variant="card"
- accessToken={accessToken}
- />
-
- <Card className="block p-6">
- <GuardrailSettingsView
- globalGuardrailNames={globalGuardrailNames}
- teamGuardrails={Array.isArray(info.metadata?.guardrails) ? info.metadata.guardrails : []}
- optedOutGlobalGuardrails={
- Array.isArray(info.metadata?.opted_out_global_guardrails)
- ? info.metadata.opted_out_global_guardrails
- : []
- }
- killSwitchOn={initialKillSwitchOn}
- variant="inline"
- />
- </Card>
-
- <Card className="block p-6">
- <p className="font-semibold text-gray-900 mb-3">Policies</p>
- {info.policies && info.policies.length > 0 ? (
- <div className="space-y-4">
- {info.policies.map((policy: string, index: number) => (
- <div key={index} className="space-y-2">
- <div className="flex items-center gap-2">
- <Badge variant="secondary">{policy}</Badge>
- {loadingPolicies && <p className="text-xs text-gray-400">Loading guardrails...</p>}
- </div>
- {!loadingPolicies && policyGuardrails[policy] && policyGuardrails[policy].length > 0 && (
- <div className="ml-4 pl-3 border-l-2 border-gray-200">
- <p className="text-xs text-gray-500 mb-1">Resolved Guardrails:</p>
- <div className="flex flex-wrap gap-1">
- {policyGuardrails[policy].map((guardrail: string, gIndex: number) => (
- <Badge key={gIndex} variant="secondary">
- {guardrail}
- </Badge>
- ))}
- </div>
- </div>
- )}
- </div>
- ))}
- </div>
- ) : (
- <p className="text-gray-500">No policies configured</p>
- )}
- </Card>
-
- <LoggingSettingsView
- loggingConfigs={info.metadata?.logging || []}
- disabledCallbacks={[]}
- variant="card"
- />
+ ))}
</div>
- ),
- },
- {
- key: TEAM_INFO_TAB_KEYS.MY_USER,
- label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.MY_USER],
- children: <MyUserTab teamId={teamId} />,
- },
- {
- key: TEAM_INFO_TAB_KEYS.VIRTUAL_KEYS,
- label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.VIRTUAL_KEYS],
- children: <TeamVirtualKeysTable teamId={teamId} teamAlias={info.team_alias} organization={organization} />,
- },
- {
- key: TEAM_INFO_TAB_KEYS.MEMBERS,
- label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.MEMBERS],
- children: (
- <TeamMembersComponent
- teamData={teamData}
- canEditTeam={canEditTeam}
- handleMemberDelete={handleMemberDelete}
- setSelectedEditMember={setSelectedEditMember}
- setIsEditMemberModalVisible={setIsEditMemberModalVisible}
- setIsAddMemberModalVisible={setIsAddMemberModalVisible}
- />
- ),
- },
- {
- key: TEAM_INFO_TAB_KEYS.MEMBER_PERMISSIONS,
- label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.MEMBER_PERMISSIONS],
- children: <MemberPermissions teamId={teamId} accessToken={accessToken} canEditTeam={canEditTeam} />,
- },
- {
- key: TEAM_INFO_TAB_KEYS.SETTINGS,
- label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.SETTINGS],
- children: (
- <Card className="block p-6 overflow-y-auto max-h-[65vh]">
- <div className="flex justify-between items-center mb-4">
- <h3 className="text-lg font-medium">Team Settings</h3>
- {canEditTeam && !isEditing && (
- <Button
- variant="outline"
- onClick={() => {
- setTeamModelAliases(info.litellm_model_table?.model_aliases ?? {});
- startEditing();
- }}
- >
- <EditOutlined className="h-4 w-4" />
- Edit Settings
- </Button>
- )}
- </div>
+ ) : (
+ <p className="text-gray-500">No policies configured</p>
+ )}
+ </Card>
- {isEditing && isGuardrailsLoading ? (
- <div className="p-4">Loading...</div>
- ) : isEditing ? (
- <TooltipProvider>
- <form onSubmit={(event) => void form.handleSubmit(onTeamUpdateSubmit)(event)}>
- <FieldGroup>
- <FormField control={form.control} name="team_alias" label="Team Name">
- {({ ref, value, ...field }) => <UIInput {...field} ref={ref} value={value ?? ""} />}
- </FormField>
-
- <FormField
- control={form.control}
- name="models"
- label="Models"
- description="Leave empty to grant no models directly. The team keeps any models granted through its access groups"
- >
- {({ id, value, onChange }) => (
- <ModelSelect
- id={id}
- value={value ?? []}
- onChange={onChange}
- teamID={teamId}
- organizationID={teamData?.team_info?.organization_id || undefined}
- options={{
- includeSpecialOptions: true,
- includeUserModels: !teamData?.team_info?.organization_id,
- showAllProxyModelsOverride:
- isProxyAdminRole(userRole) && !teamData?.team_info?.organization_id,
- }}
- context="team"
- dataTestId="models-select"
- />
- )}
- </FormField>
+ <LoggingSettingsView loggingConfigs={info.metadata?.logging || []} disabledCallbacks={[]} variant="card" />
+ </div>
+ ),
+ },
+ {
+ key: TEAM_INFO_TAB_KEYS.MY_USER,
+ label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.MY_USER],
+ children: <MyUserTab teamId={teamId} />,
+ },
+ {
+ key: TEAM_INFO_TAB_KEYS.VIRTUAL_KEYS,
+ label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.VIRTUAL_KEYS],
+ children: <TeamVirtualKeysTable teamId={teamId} teamAlias={info.team_alias} organization={organization} />,
+ },
+ {
+ key: TEAM_INFO_TAB_KEYS.MEMBERS,
+ label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.MEMBERS],
+ children: (
+ <TeamMembersComponent
+ teamData={teamData}
+ canEditTeam={canEditTeam}
+ handleMemberDelete={handleMemberDelete}
+ setSelectedEditMember={setSelectedEditMember}
+ setIsEditMemberModalVisible={setIsEditMemberModalVisible}
+ setIsAddMemberModalVisible={setIsAddMemberModalVisible}
+ />
+ ),
+ },
+ {
+ key: TEAM_INFO_TAB_KEYS.MEMBER_PERMISSIONS,
+ label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.MEMBER_PERMISSIONS],
+ children: <MemberPermissions teamId={teamId} accessToken={accessToken} canEditTeam={canEditTeam} />,
+ },
+ {
+ key: TEAM_INFO_TAB_KEYS.SETTINGS,
+ label: TEAM_INFO_TAB_LABELS[TEAM_INFO_TAB_KEYS.SETTINGS],
+ children: (
+ <Card className="block p-6 overflow-y-auto max-h-[65vh]">
+ <div className="flex justify-between items-center mb-4">
+ <h3 className="text-lg font-medium">Team Settings</h3>
+ {canEditTeam && !isEditing && (
+ <Button
+ variant="outline"
+ onClick={() => {
+ setTeamModelAliases(info.litellm_model_table?.model_aliases ?? {});
+ startEditing();
+ }}
+ >
+ <EditOutlined className="h-4 w-4" />
+ Edit Settings
+ </Button>
+ )}
+ </div>
- <Field>
- <FieldLabel>
- {labelWithHint(
- "Model Aliases",
- "Map a custom alias to an underlying model. Team members can call the alias in API requests instead of the real model name.",
- )}
- </FieldLabel>
- <ModelAliasManager
- accessToken={accessToken || ""}
- initialModelAliases={teamModelAliases}
- onAliasUpdate={setTeamModelAliases}
- showExampleConfig={false}
- />
- </Field>
+ {isEditing && isGuardrailsLoading ? (
+ <div className="p-4">Loading...</div>
+ ) : isEditing ? (
+ <TooltipProvider>
+ <form onSubmit={(event) => void form.handleSubmit(onTeamUpdateSubmit)(event)}>
+ <FieldGroup>
+ <FormField control={form.control} name="team_alias" label="Team Name">
+ {({ ref, value, ...field }) => <UIInput {...field} ref={ref} value={value ?? ""} />}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="models"
+ label="Models"
+ description="Leave empty to grant no models directly. The team keeps any models granted through its access groups"
+ >
+ {({ id, value, onChange }) => (
+ <ModelSelect
+ id={id}
+ value={value ?? []}
+ onChange={onChange}
+ teamID={teamId}
+ organizationID={teamData?.team_info?.organization_id || undefined}
+ options={{
+ includeSpecialOptions: true,
+ includeUserModels: !teamData?.team_info?.organization_id,
+ showAllProxyModelsOverride:
+ isProxyAdminRole(userRole) && !teamData?.team_info?.organization_id,
+ }}
+ context="team"
+ dataTestId="models-select"
+ />
+ )}
+ </FormField>
- <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
- {({ ref, value, ...field }) => (
- <NumericalInput {...field} ref={ref} value={value ?? ""} step={0.01} precision={2} />
- )}
- </FormField>
+ <Field>
+ <FieldLabel>
+ {labelWithHint(
+ "Model Aliases",
+ "Map a custom alias to an underlying model. Team members can call the alias in API requests instead of the real model name.",
+ )}
+ </FieldLabel>
+ <ModelAliasManager
+ accessToken={accessToken || ""}
+ initialModelAliases={teamModelAliases}
+ onAliasUpdate={setTeamModelAliases}
+ showExampleConfig={false}
+ />
+ </Field>
- <FormField control={form.control} name="soft_budget" label="Soft Budget (USD)">
- {({ ref, value, ...field }) => (
- <NumericalInput {...field} ref={ref} value={value ?? ""} step={0.01} precision={2} />
- )}
- </FormField>
+ <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
+ {({ ref, value, ...field }) => (
+ <NumericalInput {...field} ref={ref} value={value ?? ""} step={0.01} precision={2} />
+ )}
+ </FormField>
+ <FormField control={form.control} name="soft_budget" label="Soft Budget (USD)">
+ {({ ref, value, ...field }) => (
+ <NumericalInput {...field} ref={ref} value={value ?? ""} step={0.01} precision={2} />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="soft_budget_alerting_emails"
+ label={labelWithHint(
+ "Soft Budget Alerting Emails",
+ "Comma-separated email addresses to receive alerts when the soft budget is reached",
+ )}
+ >
+ {({ ref, value, ...field }) => (
+ <UIInput
+ {...field}
+ ref={ref}
+ value={typeof value === "string" ? value : ""}
+ />
+ )}
+ </FormField>
+
+ <Collapsible
+ open={teamMemberSettingsOpen}
+ onOpenChange={setTeamMemberSettingsOpen}
+ className="mt-4 mb-4 overflow-hidden rounded-lg border"
+ >
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>Team Member Settings</b>
+ <ChevronDown className="size-5 shrink-0 text-gray-500 transition-transform group-data-[panel-open]/section:rotate-180" />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <p className="mb-4 text-xs text-gray-500">
+ Optional defaults applied when members join this team. All fields can be overridden per member.
+ </p>
+ <FieldGroup>
<FormField
control={form.control}
- name="soft_budget_alerting_emails"
+ name="default_team_member_models"
label={labelWithHint(
- "Soft Budget Alerting Emails",
- "Comma-separated email addresses to receive alerts when the soft budget is reached",
+ "Default Model Access",
+ "Optional. If set, new members can only access these models by default. Must be a subset of the team's models above. Leave empty to give all members access to all team models.",
)}
>
- {({ ref, value, ...field }) => (
- <UIInput
- {...field}
- ref={ref}
- value={typeof value === "string" ? value : ""}
- />
- )}
- </FormField>
-
- <Collapsible
- open={teamMemberSettingsOpen}
- onOpenChange={setTeamMemberSettingsOpen}
- className="mt-4 mb-4 overflow-hidden rounded-lg border"
- >
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>Team Member Settings</b>
- <ChevronDown className="size-5 shrink-0 text-gray-500 transition-transform group-data-[panel-open]/section:rotate-180" />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <p className="mb-4 text-xs text-gray-500">
- Optional defaults applied when members join this team. All fields can be overridden per
- member.
- </p>
- <FieldGroup>
- <FormField
- control={form.control}
- name="default_team_member_models"
- label={labelWithHint(
- "Default Model Access",
- "Optional. If set, new members can only access these models by default. Must be a subset of the team's models above. Leave empty to give all members access to all team models.",
- )}
- >
- {({ id, value, onChange }) => (
- <MultiSelect
- id={id}
- value={value ?? []}
- onValueChange={onChange}
- options={(watchedModels ?? info.models ?? []).map((model) => ({
- label: model,
- value: model,
- }))}
- placeholder="Leave empty — all team models accessible to every member"
- />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_budget"
- label={labelWithHint(
- "Default Budget (USD)",
- "Default spend budget for each member in this team.",
- )}
- >
- {({ ref, value, ...field }) => (
- <NumericalInput {...field} ref={ref} value={value ?? ""} step={0.01} precision={2} />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_budget_duration"
- label="Default Budget Duration"
- >
- {({ value, onChange }) => (
- <DurationSelect value={value ?? undefined} onChange={onChange} />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_key_duration"
- label={labelWithHint(
- "Default Key Duration (eg: 1d, 1mo)",
- "Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",
- )}
- >
- {({ ref, value, ...field }) => (
- <UIInput {...field} ref={ref} value={value ?? ""} placeholder="e.g., 30d" />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_tpm_limit"
- label={labelWithHint(
- "Default TPM Limit",
- "Default tokens per minute limit for each member. Can be overridden per member.",
- )}
- >
- {({ ref, value, ...field }) => (
- <NumericalInput
- {...field}
- ref={ref}
- value={value ?? ""}
- step={1}
- placeholder="e.g., 1000"
- />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_rpm_limit"
- label={labelWithHint(
- "Default RPM Limit",
- "Default requests per minute limit for each member. Can be overridden per member.",
- )}
- >
- {({ ref, value, ...field }) => (
- <NumericalInput
- {...field}
- ref={ref}
- value={value ?? ""}
- step={1}
- placeholder="e.g., 100"
- />
- )}
- </FormField>
- </FieldGroup>
- </CollapsibleContent>
- </Collapsible>
-
- <FormField control={form.control} name="budget_duration" label="Reset Budget">
{({ id, value, onChange }) => (
- <BudgetDurationDropdown
+ <MultiSelect
id={id}
- placeholder="Never resets"
- value={value}
- onChange={(next) => onChange(next ?? null)}
+ value={value ?? []}
+ onValueChange={onChange}
+ options={(watchedModels ?? info.models ?? []).map((model) => ({
+ label: model,
+ value: model,
+ }))}
+ placeholder="Leave empty — all team models accessible to every member"
/>
)}
</FormField>
-
- <FormField control={form.control} name="tpm_limit" label="Tokens per minute Limit (TPM)">
- {({ ref, value, ...field }) => (
- <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} />
- )}
- </FormField>
-
- <FormField control={form.control} name="rpm_limit" label="Requests per minute Limit (RPM)">
- {({ ref, value, ...field }) => (
- <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} />
- )}
- </FormField>
-
- <Field>
- <FieldLabel>Metadata</FieldLabel>
- <MetadataKeyValueFields
- control={form.control}
- getValues={form.getValues}
- name="metadata"
- schemaFields={teamMetadataSchemaFields}
- schemaLoading={isTeamMetadataSchemaLoading}
- />
- <FieldDescription>
- Values are saved as text. Enter JSON for typed values, e.g. 3, true, or {'{"region": "us"}'}
- .
- </FieldDescription>
- </Field>
-
- <Field>
- <FieldLabel>
- {labelWithHint(
- "Model-Specific Rate Limits",
- "Set per-model TPM/RPM limits that apply across the whole team.",
- )}
- </FieldLabel>
- {modelLimitRows.map((row, index) => (
- <div key={row.id} className="mb-2 flex items-start gap-2">
- <FormField
- control={form.control}
- name={`modelLimits.${index}.model`}
- className="min-w-60"
- >
- {({ id, value, onChange }) => (
- <SearchSelect
- inputId={id}
- value={value ?? ""}
- onValueChange={onChange}
- options={availableRateLimitModels.map((model) => ({
- label: model,
- value: model,
- }))}
- placeholder="Select model"
- />
- )}
- </FormField>
- <FormField control={form.control} name={`modelLimits.${index}.tpm`}>
- {({ ref, value, onChange, ...field }) => (
- <NumericalInput
- {...field}
- ref={ref}
- value={value ?? ""}
- onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
- onChange(event.target.value === "" ? null : Number(event.target.value))
- }
- placeholder="TPM Limit"
- min={0}
- step={1}
- />
- )}
- </FormField>
- <FormField control={form.control} name={`modelLimits.${index}.rpm`}>
- {({ ref, value, onChange, ...field }) => (
- <NumericalInput
- {...field}
- ref={ref}
- value={value ?? ""}
- onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
- onChange(event.target.value === "" ? null : Number(event.target.value))
- }
- placeholder="RPM Limit"
- min={0}
- step={1}
- />
- )}
- </FormField>
- <Button
- type="button"
- variant="ghost"
- size="icon"
- aria-label="Remove model limit"
- className="mt-1 text-destructive"
- onClick={() => removeModelLimit(index)}
- >
- <CircleMinus className="size-4" />
- </Button>
- </div>
- ))}
- <Button
- type="button"
- variant="outline"
- className="w-full border-dashed"
- onClick={() => appendModelLimit({ model: "", tpm: null, rpm: null })}
- >
- <Plus className="size-4" />
- Add Model Limit
- </Button>
- </Field>
-
<FormField
control={form.control}
- name="default_estimated_output_tokens"
- label={labelWithHint("Estimated Output Tokens", teamEstimateTooltip.estimate)}
- >
- {({ ref, value, ...field }) => (
- <NumericalInput
- {...field}
- ref={ref}
- value={value ?? ""}
- min={1}
- step={1}
- disabled={!canEditTeamEstimates}
- />
+ name="team_member_budget"
+ label={labelWithHint(
+ "Default Budget (USD)",
+ "Default spend budget for each member in this team.",
)}
- </FormField>
-
- <FormField
- control={form.control}
- name="default_estimated_output_tokens_per_model"
- label={labelWithHint("Estimated Output Tokens Per Model", teamEstimateTooltip.perModel)}
>
{({ ref, value, ...field }) => (
- <Textarea
- {...field}
- ref={ref}
- value={value ?? ""}
- rows={4}
- placeholder='{"gpt-4": 4096}'
- disabled={!canEditTeamEstimates}
- />
+ <NumericalInput {...field} ref={ref} value={value ?? ""} step={0.01} precision={2} />
)}
</FormField>
-
- <Field>
- <FieldLabel>Router Settings</FieldLabel>
- <RouterSettingsAccordion
- ref={routerSettingsRef}
- accessToken={accessToken || ""}
- teamId={teamId}
- value={info.router_settings ? { router_settings: info.router_settings } : undefined}
- />
- </Field>
-
<FormField
control={form.control}
- name="guardrails"
- label={labelWithDocsHint(
- "Guardrails",
- "Select which guardrails apply to this team. Global guardrails are enabled by default, uncheck to opt out. Other guardrails are opt-in.",
- "https://docs.litellm.ai/docs/proxy/guardrails/quick_start",
- )}
+ name="team_member_budget_duration"
+ label="Default Budget Duration"
>
- {({ id, value, onChange }) => (
- <GuardrailsSelect
- id={id}
- value={value ?? []}
- onValueChange={onChange}
- globalGuardrails={globalGuardrails.map((g) => ({
- name: g.guardrail_name,
- disabled: Boolean(killSwitchOn),
- }))}
- otherGuardrails={otherGuardrails.map((g) => ({
- name: g.guardrail_name,
- disabled: false,
- }))}
- globalGuardrailNames={globalGuardrailNames}
- />
- )}
+ {({ value, onChange }) => <DurationSelect value={value ?? undefined} onChange={onChange} />}
</FormField>
-
<FormField
control={form.control}
- name="disable_global_guardrails"
+ name="team_member_key_duration"
label={labelWithHint(
- "Disable all global guardrails",
- "Kill switch: bypass every global guardrail for this team, including any added in the future. For per-guardrail opt-out instead, use the Guardrails dropdown above.",
+ "Default Key Duration (eg: 1d, 1mo)",
+ "Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",
)}
>
- {({ id, value, onChange }) => (
- <Switch
- id={id}
- checked={value === true}
- onCheckedChange={(checked) => {
- onChange(checked);
- applyKillSwitchToGuardrails(checked);
- }}
- />
+ {({ ref, value, ...field }) => (
+ <UIInput {...field} ref={ref} value={value ?? ""} placeholder="e.g., 30d" />
)}
</FormField>
-
- {canViewPolicies && (
- <FormField
- control={form.control}
- name="policies"
- label={labelWithDocsHint(
- "Policies",
- "Apply policies to this team to control guardrails and other settings",
- "https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",
- )}
- >
- {({ id, value, onChange }) => (
- <TagsInput
- id={id}
- value={value ?? []}
- onValueChange={onChange}
- options={policiesList.map((name) => ({ value: name, label: name }))}
- placeholder="Select or enter policies"
- />
- )}
- </FormField>
- )}
-
<FormField
control={form.control}
- name="access_group_ids"
+ name="team_member_tpm_limit"
label={labelWithHint(
- "Access Groups",
- "Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",
+ "Default TPM Limit",
+ "Default tokens per minute limit for each member. Can be overridden per member.",
)}
>
- {({ value, onChange }) => (
- <AccessGroupSelector
- value={value}
- onChange={onChange}
- placeholder="Select access groups (optional)"
- />
- )}
- </FormField>
-
- <FormField control={form.control} name="vector_stores" label="Vector Stores">
- {({ value, onChange }) => (
- <VectorStoreSelector
- onChange={onChange}
- value={value}
- accessToken={accessToken || ""}
- placeholder="Select vector stores"
+ {({ ref, value, ...field }) => (
+ <NumericalInput
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ step={1}
+ placeholder="e.g., 1000"
/>
)}
</FormField>
-
<FormField
control={form.control}
- name="allowed_passthrough_routes"
- label={
- !premiumUser
- ? labelWithHint(
- "Allowed Pass Through Routes",
- "Premium feature - Upgrade to set allowed pass through routes",
- )
- : !is_proxy_admin
- ? labelWithHint(
- "Allowed Pass Through Routes",
- "Only proxy admins can set allowed pass through routes",
- )
- : "Allowed Pass Through Routes"
- }
- >
- {({ value, onChange }) => (
- <PassThroughRoutesSelector
- value={value}
- onChange={onChange}
- accessToken={accessToken || ""}
- placeholder="Select pass through routes"
- disabled={!premiumUser || !is_proxy_admin}
- />
+ name="team_member_rpm_limit"
+ label={labelWithHint(
+ "Default RPM Limit",
+ "Default requests per minute limit for each member. Can be overridden per member.",
)}
- </FormField>
-
- <FormField
- control={form.control}
- name="mcp_servers_and_groups"
- label="MCP Servers / Access Groups"
>
- {({ value, onChange }) => (
- <MCPServerSelector
- onChange={onChange}
- value={value}
- accessToken={accessToken || ""}
- placeholder="Select MCP servers or access groups (optional)"
- allowAllProxyMcpServers={is_proxy_admin}
- />
- )}
- </FormField>
-
- <div className="mb-6">
- <MCPToolPermissions
- accessToken={accessToken || ""}
- selectedServers={watchedMcpSelection?.servers || []}
- toolPermissions={watchedToolPermissions || {}}
- onChange={(toolPerms) => form.setValue("mcp_tool_permissions", toolPerms)}
- />
- </div>
-
- <FormField control={form.control} name="agents_and_groups" label="Agents / Access Groups">
- {({ value, onChange }) => (
- <AgentSelector
- onChange={onChange}
- value={value}
- accessToken={accessToken || ""}
- placeholder="Select agents or access groups (optional)"
- />
+ {({ ref, value, ...field }) => (
+ <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} placeholder="e.g., 100" />
)}
</FormField>
-
- <Collapsible
- open={searchToolSettingsOpen}
- onOpenChange={setSearchToolSettingsOpen}
- className="mt-4 mb-4 overflow-hidden rounded-lg border"
- >
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>Search Tool Settings</b>
- <ChevronDown className="size-5 shrink-0 text-gray-500 transition-transform group-data-[panel-open]/section:rotate-180" />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <FormField
- control={form.control}
- name="object_permission_search_tools"
- label={labelWithHint(
- "Allowed Search Tools",
- "Select which search tools this team can access. Leave empty to allow all search tools.",
- )}
- >
- {({ value, onChange }) => (
- <SearchToolSelector
- onChange={onChange}
- value={value}
- accessToken={accessToken || ""}
- placeholder="Select search tools (optional, empty = all allowed)"
- />
- )}
- </FormField>
- </CollapsibleContent>
- </Collapsible>
-
- <FormField control={form.control} name="organization_id" label="Organization">
+ </FieldGroup>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <FormField control={form.control} name="budget_duration" label="Reset Budget">
+ {({ id, value, onChange }) => (
+ <BudgetDurationDropdown
+ id={id}
+ placeholder="Never resets"
+ value={value}
+ onChange={(next) => onChange(next ?? null)}
+ />
+ )}
+ </FormField>
+
+ <FormField control={form.control} name="tpm_limit" label="Tokens per minute Limit (TPM)">
+ {({ ref, value, ...field }) => <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} />}
+ </FormField>
+
+ <FormField control={form.control} name="rpm_limit" label="Requests per minute Limit (RPM)">
+ {({ ref, value, ...field }) => <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} />}
+ </FormField>
+
+ <Field>
+ <FieldLabel>Metadata</FieldLabel>
+ <MetadataKeyValueFields
+ control={form.control}
+ getValues={form.getValues}
+ name="metadata"
+ schemaFields={teamMetadataSchemaFields}
+ schemaLoading={isTeamMetadataSchemaLoading}
+ />
+ <FieldDescription>
+ Values are saved as text. Enter JSON for typed values, e.g. 3, true, or {'{"region": "us"}'}.
+ </FieldDescription>
+ </Field>
+
+ <Field>
+ <FieldLabel>
+ {labelWithHint(
+ "Model-Specific Rate Limits",
+ "Set per-model TPM/RPM limits that apply across the whole team.",
+ )}
+ </FieldLabel>
+ {modelLimitRows.map((row, index) => (
+ <div key={row.id} className="mb-2 flex items-start gap-2">
+ <FormField control={form.control} name={`modelLimits.${index}.model`} className="min-w-60">
{({ id, value, onChange }) => (
<SearchSelect
inputId={id}
value={value ?? ""}
- onValueChange={(next) => onChange(next === "" ? null : next)}
- options={userOrganizations.map((org) => ({
- value: org.organization_id ?? "",
- label: org.organization_alias || org.organization_id || "",
+ onValueChange={onChange}
+ options={availableRateLimitModels.map((model) => ({
+ label: model,
+ value: model,
}))}
- placeholder="Select an organization"
- emptyText="No matching organizations"
+ placeholder="Select model"
/>
)}
</FormField>
-
- <FormField control={form.control} name="logging_settings" label="Logging Settings">
- {({ value, onChange }) => (
- <EditLoggingSettings value={(value as unknown[]) ?? []} onChange={onChange} />
+ <FormField control={form.control} name={`modelLimits.${index}.tpm`}>
+ {({ ref, value, onChange, ...field }) => (
+ <NumericalInput
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
+ onChange(event.target.value === "" ? null : Number(event.target.value))
+ }
+ placeholder="TPM Limit"
+ min={0}
+ step={1}
+ />
)}
</FormField>
-
- <FormField
- control={form.control}
- name="secret_manager_settings"
- label="Secret Manager Settings"
- description={
- premiumUser
- ? "Enter secret manager configuration as a JSON object."
- : "Premium feature - Upgrade to manage secret manager settings."
- }
- >
- {({ ref, value, ...field }) => (
- <Textarea
+ <FormField control={form.control} name={`modelLimits.${index}.rpm`}>
+ {({ ref, value, onChange, ...field }) => (
+ <NumericalInput
{...field}
ref={ref}
value={value ?? ""}
- rows={6}
- placeholder='{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}'
- disabled={!premiumUser}
+ onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
+ onChange(event.target.value === "" ? null : Number(event.target.value))
+ }
+ placeholder="RPM Limit"
+ min={0}
+ step={1}
/>
)}
</FormField>
- </FieldGroup>
-
- <div className="sticky z-10 -inset-x-6 -bottom-6 border-t border-gray-200 bg-white p-4 pr-0">
- <div className="flex items-center justify-end gap-2">
- <Button
- type="button"
- variant="outline"
- onClick={() => setIsEditing(false)}
- disabled={isTeamSaving}
- >
- Cancel
- </Button>
- <Button type="submit" disabled={isTeamSaving}>
- {isTeamSaving ? <UiLoadingSpinner className="size-4" /> : <Save className="size-4" />}
- Save Changes
- </Button>
- </div>
- </div>
- </form>
- </TooltipProvider>
- ) : (
- <div className="space-y-4">
- <div>
- <p className="font-medium">Team Name</p>
- <div>{info.team_alias}</div>
- </div>
- <div>
- <p className="font-medium">Team ID</p>
- <div className="font-mono">{info.team_id}</div>
- </div>
- <div>
- <p className="font-medium">Created At</p>
- <div>{new Date(info.created_at).toLocaleString()}</div>
- </div>
- <div>
- <p className="font-medium">Models</p>
- <div className="flex flex-wrap gap-2 mt-1">
- {info.models.map((model, index) => (
- <Badge key={index} variant="secondary">
- {model}
- </Badge>
- ))}
- </div>
- </div>
- {info.default_team_member_models && info.default_team_member_models.length > 0 && (
- <div>
- <p className="font-medium">Default Member Models</p>
- <div className="flex flex-wrap gap-2 mt-1">
- {info.default_team_member_models.map((model, index) => (
- <Badge key={index} variant="secondary">
- {model}
- </Badge>
- ))}
- </div>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ aria-label="Remove model limit"
+ className="mt-1 text-destructive"
+ onClick={() => removeModelLimit(index)}
+ >
+ <CircleMinus className="size-4" />
+ </Button>
</div>
+ ))}
+ <Button
+ type="button"
+ variant="outline"
+ className="w-full border-dashed"
+ onClick={() => appendModelLimit({ model: "", tpm: null, rpm: null })}
+ >
+ <Plus className="size-4" />
+ Add Model Limit
+ </Button>
+ </Field>
+
+ <FormField
+ control={form.control}
+ name="default_estimated_output_tokens"
+ label={labelWithHint("Estimated Output Tokens", teamEstimateTooltip.estimate)}
+ >
+ {({ ref, value, ...field }) => (
+ <NumericalInput
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ min={1}
+ step={1}
+ disabled={!canEditTeamEstimates}
+ />
)}
- <div>
- <p className="font-medium">Model Aliases</p>
- {(() => {
- const aliasEntries = Object.entries(info.litellm_model_table?.model_aliases ?? {});
- if (aliasEntries.length === 0) {
- return <div className="text-gray-400">No model aliases configured</div>;
- }
- return (
- <div className="mt-1 space-y-1">
- {aliasEntries.map(([alias, target]) => (
- <div key={alias} className="text-sm">
- <span className="font-mono">{alias}</span>
- <span className="text-gray-400">{" -> "}</span>
- <span className="font-mono">{target}</span>
- </div>
- ))}
- </div>
- );
- })()}
- </div>
- <div>
- <p className="font-medium">Rate Limits</p>
- <div>TPM: {info.tpm_limit || "Unlimited"}</div>
- <div>RPM: {info.rpm_limit || "Unlimited"}</div>
- {(() => {
- const modelTpm = (info.metadata?.model_tpm_limit ?? {}) as Record<string, number>;
- const modelRpm = (info.metadata?.model_rpm_limit ?? {}) as Record<string, number>;
- const models = Array.from(new Set([...Object.keys(modelTpm), ...Object.keys(modelRpm)]));
- if (models.length === 0) return null;
- return (
- <div className="mt-2">
- <p className="text-gray-500">Per-model limits:</p>
- {models.map((m) => (
- <div key={m} className="text-xs ml-2">
- {m}: TPM {modelTpm[m] ?? "—"}, RPM {modelRpm[m] ?? "—"}
- </div>
- ))}
- </div>
- );
- })()}
- <div>Estimated Output Tokens: {info.metadata?.default_estimated_output_tokens ?? "Default"}</div>
- <div>
- Estimated Output Tokens Per Model:{" "}
- {info.metadata?.default_estimated_output_tokens_per_model
- ? JSON.stringify(info.metadata.default_estimated_output_tokens_per_model)
- : "Default"}
- </div>
- </div>
- <div>
- <p className="font-medium">Team Budget</p>
- <div>
- Max Budget:{" "}
- {info.max_budget !== null ? `$${formatNumberWithCommas(info.max_budget, 4)}` : "No Limit"}
- </div>
- <div>
- Soft Budget:{" "}
- {info.soft_budget !== null && info.soft_budget !== undefined
- ? `$${formatNumberWithCommas(info.soft_budget, 4)}`
- : "No Limit"}
- </div>
- <div>Budget Reset: {info.budget_duration || "Never"}</div>
- {info.metadata?.soft_budget_alerting_emails &&
- Array.isArray(info.metadata.soft_budget_alerting_emails) &&
- info.metadata.soft_budget_alerting_emails.length > 0 && (
- <div>Soft Budget Alerting Emails: {info.metadata.soft_budget_alerting_emails.join(", ")}</div>
- )}
- </div>
- <div>
- <p className="font-medium">
- Team Member Settings{" "}
- <Tooltip title="These are limits on individual team members">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </p>
- <div>Max Budget: {info.team_member_budget_table?.max_budget || "No Limit"}</div>
- <div>Budget Duration: {info.team_member_budget_table?.budget_duration || "No Limit"}</div>
- <div>Key Duration: {info.metadata?.team_member_key_duration || "No Limit"}</div>
- <div>TPM Limit: {info.team_member_budget_table?.tpm_limit || "No Limit"}</div>
- <div>RPM Limit: {info.team_member_budget_table?.rpm_limit || "No Limit"}</div>
- </div>
- <div>
- <p className="font-medium">Router Settings</p>
- {info.router_settings &&
- Object.values(info.router_settings).some(
- (v) => v !== null && v !== undefined && v !== "" && !(Array.isArray(v) && v.length === 0),
- ) ? (
- <div className="mt-1 space-y-1">
- {info.router_settings.routing_strategy && (
- <div>
- Routing Strategy:{" "}
- <Badge variant="secondary">{info.router_settings.routing_strategy}</Badge>
- </div>
- )}
- {info.router_settings.num_retries != null && (
- <div>Number of Retries: {info.router_settings.num_retries}</div>
- )}
- {info.router_settings.allowed_fails != null && (
- <div>Allowed Failures: {info.router_settings.allowed_fails}</div>
- )}
- {info.router_settings.cooldown_time != null && (
- <div>Cooldown Time: {info.router_settings.cooldown_time}s</div>
- )}
- {info.router_settings.timeout != null && <div>Timeout: {info.router_settings.timeout}s</div>}
- {info.router_settings.retry_after != null && (
- <div>Retry After: {info.router_settings.retry_after}s</div>
- )}
- {info.router_settings.fallbacks &&
- Array.isArray(info.router_settings.fallbacks) &&
- info.router_settings.fallbacks.length > 0 && (
- <div>Fallbacks: {info.router_settings.fallbacks.length} configured</div>
- )}
- {info.router_settings.enable_tag_filtering && <div>Tag Filtering: Enabled</div>}
- </div>
- ) : (
- <div className="text-gray-400">No router settings configured</div>
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="default_estimated_output_tokens_per_model"
+ label={labelWithHint("Estimated Output Tokens Per Model", teamEstimateTooltip.perModel)}
+ >
+ {({ ref, value, ...field }) => (
+ <Textarea
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ rows={4}
+ placeholder='{"gpt-4": 4096}'
+ disabled={!canEditTeamEstimates}
+ />
+ )}
+ </FormField>
+
+ <Field>
+ <FieldLabel>Router Settings</FieldLabel>
+ <RouterSettingsAccordion
+ ref={routerSettingsRef}
+ accessToken={accessToken || ""}
+ teamId={teamId}
+ value={info.router_settings ? { router_settings: info.router_settings } : undefined}
+ />
+ </Field>
+
+ <FormField
+ control={form.control}
+ name="guardrails"
+ label={labelWithDocsHint(
+ "Guardrails",
+ "Select which guardrails apply to this team. Global guardrails are enabled by default, uncheck to opt out. Other guardrails are opt-in.",
+ "https://docs.litellm.ai/docs/proxy/guardrails/quick_start",
+ )}
+ >
+ {({ id, value, onChange }) => (
+ <GuardrailsSelect
+ id={id}
+ value={value ?? []}
+ onValueChange={onChange}
+ globalGuardrails={globalGuardrails.map((g) => ({
+ name: g.guardrail_name,
+ disabled: Boolean(killSwitchOn),
+ }))}
+ otherGuardrails={otherGuardrails.map((g) => ({
+ name: g.guardrail_name,
+ disabled: false,
+ }))}
+ globalGuardrailNames={globalGuardrailNames}
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="disable_global_guardrails"
+ label={labelWithHint(
+ "Disable all global guardrails",
+ "Kill switch: bypass every global guardrail for this team, including any added in the future. For per-guardrail opt-out instead, use the Guardrails dropdown above.",
+ )}
+ >
+ {({ id, value, onChange }) => (
+ <Switch
+ id={id}
+ checked={value === true}
+ onCheckedChange={(checked) => {
+ onChange(checked);
+ applyKillSwitchToGuardrails(checked);
+ }}
+ />
+ )}
+ </FormField>
+
+ {canViewPolicies && (
+ <FormField
+ control={form.control}
+ name="policies"
+ label={labelWithDocsHint(
+ "Policies",
+ "Apply policies to this team to control guardrails and other settings",
+ "https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",
)}
- </div>
- <div>
- <p className="font-medium">Organization ID</p>
- <div>{info.organization_id}</div>
- </div>
- <div>
- <p className="font-medium">Status</p>
- <Badge variant={info.blocked ? "destructive" : "secondary"}>
- {info.blocked ? "Blocked" : "Active"}
- </Badge>
- </div>
+ >
+ {({ id, value, onChange }) => (
+ <TagsInput
+ id={id}
+ value={value ?? []}
+ onValueChange={onChange}
+ options={policiesList.map((name) => ({ value: name, label: name }))}
+ placeholder="Select or enter policies"
+ />
+ )}
+ </FormField>
+ )}
- <ObjectPermissionsView
- objectPermission={info.object_permission}
- variant="inline"
- className="pt-4 border-t border-gray-200"
- accessToken={accessToken}
+ <FormField
+ control={form.control}
+ name="access_group_ids"
+ label={labelWithHint(
+ "Access Groups",
+ "Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",
+ )}
+ >
+ {({ value, onChange }) => (
+ <AccessGroupSelector
+ value={value}
+ onChange={onChange}
+ placeholder="Select access groups (optional)"
+ />
+ )}
+ </FormField>
+
+ <FormField control={form.control} name="vector_stores" label="Vector Stores">
+ {({ value, onChange }) => (
+ <VectorStoreSelector
+ onChange={onChange}
+ value={value}
+ accessToken={accessToken || ""}
+ placeholder="Select vector stores"
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="allowed_passthrough_routes"
+ label={
+ !premiumUser
+ ? labelWithHint(
+ "Allowed Pass Through Routes",
+ "Premium feature - Upgrade to set allowed pass through routes",
+ )
+ : !is_proxy_admin
+ ? labelWithHint(
+ "Allowed Pass Through Routes",
+ "Only proxy admins can set allowed pass through routes",
+ )
+ : "Allowed Pass Through Routes"
+ }
+ >
+ {({ value, onChange }) => (
+ <PassThroughRoutesSelector
+ value={value}
+ onChange={onChange}
+ accessToken={accessToken || ""}
+ placeholder="Select pass through routes"
+ disabled={!premiumUser || !is_proxy_admin}
+ />
+ )}
+ </FormField>
+
+ <FormField control={form.control} name="mcp_servers_and_groups" label="MCP Servers / Access Groups">
+ {({ value, onChange }) => (
+ <MCPServerSelector
+ onChange={onChange}
+ value={value}
+ accessToken={accessToken || ""}
+ placeholder="Select MCP servers or access groups (optional)"
+ allowAllProxyMcpServers={is_proxy_admin}
+ />
+ )}
+ </FormField>
+
+ <div className="mb-6">
+ <MCPToolPermissions
+ accessToken={accessToken || ""}
+ selectedServers={watchedMcpSelection?.servers || []}
+ toolPermissions={watchedToolPermissions || {}}
+ onChange={(toolPerms) => form.setValue("mcp_tool_permissions", toolPerms)}
/>
+ </div>
- <GuardrailSettingsView
- globalGuardrailNames={globalGuardrailNames}
- teamGuardrails={Array.isArray(info.metadata?.guardrails) ? info.metadata.guardrails : []}
- optedOutGlobalGuardrails={
- Array.isArray(info.metadata?.opted_out_global_guardrails)
- ? info.metadata.opted_out_global_guardrails
- : []
- }
- killSwitchOn={initialKillSwitchOn}
- variant="inline"
- className="pt-4 border-t border-gray-200"
- />
+ <FormField control={form.control} name="agents_and_groups" label="Agents / Access Groups">
+ {({ value, onChange }) => (
+ <AgentSelector
+ onChange={onChange}
+ value={value}
+ accessToken={accessToken || ""}
+ placeholder="Select agents or access groups (optional)"
+ />
+ )}
+ </FormField>
+
+ <Collapsible
+ open={searchToolSettingsOpen}
+ onOpenChange={setSearchToolSettingsOpen}
+ className="mt-4 mb-4 overflow-hidden rounded-lg border"
+ >
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>Search Tool Settings</b>
+ <ChevronDown className="size-5 shrink-0 text-gray-500 transition-transform group-data-[panel-open]/section:rotate-180" />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <FormField
+ control={form.control}
+ name="object_permission_search_tools"
+ label={labelWithHint(
+ "Allowed Search Tools",
+ "Select which search tools this team can access. Leave empty to allow all search tools.",
+ )}
+ >
+ {({ value, onChange }) => (
+ <SearchToolSelector
+ onChange={onChange}
+ value={value}
+ accessToken={accessToken || ""}
+ placeholder="Select search tools (optional, empty = all allowed)"
+ />
+ )}
+ </FormField>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <FormField control={form.control} name="organization_id" label="Organization">
+ {({ id, value, onChange }) => (
+ <SearchSelect
+ inputId={id}
+ value={value ?? ""}
+ onValueChange={(next) => onChange(next === "" ? null : next)}
+ options={userOrganizations.map((org) => ({
+ value: org.organization_id ?? "",
+ label: org.organization_alias || org.organization_id || "",
+ }))}
+ placeholder="Select an organization"
+ emptyText="No matching organizations"
+ />
+ )}
+ </FormField>
- <LoggingSettingsView
- loggingConfigs={info.metadata?.logging || []}
- disabledCallbacks={[]}
- variant="inline"
- className="pt-4 border-t border-gray-200"
- />
+ <FormField control={form.control} name="logging_settings" label="Logging Settings">
+ {({ value, onChange }) => (
+ <EditLoggingSettings value={(value as unknown[]) ?? []} onChange={onChange} />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="secret_manager_settings"
+ label="Secret Manager Settings"
+ description={
+ premiumUser
+ ? "Enter secret manager configuration as a JSON object."
+ : "Premium feature - Upgrade to manage secret manager settings."
+ }
+ >
+ {({ ref, value, ...field }) => (
+ <Textarea
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ rows={6}
+ placeholder='{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}'
+ disabled={!premiumUser}
+ />
+ )}
+ </FormField>
+ </FieldGroup>
- {info.metadata?.secret_manager_settings && (
- <div className="pt-4 border-t border-gray-200">
- <p className="font-medium">Secret Manager Settings</p>
- <pre className="mt-2 bg-gray-50 p-3 rounded-sm text-xs overflow-x-auto">
- {JSON.stringify(info.metadata.secret_manager_settings, null, 2)}
- </pre>
+ <div className="sticky z-10 -inset-x-6 -bottom-6 border-t border-gray-200 bg-white p-4 pr-0">
+ <div className="flex items-center justify-end gap-2">
+ <Button type="button" variant="outline" onClick={() => setIsEditing(false)} disabled={isTeamSaving}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={isTeamSaving}>
+ {isTeamSaving ? <UiLoadingSpinner className="size-4" /> : <Save className="size-4" />}
+ Save Changes
+ </Button>
+ </div>
+ </div>
+ </form>
+ </TooltipProvider>
+ ) : (
+ <div className="space-y-4">
+ <div>
+ <p className="font-medium">Team Name</p>
+ <div>{info.team_alias}</div>
+ </div>
+ <div>
+ <p className="font-medium">Team ID</p>
+ <div className="font-mono">{info.team_id}</div>
+ </div>
+ <div>
+ <p className="font-medium">Created At</p>
+ <div>{new Date(info.created_at).toLocaleString()}</div>
+ </div>
+ <div>
+ <p className="font-medium">Models</p>
+ <div className="flex flex-wrap gap-2 mt-1">
+ {info.models.map((model, index) => (
+ <Badge key={index} variant="secondary">
+ {model}
+ </Badge>
+ ))}
+ </div>
+ </div>
+ {info.default_team_member_models && info.default_team_member_models.length > 0 && (
+ <div>
+ <p className="font-medium">Default Member Models</p>
+ <div className="flex flex-wrap gap-2 mt-1">
+ {info.default_team_member_models.map((model, index) => (
+ <Badge key={index} variant="secondary">
+ {model}
+ </Badge>
+ ))}
+ </div>
+ </div>
+ )}
+ <div>
+ <p className="font-medium">Model Aliases</p>
+ {(() => {
+ const aliasEntries = Object.entries(info.litellm_model_table?.model_aliases ?? {});
+ if (aliasEntries.length === 0) {
+ return <div className="text-gray-400">No model aliases configured</div>;
+ }
+ return (
+ <div className="mt-1 space-y-1">
+ {aliasEntries.map(([alias, target]) => (
+ <div key={alias} className="text-sm">
+ <span className="font-mono">{alias}</span>
+ <span className="text-gray-400">{" -> "}</span>
+ <span className="font-mono">{target}</span>
+ </div>
+ ))}
+ </div>
+ );
+ })()}
+ </div>
+ <div>
+ <p className="font-medium">Rate Limits</p>
+ <div>TPM: {info.tpm_limit || "Unlimited"}</div>
+ <div>RPM: {info.rpm_limit || "Unlimited"}</div>
+ {(() => {
+ const modelTpm = (info.metadata?.model_tpm_limit ?? {}) as Record<string, number>;
+ const modelRpm = (info.metadata?.model_rpm_limit ?? {}) as Record<string, number>;
+ const models = Array.from(new Set([...Object.keys(modelTpm), ...Object.keys(modelRpm)]));
+ if (models.length === 0) return null;
+ return (
+ <div className="mt-2">
+ <p className="text-gray-500">Per-model limits:</p>
+ {models.map((m) => (
+ <div key={m} className="text-xs ml-2">
+ {m}: TPM {modelTpm[m] ?? "—"}, RPM {modelRpm[m] ?? "—"}
+ </div>
+ ))}
+ </div>
+ );
+ })()}
+ <div>Estimated Output Tokens: {info.metadata?.default_estimated_output_tokens ?? "Default"}</div>
+ <div>
+ Estimated Output Tokens Per Model:{" "}
+ {info.metadata?.default_estimated_output_tokens_per_model
+ ? JSON.stringify(info.metadata.default_estimated_output_tokens_per_model)
+ : "Default"}
+ </div>
+ </div>
+ <div>
+ <p className="font-medium">Team Budget</p>
+ <div>
+ Max Budget: {info.max_budget !== null ? `$${formatNumberWithCommas(info.max_budget, 4)}` : "No Limit"}
+ </div>
+ <div>
+ Soft Budget:{" "}
+ {info.soft_budget !== null && info.soft_budget !== undefined
+ ? `$${formatNumberWithCommas(info.soft_budget, 4)}`
+ : "No Limit"}
+ </div>
+ <div>Budget Reset: {info.budget_duration || "Never"}</div>
+ {info.metadata?.soft_budget_alerting_emails &&
+ Array.isArray(info.metadata.soft_budget_alerting_emails) &&
+ info.metadata.soft_budget_alerting_emails.length > 0 && (
+ <div>Soft Budget Alerting Emails: {info.metadata.soft_budget_alerting_emails.join(", ")}</div>
+ )}
+ </div>
+ <div>
+ <p className="font-medium">
+ Team Member Settings{" "}
+ <SimpleTooltip content="These are limits on individual team members">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </SimpleTooltip>
+ </p>
+ <div>Max Budget: {info.team_member_budget_table?.max_budget || "No Limit"}</div>
+ <div>Budget Duration: {info.team_member_budget_table?.budget_duration || "No Limit"}</div>
+ <div>Key Duration: {info.metadata?.team_member_key_duration || "No Limit"}</div>
+ <div>TPM Limit: {info.team_member_budget_table?.tpm_limit || "No Limit"}</div>
+ <div>RPM Limit: {info.team_member_budget_table?.rpm_limit || "No Limit"}</div>
+ </div>
+ <div>
+ <p className="font-medium">Router Settings</p>
+ {info.router_settings &&
+ Object.values(info.router_settings).some(
+ (v) => v !== null && v !== undefined && v !== "" && !(Array.isArray(v) && v.length === 0),
+ ) ? (
+ <div className="mt-1 space-y-1">
+ {info.router_settings.routing_strategy && (
+ <div>
+ Routing Strategy: <Badge variant="secondary">{info.router_settings.routing_strategy}</Badge>
</div>
)}
+ {info.router_settings.num_retries != null && (
+ <div>Number of Retries: {info.router_settings.num_retries}</div>
+ )}
+ {info.router_settings.allowed_fails != null && (
+ <div>Allowed Failures: {info.router_settings.allowed_fails}</div>
+ )}
+ {info.router_settings.cooldown_time != null && (
+ <div>Cooldown Time: {info.router_settings.cooldown_time}s</div>
+ )}
+ {info.router_settings.timeout != null && <div>Timeout: {info.router_settings.timeout}s</div>}
+ {info.router_settings.retry_after != null && (
+ <div>Retry After: {info.router_settings.retry_after}s</div>
+ )}
+ {info.router_settings.fallbacks &&
+ Array.isArray(info.router_settings.fallbacks) &&
+ info.router_settings.fallbacks.length > 0 && (
+ <div>Fallbacks: {info.router_settings.fallbacks.length} configured</div>
+ )}
+ {info.router_settings.enable_tag_filtering && <div>Tag Filtering: Enabled</div>}
</div>
+ ) : (
+ <div className="text-gray-400">No router settings configured</div>
)}
- </Card>
- ),
- },
- ].filter((tab) => visibleTabs.includes(tab.key))}
- />
+ </div>
+ <div>
+ <p className="font-medium">Organization ID</p>
+ <div>{info.organization_id}</div>
+ </div>
+ <div>
+ <p className="font-medium">Status</p>
+ <Badge variant={info.blocked ? "destructive" : "secondary"}>
+ {info.blocked ? "Blocked" : "Active"}
+ </Badge>
+ </div>
+
+ <ObjectPermissionsView
+ objectPermission={info.object_permission}
+ variant="inline"
+ className="pt-4 border-t border-gray-200"
+ accessToken={accessToken}
+ />
+
+ <GuardrailSettingsView
+ globalGuardrailNames={globalGuardrailNames}
+ teamGuardrails={Array.isArray(info.metadata?.guardrails) ? info.metadata.guardrails : []}
+ optedOutGlobalGuardrails={
+ Array.isArray(info.metadata?.opted_out_global_guardrails)
+ ? info.metadata.opted_out_global_guardrails
+ : []
+ }
+ killSwitchOn={initialKillSwitchOn}
+ variant="inline"
+ className="pt-4 border-t border-gray-200"
+ />
+
+ <LoggingSettingsView
+ loggingConfigs={info.metadata?.logging || []}
+ disabledCallbacks={[]}
+ variant="inline"
+ className="pt-4 border-t border-gray-200"
+ />
+
+ {info.metadata?.secret_manager_settings && (
+ <div className="pt-4 border-t border-gray-200">
+ <p className="font-medium">Secret Manager Settings</p>
+ <pre className="mt-2 bg-gray-50 p-3 rounded-sm text-xs overflow-x-auto">
+ {JSON.stringify(info.metadata.secret_manager_settings, null, 2)}
+ </pre>
+ </div>
+ )}
+ </div>
+ )}
+ </Card>
+ ),
+ },
+ ].filter((tab) => visibleTabs.includes(tab.key));
+
+ return (
+ <div className="p-4">
+ <div className="flex justify-between items-center mb-6">
+ <div>
+ <Button variant="ghost" onClick={onClose} className="mb-4">
+ <ArrowLeftIcon className="h-4 w-4" />
+ Back to Teams
+ </Button>
+ <h1 className="text-2xl font-semibold">{info.team_alias}</h1>
+ <div className="flex items-center">
+ <p className="text-sm text-gray-500 font-mono">{info.team_id}</p>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ onClick={() => copyToClipboard(info.team_id, "team-id")}
+ className={`left-2 z-10 transition-all duration-200 ${
+ copiedStates["team-id"]
+ ? "text-green-600 bg-green-50 border-green-200"
+ : "text-gray-500 hover:text-gray-700 hover:bg-gray-100"
+ }`}
+ >
+ {copiedStates["team-id"] ? <CheckIcon size={12} /> : <CopyIcon size={12} />}
+ </Button>
+ </div>
+ </div>
+ </div>
+
+ <Tabs defaultValue={defaultTabKey} className="mb-4" onValueChange={onTabChange}>
+ <TabsList variant="line" className="mb-4 h-auto w-full justify-start rounded-none border-b p-0">
+ {tabItems.map(({ key, label }) => (
+ <TabsTrigger key={key} value={key} className="flex-none rounded-none px-4 py-2">
+ {label}
+ </TabsTrigger>
+ ))}
+ </TabsList>
+ {tabItems.map(({ key, children }) => (
+ <TabsContent key={key} value={key} keepMounted={hasVisited(key)}>
+ {children}
+ </TabsContent>
+ ))}
+ </Tabs>
<MemberModal
visible={isEditMemberModalVisible}
@@ -1995,9 +1969,9 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
label: (
<span>
Team Member Budget (USD){" "}
- <Tooltip title="Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits">
+ <SimpleTooltip content="Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
type: "numerical" as const,
@@ -2010,9 +1984,9 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
label: (
<span>
Budget Reset Period{" "}
- <Tooltip title="How often this member's budget resets within the team. Leave unset and the budget never resets.">
+ <SimpleTooltip content="How often this member's budget resets within the team. Leave unset and the budget never resets.">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
type: "budget-duration" as const,
@@ -2022,9 +1996,9 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
label: (
<span>
Team Member TPM Limit{" "}
- <Tooltip title="Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit">
+ <SimpleTooltip content="Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
type: "numerical" as const,
@@ -2037,9 +2011,9 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
label: (
<span>
Team Member RPM Limit{" "}
- <Tooltip title="Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit">
+ <SimpleTooltip content="Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
type: "numerical" as const,
@@ -2052,9 +2026,9 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
label: (
<span>
Allowed Models{" "}
- <Tooltip title="Models this member can access within this team. Leave empty to inherit all team models.">
+ <SimpleTooltip content="Models this member can access within this team. Leave empty to inherit all team models.">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
type: "multi-select" as const,
diff --git a/ui/litellm-dashboard/src/components/ui/badge.tsx b/ui/litellm-dashboard/src/components/ui/badge.tsx
index bf17c76aa55..4044a9d63d1 100644
--- a/ui/litellm-dashboard/src/components/ui/badge.tsx
+++ b/ui/litellm-dashboard/src/components/ui/badge.tsx
@@ -11,6 +11,7 @@ const badgeVariants = cva({
variant: {
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
+ info: "bg-info/10 text-info [a]:hover:bg-info/20",
destructive:
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
diff --git a/ui/litellm-dashboard/src/components/ui/combobox.tsx b/ui/litellm-dashboard/src/components/ui/combobox.tsx
index 6dabc994217..b394bb81456 100644
--- a/ui/litellm-dashboard/src/components/ui/combobox.tsx
+++ b/ui/litellm-dashboard/src/components/ui/combobox.tsx
@@ -58,7 +58,7 @@ function ComboboxInput({
}) {
return (
<InputGroup className={cn("w-auto", className)}>
- <ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />
+ <ComboboxPrimitive.Input disabled={disabled} render={<InputGroupInput />} {...props} />
<InputGroupAddon align="inline-end">
{showTrigger && (
<InputGroupButton