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 antd Modal onto the shared shadcn Dialog (#37540)

yuneng-jiang663e647bc857
diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.json
index 09e602e269b..31e8f81f3b3 100644
--- a/ui/litellm-dashboard/eslint-suppressions.json
+++ b/ui/litellm-dashboard/eslint-suppressions.json
@@ -4,11 +4,6 @@
"count": 1
}
},
- "src/app/(dashboard)/access-groups/_components/AccessGroupsModal/AccessGroupEditModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/app/(dashboard)/admin-panel/_components/AdminPanel.tsx": {
"no-restricted-imports": {
"count": 1
@@ -90,9 +85,6 @@
"src/app/(dashboard)/budgets/_components/budget_modal.tsx": {
"local/filename-pascal-case": {
"count": 1
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/app/(dashboard)/budgets/_components/budget_panel.tsx": {
@@ -103,9 +95,6 @@
"src/app/(dashboard)/budgets/_components/edit_budget_modal.tsx": {
"local/filename-pascal-case": {
"count": 1
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/app/(dashboard)/caching/_components/cache_dashboard.tsx": {
@@ -158,9 +147,6 @@
},
"no-nested-ternary": {
"count": 2
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/app/(dashboard)/cost-tracking/_components/how_it_works.tsx": {
@@ -248,9 +234,6 @@
"no-nested-ternary": {
"count": 2
},
- "no-restricted-imports": {
- "count": 1
- },
"react-hooks/set-state-in-effect": {
"count": 1
}
@@ -262,9 +245,6 @@
"max-lines": {
"count": 1
},
- "no-restricted-imports": {
- "count": 1
- },
"react-hooks/set-state-in-effect": {
"count": 1
},
@@ -555,9 +535,6 @@
},
"no-restricted-imports": {
"count": 1
- },
- "react-hooks/set-state-in-effect": {
- "count": 4
}
},
"src/app/(dashboard)/mcp-servers/_components/DcrBridgeToggle.tsx": {
@@ -780,11 +757,6 @@
"count": 1
}
},
- "src/app/(dashboard)/memory/_components/MemoryEditModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/app/(dashboard)/models-and-endpoints/components/ModelRetrySettingsTab.tsx": {
"no-nested-ternary": {
"count": 1
@@ -993,9 +965,6 @@
"local/filename-pascal-case": {
"count": 1
},
- "no-restricted-imports": {
- "count": 1
- },
"react-hooks/immutability": {
"count": 1
}
@@ -1125,16 +1094,6 @@
"count": 1
}
},
- "src/app/(dashboard)/projects/_components/ProjectModals/CreateProjectModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
- "src/app/(dashboard)/projects/_components/ProjectModals/EditProjectModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/app/(dashboard)/projects/_components/ProjectModals/ProjectBaseForm.tsx": {
"react-hooks/set-state-in-effect": {
"count": 2
@@ -1205,9 +1164,6 @@
"no-nested-ternary": {
"count": 3
},
- "no-restricted-imports": {
- "count": 1
- },
"react-hooks/set-state-in-effect": {
"count": 2
}
@@ -1238,18 +1194,10 @@
"count": 2
}
},
- "src/app/(dashboard)/search-tools/_components/CreateSearchTools.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/app/(dashboard)/search-tools/_components/SearchTools.tsx": {
"local/no-complex-jsx-arrow": {
"count": 2
},
- "no-restricted-imports": {
- "count": 1
- },
"react-hooks/static-components": {
"count": 1
}
@@ -1272,14 +1220,6 @@
"src/app/(dashboard)/skills/_components/add_plugin_form.tsx": {
"local/filename-pascal-case": {
"count": 1
- },
- "no-restricted-imports": {
- "count": 1
- }
- },
- "src/app/(dashboard)/tag-management/_components/components/CreateTagModal.tsx": {
- "no-restricted-imports": {
- "count": 1
}
},
"src/app/(dashboard)/tag-management/_components/index.tsx": {
@@ -1392,9 +1332,6 @@
"local/filename-pascal-case": {
"count": 1
},
- "no-restricted-imports": {
- "count": 1
- },
"react-hooks/set-state-in-effect": {
"count": 1
}
@@ -1407,9 +1344,6 @@
"src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx": {
"no-nested-ternary": {
"count": 2
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/app/(dashboard)/vector-stores/_components/index.tsx": {
@@ -1498,16 +1432,6 @@
"count": 1
}
},
- "src/components/CloudZeroCostTracking/CloudZeroCreateModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
- "src/components/CloudZeroCostTracking/CloudZeroUpdateModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/components/CreateUserButton.tsx": {
"no-restricted-imports": {
"count": 1
@@ -1546,16 +1470,6 @@
"count": 1
}
},
- "src/components/SSOModals.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
- "src/components/Settings/AdminSettings/HashicorpVault/EditHashicorpVaultModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/components/Settings/AdminSettings/HashicorpVault/HashicorpVault.tsx": {
"no-nested-ternary": {
"count": 1
@@ -1582,21 +1496,11 @@
"count": 1
}
},
- "src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.test.tsx": {
"max-nested-callbacks": {
"count": 1
}
},
- "src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/components/Settings/AdminSettings/SSOSettings/RedactableField.tsx": {
"no-nested-ternary": {
"count": 1
@@ -1622,11 +1526,6 @@
"count": 1
}
},
- "src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/components/Settings/RouterSettings/Fallbacks/FallbackGroupConfig.tsx": {
"local/no-complex-jsx-arrow": {
"count": 1
@@ -1655,7 +1554,7 @@
},
"src/components/Teams.tsx": {
"local/no-complex-jsx-arrow": {
- "count": 4
+ "count": 3
},
"max-lines": {
"count": 1
@@ -1846,9 +1745,6 @@
"src/components/add_pass_through.tsx": {
"local/filename-pascal-case": {
"count": 1
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/components/agent_management/AgentSelector.test.tsx": {
@@ -2032,9 +1928,6 @@
"src/components/common_components/user_search_modal.tsx": {
"local/filename-pascal-case": {
"count": 1
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/components/constants.tsx": {
@@ -2191,9 +2084,6 @@
"src/components/model_add/reuse_credentials.tsx": {
"local/filename-pascal-case": {
"count": 1
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/components/model_dashboard/ModelSettingsModal/ModelSettingsModal.tsx": {
@@ -2218,9 +2108,6 @@
"local/filename-pascal-case": {
"count": 1
},
- "no-restricted-imports": {
- "count": 1
- },
"prefer-const": {
"count": 5
},
@@ -2271,11 +2158,6 @@
"count": 1
}
},
- "src/components/organisms/RegenerateKeyModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/components/organisms/create_key_button.tsx": {
"local/filename-pascal-case": {
"count": 1
@@ -2375,11 +2257,6 @@
"count": 2
}
},
- "src/components/routing_groups/RoutingGroupModal.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"src/components/routing_groups/index.tsx": {
"local/filename-pascal-case": {
"count": 1
@@ -2518,9 +2395,6 @@
"src/components/team/EditMembership.tsx": {
"no-nested-ternary": {
"count": 1
- },
- "no-restricted-imports": {
- "count": 1
}
},
"src/components/team/LoggingSettings.tsx": {
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/access-groups/_components/AccessGroupsModal/AccessGroupEditModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/access-groups/_components/AccessGroupsModal/AccessGroupEditModal.tsx
index 6514c7072bb..7370b3bc195 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/access-groups/_components/AccessGroupsModal/AccessGroupEditModal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/access-groups/_components/AccessGroupsModal/AccessGroupEditModal.tsx
@@ -1,7 +1,6 @@
"use client";
import React, { useState } from "react";
-import { Modal } from "antd";
import { toast } from "@/lib/toast";
import { useZodForm } from "@/lib/forms/useZodForm";
@@ -18,6 +17,7 @@ import {
MODELS_TAB,
type AccessGroupFormValues,
} from "./AccessGroupBaseForm";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AccessGroupEditModalProps {
visible: boolean;
@@ -87,13 +87,18 @@ function AccessGroupEditForm({ accessGroup, onCancel, onSuccess }: Omit<AccessGr
export function AccessGroupEditModal({ visible, accessGroup, onCancel, onSuccess }: AccessGroupEditModalProps) {
return (
- <Modal title="Edit Access Group" open={visible} onCancel={onCancel} width={700} footer={null} destroyOnHidden>
- <AccessGroupEditForm
- key={accessGroup.access_group_id}
- accessGroup={accessGroup}
- onCancel={onCancel}
- onSuccess={onSuccess}
- />
- </Modal>
+ <Dialog open={visible} onOpenChange={(open) => !open && onCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Edit Access Group</DialogTitle>
+ </DialogHeader>
+ <AccessGroupEditForm
+ key={accessGroup.access_group_id}
+ accessGroup={accessGroup}
+ onCancel={onCancel}
+ onSuccess={onSuccess}
+ />
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.tsx b/ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.tsx
index e9d7190abf5..903676d238a 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.tsx
@@ -7,7 +7,7 @@ import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
-import { Modal, Space, Tabs, Typography } from "antd";
+import { Space, Tabs, Typography } from "antd";
import { Info, TriangleAlert } from "lucide-react";
import React, { useEffect, useState } from "react";
import NewBadge from "@/components/common_components/NewBadge";
@@ -33,6 +33,7 @@ import { FieldGroup } from "@/components/shared/form/field";
import { FormField } from "@/components/shared/form/FormField";
import { Input } from "@/components/ui/input";
import { useZodForm } from "@/lib/forms/useZodForm";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const { Title, Paragraph, Text } = Typography;
@@ -278,87 +279,84 @@ const AdminPanel: React.FC<AdminPanelProps> = ({ proxySettings }) => {
accessToken={accessToken}
ssoConfigured={ssoConfigured}
/>
- <Modal
- title="Manage Allowed IP Addresses"
- width={800}
- open={isAllowedIPModalVisible}
- onCancel={() => setIsAllowedIPModalVisible(false)}
- footer={[
- <Button className="mx-1" key="add" onClick={() => setIsAddIPModalVisible(true)}>
- Add IP Address
- </Button>,
- <Button key="close" onClick={() => setIsAllowedIPModalVisible(false)}>
- Close
- </Button>,
- ]}
- >
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>IP Address</TableHead>
- <TableHead className="text-right">Action</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {allowedIPs.map((ip, index) => (
- <TableRow key={index}>
- <TableCell>{ip}</TableCell>
- <TableCell className="text-right">
- {ip !== all_ip_address_allowed && (
- <Button onClick={() => handleDeleteIP(ip)} variant="destructive" size="sm">
- Delete
- </Button>
- )}
- </TableCell>
+ <Dialog open={isAllowedIPModalVisible} onOpenChange={(open) => !open && setIsAllowedIPModalVisible(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>Manage Allowed IP Addresses</DialogTitle>
+ </DialogHeader>
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>IP Address</TableHead>
+ <TableHead className="text-right">Action</TableHead>
</TableRow>
- ))}
- </TableBody>
- </Table>
- </Modal>
+ </TableHeader>
+ <TableBody>
+ {allowedIPs.map((ip, index) => (
+ <TableRow key={index}>
+ <TableCell>{ip}</TableCell>
+ <TableCell className="text-right">
+ {ip !== all_ip_address_allowed && (
+ <Button onClick={() => handleDeleteIP(ip)} variant="destructive" size="sm">
+ Delete
+ </Button>
+ )}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ <DialogFooter>
+ <Button className="mx-1" onClick={() => setIsAddIPModalVisible(true)}>
+ Add IP Address
+ </Button>
+ <Button onClick={() => setIsAllowedIPModalVisible(false)}>Close</Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
- <Modal
- title="Add Allowed IP Address"
- open={isAddIPModalVisible}
- onCancel={() => setIsAddIPModalVisible(false)}
- footer={null}
- >
- <AddAllowedIPForm onSubmit={handleAddIP} />
- </Modal>
+ <Dialog open={isAddIPModalVisible} onOpenChange={(open) => !open && setIsAddIPModalVisible(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Add Allowed IP Address</DialogTitle>
+ </DialogHeader>
+ <AddAllowedIPForm onSubmit={handleAddIP} />
+ </DialogContent>
+ </Dialog>
- <Modal
- title="Confirm Delete"
- open={isDeleteIPModalVisible}
- onCancel={() => setIsDeleteIPModalVisible(false)}
- onOk={confirmDeleteIP}
- footer={[
- <Button className="mx-1" key="delete" onClick={() => confirmDeleteIP()}>
- Yes
- </Button>,
- <Button key="close" onClick={() => setIsDeleteIPModalVisible(false)}>
- Close
- </Button>,
- ]}
- >
- <Text>Are you sure you want to delete the IP address: {ipToDelete}?</Text>
- </Modal>
+ <Dialog open={isDeleteIPModalVisible} onOpenChange={(open) => !open && setIsDeleteIPModalVisible(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Confirm Delete</DialogTitle>
+ </DialogHeader>
+ <Text>Are you sure you want to delete the IP address: {ipToDelete}?</Text>
+ <DialogFooter>
+ <Button className="mx-1" onClick={() => confirmDeleteIP()}>
+ Yes
+ </Button>
+ <Button onClick={() => setIsDeleteIPModalVisible(false)}>Close</Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
{/* UI Access Control Modal */}
- <Modal
- title="UI Access Control Settings"
+ <Dialog
open={isUIAccessControlModalVisible}
- width={600}
- footer={null}
- onOk={handleUIAccessControlOk}
- onCancel={handleUIAccessControlCancel}
+ onOpenChange={(open) => !open && handleUIAccessControlCancel()}
>
- <UIAccessControlForm
- accessToken={accessToken}
- onSuccess={() => {
- handleUIAccessControlOk();
- toast.success("UI Access Control settings updated successfully");
- }}
- />
- </Modal>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[600px]">
+ <DialogHeader>
+ <DialogTitle>UI Access Control Settings</DialogTitle>
+ </DialogHeader>
+ <UIAccessControlForm
+ accessToken={accessToken}
+ onSuccess={() => {
+ handleUIAccessControlOk();
+ toast.success("UI Access Control settings updated successfully");
+ }}
+ />
+ </DialogContent>
+ </Dialog>
</div>
<Alert variant="info">
<Info />
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx
index 5e828537475..22471ee66f9 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
-import { Modal, Select, Steps, Tag } from "antd";
+import { Select, Steps, Tag } from "antd";
import { FormProvider, useForm, useWatch } from "react-hook-form";
import { toast } from "@/lib/toast";
import { Logo } from "@/components/molecules/logo/Logo";
@@ -49,6 +49,7 @@ import {
import MCPServerSelector from "@/components/mcp_server_management/MCPServerSelector";
import MCPToolPermissions from "@/components/mcp_server_management/MCPToolPermissions";
import GuardrailSelector from "@/components/guardrails/GuardrailSelector";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const { Step } = Steps;
@@ -983,72 +984,64 @@ const AddAgentForm: React.FC<AddAgentFormProps> = ({ visible, onClose, accessTok
);
return (
- <Modal
- title={
- <div className="flex items-center space-x-3 border-b border-border pb-4">
- {selectedLogo && currentStep < 1 && (
- <Logo src={selectedLogo} label="Agent" className="h-6 w-6 object-contain" />
- )}
- <h2 className="text-xl font-semibold text-foreground">Add New Agent</h2>
- </div>
- }
- open={visible}
- onCancel={handleClose}
- footer={null}
- width={900}
- className="top-8"
- styles={{
- body: { padding: "24px" },
- header: { padding: "24px 24px 0 24px", border: "none" },
- }}
- >
- <TooltipProvider>
- <div className="mt-4">
- <Steps current={currentStep} size="small" className="mb-8">
- <Step title="Configure" />
- <Step title="Entitlements" />
- <Step title="Governance" />
- <Step title="Agent Management" />
- <Step title="Ready" />
- </Steps>
-
- <FormProvider {...form}>
- <form onSubmit={(event) => event.preventDefault()} className="space-y-4">
- {currentStep === 0 && renderConfigureStep()}
- {currentStep === 1 && renderEntitlementsStep()}
- {currentStep === 2 && renderObservabilityStep()}
- {currentStep === 3 && renderAssignKeyStep()}
- {currentStep === 4 && renderReadyStep()}
- </form>
- </FormProvider>
-
- <div className="mt-6 flex items-center justify-between border-t border-border pt-6">
- <div>
- {currentStep > 0 && currentStep < 4 && (
- <Button type="button" variant="outline" onClick={handleBack}>
- ← Back
- </Button>
- )}
- </div>
- <div className="flex gap-3">
- {currentStep < 4 && (
- <Button variant="secondary" onClick={handleClose}>
- Cancel
- </Button>
- )}
- {currentStep < 3 && <Button onClick={handleNext}>Next →</Button>}
- {currentStep === 3 && (
- <Button disabled={isSubmitting} aria-busy={isSubmitting} onClick={handleCreateAgent}>
- {isSubmitting && <UiLoadingSpinner className="size-4" />}
- {isSubmitting ? "Creating..." : "Create Agent →"}
- </Button>
- )}
- {currentStep === 4 && <Button onClick={handleClose}>Done</Button>}
+ <Dialog open={visible} onOpenChange={(open) => !open && handleClose()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[900px]">
+ <DialogHeader>
+ <div className="flex items-center space-x-3 border-b border-border pb-4">
+ {selectedLogo && currentStep < 1 && (
+ <Logo src={selectedLogo} label="Agent" className="h-6 w-6 object-contain" />
+ )}
+ <DialogTitle className="text-xl font-semibold text-foreground">Add New Agent</DialogTitle>
+ </div>
+ </DialogHeader>
+ <TooltipProvider>
+ <div className="mt-4">
+ <Steps current={currentStep} size="small" className="mb-8">
+ <Step title="Configure" />
+ <Step title="Entitlements" />
+ <Step title="Governance" />
+ <Step title="Agent Management" />
+ <Step title="Ready" />
+ </Steps>
+
+ <FormProvider {...form}>
+ <form onSubmit={(event) => event.preventDefault()} className="space-y-4">
+ {currentStep === 0 && renderConfigureStep()}
+ {currentStep === 1 && renderEntitlementsStep()}
+ {currentStep === 2 && renderObservabilityStep()}
+ {currentStep === 3 && renderAssignKeyStep()}
+ {currentStep === 4 && renderReadyStep()}
+ </form>
+ </FormProvider>
+
+ <div className="mt-6 flex items-center justify-between border-t border-border pt-6">
+ <div>
+ {currentStep > 0 && currentStep < 4 && (
+ <Button type="button" variant="outline" onClick={handleBack}>
+ ← Back
+ </Button>
+ )}
+ </div>
+ <div className="flex gap-3">
+ {currentStep < 4 && (
+ <Button variant="secondary" onClick={handleClose}>
+ Cancel
+ </Button>
+ )}
+ {currentStep < 3 && <Button onClick={handleNext}>Next →</Button>}
+ {currentStep === 3 && (
+ <Button disabled={isSubmitting} aria-busy={isSubmitting} onClick={handleCreateAgent}>
+ {isSubmitting && <UiLoadingSpinner className="size-4" />}
+ {isSubmitting ? "Creating..." : "Create Agent →"}
+ </Button>
+ )}
+ {currentStep === 4 && <Button onClick={handleClose}>Done</Button>}
+ </div>
</div>
</div>
- </div>
- </TooltipProvider>
- </Modal>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/budget_modal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/budget_modal.tsx
index fd657376066..5761d7308cd 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/budget_modal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/budget_modal.tsx
@@ -1,6 +1,5 @@
import { ChevronRight } from "lucide-react";
import React from "react";
-import { Modal } from "antd";
import { z } from "zod/v4";
import { useCreateBudget } from "@/app/(dashboard)/hooks/budgets/useBudgets";
import { applyBudgetPrecision } from "./budgetPrecision";
@@ -12,6 +11,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/component
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { useZodForm } from "@/lib/forms/useZodForm";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const budgetShape = {
budget_id: z.string().min(1, "Please input a human-friendly name for the budget"),
@@ -40,11 +40,6 @@ const BudgetModal: React.FC<BudgetModalProps> = ({ isModalVisible, setIsModalVis
const form = useZodForm(budgetSchema, { defaultValues: { budget_id: "" } });
const createBudget = useCreateBudget();
- const handleOk = () => {
- setIsModalVisible(false);
- form.reset();
- };
-
const handleCancel = () => {
setIsModalVisible(false);
form.reset();
@@ -68,102 +63,100 @@ const BudgetModal: React.FC<BudgetModalProps> = ({ isModalVisible, setIsModalVis
};
return (
- <Modal
- title="Create Budget"
- open={isModalVisible}
- width={800}
- footer={null}
- onOk={handleOk}
- onCancel={handleCancel}
- >
- <form onSubmit={form.handleSubmit(handleCreate)} noValidate>
- <FieldGroup>
- <FormField
- control={form.control}
- name="budget_id"
- label="Budget ID"
- description="A human-friendly name for the budget"
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} value={field.value ?? ""} placeholder="" />}
- </FormField>
- <FormField
- control={form.control}
- name="tpm_limit"
- label="Max Tokens per minute"
- description="Default is model limit."
- >
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- step={1}
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="rpm_limit"
- label="Max Requests per minute"
- description="Default is model limit."
- >
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- step={1}
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>Create Budget</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={form.handleSubmit(handleCreate)} noValidate>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="budget_id"
+ label="Budget ID"
+ description="A human-friendly name for the budget"
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} value={field.value ?? ""} placeholder="" />}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="tpm_limit"
+ label="Max Tokens per minute"
+ description="Default is model limit."
+ >
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ step={1}
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="rpm_limit"
+ label="Max Requests per minute"
+ description="Default is model limit."
+ >
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ step={1}
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
- <Collapsible open={optionalSettingsOpen} onOpenChange={setOptionalSettingsOpen} className="mt-20 mb-8">
- <CollapsibleTrigger className="group flex w-full items-center justify-between py-2 text-left">
- <b>Optional Settings</b>
- <ChevronRight className="size-4 text-muted-foreground transition-transform group-data-panel-open:rotate-90" />
- </CollapsibleTrigger>
- <CollapsibleContent>
- <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- step={0.01}
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
- <FormField className="mt-8" control={form.control} name="budget_duration" label="Reset Budget">
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Select items={BUDGET_DURATION_OPTIONS} value={value ?? null} onValueChange={onChange}>
- <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
- <SelectValue placeholder="n/a" />
- </SelectTrigger>
- <SelectContent>
- {BUDGET_DURATION_OPTIONS.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- )}
- </FormField>
- </CollapsibleContent>
- </Collapsible>
- </FieldGroup>
+ <Collapsible open={optionalSettingsOpen} onOpenChange={setOptionalSettingsOpen} className="mt-20 mb-8">
+ <CollapsibleTrigger className="group flex w-full items-center justify-between py-2 text-left">
+ <b>Optional Settings</b>
+ <ChevronRight className="size-4 text-muted-foreground transition-transform group-data-panel-open:rotate-90" />
+ </CollapsibleTrigger>
+ <CollapsibleContent>
+ <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ step={0.01}
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
+ <FormField className="mt-8" control={form.control} name="budget_duration" label="Reset Budget">
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Select items={BUDGET_DURATION_OPTIONS} value={value ?? null} onValueChange={onChange}>
+ <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
+ <SelectValue placeholder="n/a" />
+ </SelectTrigger>
+ <SelectContent>
+ {BUDGET_DURATION_OPTIONS.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+ </CollapsibleContent>
+ </Collapsible>
+ </FieldGroup>
- <div style={{ textAlign: "right", marginTop: "10px" }}>
- <Button type="submit">Create Budget</Button>
- </div>
- </form>
- </Modal>
+ <div style={{ textAlign: "right", marginTop: "10px" }}>
+ <Button type="submit">Create Budget</Button>
+ </div>
+ </form>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/edit_budget_modal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/edit_budget_modal.tsx
index 7ebab06cba6..3f9de881710 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/edit_budget_modal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/budgets/_components/edit_budget_modal.tsx
@@ -1,6 +1,5 @@
import { ChevronRight } from "lucide-react";
import React, { useEffect } from "react";
-import { Modal } from "antd";
import { useForm } from "react-hook-form";
import { useUpdateBudget } from "@/app/(dashboard)/hooks/budgets/useBudgets";
import { budgetItem } from "@/app/(dashboard)/hooks/budgets/useBudgets";
@@ -12,6 +11,7 @@ import { Button } from "@/components/ui/button";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
type EditBudgetFormValues = Pick<
budgetItem,
@@ -46,11 +46,6 @@ const EditBudgetModal: React.FC<EditBudgetModalProps> = ({ isModalVisible, setIs
form.reset(toFormValues(existingBudget));
}, [existingBudget, form]);
- const handleOk = () => {
- setIsModalVisible(false);
- form.reset();
- };
-
const handleCancel = () => {
setIsModalVisible(false);
form.reset();
@@ -74,95 +69,100 @@ const EditBudgetModal: React.FC<EditBudgetModalProps> = ({ isModalVisible, setIs
};
return (
- <Modal title="Edit Budget" open={isModalVisible} width={800} footer={null} onOk={handleOk} onCancel={handleCancel}>
- <form onSubmit={form.handleSubmit(handleUpdate)} noValidate>
- <FieldGroup>
- <FormField
- control={form.control}
- name="budget_id"
- label="Budget ID"
- description="Budget ID cannot be changed after creation"
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} value={field.value ?? ""} disabled />}
- </FormField>
- <FormField
- control={form.control}
- name="tpm_limit"
- label="Max Tokens per minute"
- description="Default is model limit."
- >
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- step={1}
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="rpm_limit"
- label="Max Requests per minute"
- description="Default is model limit."
- >
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- step={1}
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>Edit Budget</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={form.handleSubmit(handleUpdate)} noValidate>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="budget_id"
+ label="Budget ID"
+ description="Budget ID cannot be changed after creation"
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} value={field.value ?? ""} disabled />}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="tpm_limit"
+ label="Max Tokens per minute"
+ description="Default is model limit."
+ >
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ step={1}
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="rpm_limit"
+ label="Max Requests per minute"
+ description="Default is model limit."
+ >
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ step={1}
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
- <Collapsible open={optionalSettingsOpen} onOpenChange={setOptionalSettingsOpen} className="mt-20 mb-8">
- <CollapsibleTrigger className="group flex w-full items-center justify-between py-2 text-left">
- <b>Optional Settings</b>
- <ChevronRight className="size-4 text-muted-foreground transition-transform group-data-panel-open:rotate-90" />
- </CollapsibleTrigger>
- <CollapsibleContent>
- <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- step={0.01}
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
- <FormField className="mt-8" control={form.control} name="budget_duration" label="Reset Budget">
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Select items={BUDGET_DURATION_OPTIONS} value={value ?? null} onValueChange={onChange}>
- <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
- <SelectValue placeholder="n/a" />
- </SelectTrigger>
- <SelectContent>
- {BUDGET_DURATION_OPTIONS.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- )}
- </FormField>
- </CollapsibleContent>
- </Collapsible>
- </FieldGroup>
+ <Collapsible open={optionalSettingsOpen} onOpenChange={setOptionalSettingsOpen} className="mt-20 mb-8">
+ <CollapsibleTrigger className="group flex w-full items-center justify-between py-2 text-left">
+ <b>Optional Settings</b>
+ <ChevronRight className="size-4 text-muted-foreground transition-transform group-data-panel-open:rotate-90" />
+ </CollapsibleTrigger>
+ <CollapsibleContent>
+ <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ step={0.01}
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
+ <FormField className="mt-8" control={form.control} name="budget_duration" label="Reset Budget">
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Select items={BUDGET_DURATION_OPTIONS} value={value ?? null} onValueChange={onChange}>
+ <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
+ <SelectValue placeholder="n/a" />
+ </SelectTrigger>
+ <SelectContent>
+ {BUDGET_DURATION_OPTIONS.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+ </CollapsibleContent>
+ </Collapsible>
+ </FieldGroup>
- <div style={{ textAlign: "right", marginTop: "10px" }}>
- <Button type="submit">Save</Button>
- </div>
- </form>
- </Modal>
+ <div style={{ textAlign: "right", marginTop: "10px" }}>
+ <Button type="submit">Save</Button>
+ </div>
+ </form>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.tsx b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.tsx
index 85350a539c2..bf5ae27aee0 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/cost_tracking_settings.tsx
@@ -1,6 +1,5 @@
import React, { useState, useEffect } from "react";
import { ChevronDown } from "lucide-react";
-import { Modal } from "antd";
import {
AlertDialog,
AlertDialogCancel,
@@ -24,6 +23,7 @@ import HowItWorks from "./how_it_works";
import { useDiscountConfig } from "./use_discount_config";
import { useMarginConfig } from "./use_margin_config";
import { fetchAvailableModels, ModelGroup } from "@/components/llm_calls/fetch_models";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const DOCS_LINKS = [
{ label: "Custom pricing for models", href: "https://docs.litellm.ai/docs/proxy/custom_pricing" },
@@ -331,77 +331,61 @@ const CostTrackingSettings: React.FC<CostTrackingSettingsProps> = ({ userID, use
</AlertDialog>
)}
- <Modal
- title={
- <div className="flex items-center space-x-3 pb-4 border-b border-gray-100">
- <h2 className="text-xl font-semibold text-gray-900">Add Provider Discount</h2>
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleModalCancel()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <div className="flex items-center space-x-3 pb-4 border-b border-gray-100">
+ <DialogTitle className="text-xl font-semibold text-gray-900">Add Provider Discount</DialogTitle>
+ </div>
+ </DialogHeader>
+ <div className="mt-6">
+ <p className="text-sm text-gray-600 mb-6">
+ Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5%
+ discount).
+ </p>
+ <form onSubmit={(event) => event.preventDefault()} className="space-y-6">
+ <AddProviderForm
+ discountConfig={discountConfig}
+ selectedProvider={selectedProvider}
+ newDiscount={newDiscount}
+ onProviderChange={setSelectedProvider}
+ onDiscountChange={setNewDiscount}
+ onAddProvider={handleAddProvider}
+ />
+ </form>
</div>
- }
- open={isModalVisible}
- width={1000}
- onCancel={handleModalCancel}
- footer={null}
- className="top-8"
- styles={{
- body: { padding: "24px" },
- header: { padding: "24px 24px 0 24px", border: "none" },
- }}
- >
- <div className="mt-6">
- <p className="text-sm text-gray-600 mb-6">
- Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5%
- discount).
- </p>
- <form onSubmit={(event) => event.preventDefault()} className="space-y-6">
- <AddProviderForm
- discountConfig={discountConfig}
- selectedProvider={selectedProvider}
- newDiscount={newDiscount}
- onProviderChange={setSelectedProvider}
- onDiscountChange={setNewDiscount}
- onAddProvider={handleAddProvider}
- />
- </form>
- </div>
- </Modal>
+ </DialogContent>
+ </Dialog>
- <Modal
- title={
- <div className="flex items-center space-x-3 pb-4 border-b border-gray-100">
- <h2 className="text-xl font-semibold text-gray-900">Add Provider Margin</h2>
+ <Dialog open={isMarginModalVisible} onOpenChange={(open) => !open && handleMarginModalCancel()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <div className="flex items-center space-x-3 pb-4 border-b border-gray-100">
+ <DialogTitle className="text-xl font-semibold text-gray-900">Add Provider Margin</DialogTitle>
+ </div>
+ </DialogHeader>
+ <div className="mt-6">
+ <p className="text-sm text-gray-600 mb-6">
+ Select a provider (or &quot;Global&quot; for all providers) and configure the margin. You can use
+ percentage-based or fixed amount.
+ </p>
+ <form onSubmit={(event) => event.preventDefault()} className="space-y-6">
+ <AddMarginForm
+ marginConfig={marginConfig}
+ selectedProvider={selectedMarginProvider}
+ marginType={marginType}
+ percentageValue={percentageValue}
+ fixedAmountValue={fixedAmountValue}
+ onProviderChange={setSelectedMarginProvider}
+ onMarginTypeChange={setMarginType}
+ onPercentageChange={setPercentageValue}
+ onFixedAmountChange={setFixedAmountValue}
+ onAddProvider={handleAddMargin}
+ />
+ </form>
</div>
- }
- open={isMarginModalVisible}
- width={1000}
- onCancel={handleMarginModalCancel}
- footer={null}
- className="top-8"
- styles={{
- body: { padding: "24px" },
- header: { padding: "24px 24px 0 24px", border: "none" },
- }}
- >
- <div className="mt-6">
- <p className="text-sm text-gray-600 mb-6">
- Select a provider (or &quot;Global&quot; for all providers) and configure the margin. You can use
- percentage-based or fixed amount.
- </p>
- <form onSubmit={(event) => event.preventDefault()} className="space-y-6">
- <AddMarginForm
- marginConfig={marginConfig}
- selectedProvider={selectedMarginProvider}
- marginType={marginType}
- percentageValue={percentageValue}
- fixedAmountValue={fixedAmountValue}
- onProviderChange={setSelectedMarginProvider}
- onMarginTypeChange={setMarginType}
- onPercentageChange={setPercentageValue}
- onFixedAmountChange={setFixedAmountValue}
- onAddProvider={handleAddMargin}
- />
- </form>
- </div>
- </Modal>
+ </DialogContent>
+ </Dialog>
</div>
);
};
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 4edef302f13..146e0fa86e6 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx
@@ -17,7 +17,6 @@ import {
InfoIcon,
CircleHelp,
} from "lucide-react";
-import { Modal } from "antd";
import { z } from "zod/v4";
import {
listGuardrailSubmissions,
@@ -39,6 +38,8 @@ import { Textarea } from "@/components/ui/textarea";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { isAntdUrl } from "@/lib/forms/antdUrl";
import { useZodForm } from "@/lib/forms/useZodForm";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
const GUARDRAIL_MODES = [
{ value: "pre_call", label: "Pre Call" },
@@ -1067,92 +1068,108 @@ export function TeamGuardrailsTab({ accessToken }: TeamGuardrailsTabProps) {
/>
)}
- <Modal
- title="Submit Guardrail for Review"
+ <Dialog
open={isSubmitModalOpen}
- onCancel={() => {
- setIsSubmitModalOpen(false);
- submitForm.reset();
+ onOpenChange={(open) => {
+ if (!open) {
+ setIsSubmitModalOpen(false);
+ submitForm.reset();
+ }
}}
- onOk={handleSubmitGuardrail}
- okText="Submit for Review"
>
- <div className="rounded-md bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-900 px-4 py-3 text-sm text-blue-800 dark:text-blue-200 mb-4">
- Your guardrail will be sent for admin review before it becomes active.
- </div>
- <TooltipProvider>
- <form onSubmit={handleSubmitGuardrail}>
- <FieldGroup>
- <FormField control={submitForm.control} name="team_id" label="Team">
- {({ id, value, onChange }) => <TeamDropdown id={id} value={value} onChange={onChange} />}
- </FormField>
- <FormField control={submitForm.control} name="guardrail_name" label="Guardrail Name">
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="e.g. pii-detection" />}
- </FormField>
- <FormField control={submitForm.control} name="mode" label="Mode">
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Select items={GUARDRAIL_MODES} value={value} onValueChange={onChange}>
- <SelectTrigger
- id={id}
- aria-invalid={ariaInvalid}
- aria-describedby={ariaDescribedBy}
- className="w-full"
- >
- <SelectValue />
- </SelectTrigger>
- <SelectContent alignItemWithTrigger={false}>
- {GUARDRAIL_MODES.map((mode) => (
- <SelectItem key={mode.value} value={mode.value} title={mode.label}>
- {mode.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- )}
- </FormField>
- <FormField control={submitForm.control} name="api_base" label="API Base URL">
- {({ ref, ...field }) => (
- <Input
- {...field}
- ref={ref}
- placeholder="https://your-guardrail-api.com/v1/check"
- className="font-mono"
- />
- )}
- </FormField>
- <FormField
- control={submitForm.control}
- name="extra_litellm_params"
- label={labelWithHint(
- "Additional litellm_params (optional)",
- "JSON object merged into litellm_params. e.g. forward_api_key, headers, model, unreachable_fallback",
- )}
- >
- {({ ref, ...field }) => (
- <Textarea
- {...field}
- ref={ref}
- rows={3}
- className="font-mono text-xs"
- placeholder='{"forward_api_key": true, "headers": {"X-Custom": "value"}}'
- />
- )}
- </FormField>
- <FormField control={submitForm.control} name="guardrail_info" label="Guardrail Info (optional)">
- {({ ref, ...field }) => (
- <Textarea
- {...field}
- ref={ref}
- rows={3}
- className="font-mono text-xs"
- placeholder='{"description": "Detects PII in requests"}'
- />
- )}
- </FormField>
- </FieldGroup>
- </form>
- </TooltipProvider>
- </Modal>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Submit Guardrail for Review</DialogTitle>
+ </DialogHeader>
+ <div className="rounded-md bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-900 px-4 py-3 text-sm text-blue-800 dark:text-blue-200 mb-4">
+ Your guardrail will be sent for admin review before it becomes active.
+ </div>
+ <TooltipProvider>
+ <form onSubmit={handleSubmitGuardrail}>
+ <FieldGroup>
+ <FormField control={submitForm.control} name="team_id" label="Team">
+ {({ id, value, onChange }) => <TeamDropdown id={id} value={value} onChange={onChange} />}
+ </FormField>
+ <FormField control={submitForm.control} name="guardrail_name" label="Guardrail Name">
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="e.g. pii-detection" />}
+ </FormField>
+ <FormField control={submitForm.control} name="mode" label="Mode">
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Select items={GUARDRAIL_MODES} value={value} onValueChange={onChange}>
+ <SelectTrigger
+ id={id}
+ aria-invalid={ariaInvalid}
+ aria-describedby={ariaDescribedBy}
+ className="w-full"
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent alignItemWithTrigger={false}>
+ {GUARDRAIL_MODES.map((mode) => (
+ <SelectItem key={mode.value} value={mode.value} title={mode.label}>
+ {mode.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+ <FormField control={submitForm.control} name="api_base" label="API Base URL">
+ {({ ref, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ placeholder="https://your-guardrail-api.com/v1/check"
+ className="font-mono"
+ />
+ )}
+ </FormField>
+ <FormField
+ control={submitForm.control}
+ name="extra_litellm_params"
+ label={labelWithHint(
+ "Additional litellm_params (optional)",
+ "JSON object merged into litellm_params. e.g. forward_api_key, headers, model, unreachable_fallback",
+ )}
+ >
+ {({ ref, ...field }) => (
+ <Textarea
+ {...field}
+ ref={ref}
+ rows={3}
+ className="font-mono text-xs"
+ placeholder='{"forward_api_key": true, "headers": {"X-Custom": "value"}}'
+ />
+ )}
+ </FormField>
+ <FormField control={submitForm.control} name="guardrail_info" label="Guardrail Info (optional)">
+ {({ ref, ...field }) => (
+ <Textarea
+ {...field}
+ ref={ref}
+ rows={3}
+ className="font-mono text-xs"
+ placeholder='{"description": "Detects PII in requests"}'
+ />
+ )}
+ </FormField>
+ </FieldGroup>
+ </form>
+ </TooltipProvider>
+ <DialogFooter>
+ <Button
+ variant="outline"
+ onClick={() => {
+ setIsSubmitModalOpen(false);
+ submitForm.reset();
+ }}
+ >
+ Cancel
+ </Button>
+ <Button onClick={handleSubmitGuardrail}>Submit for Review</Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</div>
);
}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx
index c1b419d013d..aadc9ec0213 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx
@@ -1,7 +1,7 @@
import React from "react";
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "@/../tests/test-utils";
+import { chooseSelectOption, renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
import AddGuardrailForm from "./add_guardrail_form";
@@ -252,14 +252,13 @@ describe("AddGuardrailForm create payload characterization", () => {
await user.type(await screen.findByLabelText("Guardrail Name"), "my-bedrock");
await pickProvider(user, "Bedrock Guardrail");
- await user.click(screen.getByLabelText("Always On"));
- await user.click((await screen.findAllByText("Yes")).at(-1) as HTMLElement);
-
- await user.click(screen.getByLabelText("Skip system messages in guardrail"));
- await user.click((await screen.findAllByText(/exclude from guardrail scan/)).at(-1) as HTMLElement);
-
- await user.click(screen.getByLabelText("Skip tool messages in guardrail"));
- await user.click((await screen.findAllByText(/always include in scan/)).at(-1) as HTMLElement);
+ await chooseSelectOption(user, screen.getByLabelText("Always On"), "Yes");
+ await chooseSelectOption(
+ user,
+ screen.getByLabelText("Skip system messages in guardrail"),
+ /exclude from guardrail scan/,
+ );
+ await chooseSelectOption(user, screen.getByLabelText("Skip tool messages in guardrail"), /always include in scan/);
await user.type(await screen.findByPlaceholderText("The guardrail id on Bedrock"), "gr-123");
await user.click(screen.getByRole("button", { name: "Next" }));
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx
index e8463025e31..8ca4aba91c5 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx
@@ -26,12 +26,11 @@ describe("AddGuardrailForm close behavior", () => {
const { onClose } = renderForm();
expect(screen.getByText("Create guardrail")).toBeInTheDocument();
- // eslint-disable-next-line local/no-antd-class-selectors -- exercises antd Modal mask dismissal; the mask has no role and is not reachable by an accessible query
- const wrap = document.querySelector(".ant-modal-wrap") as HTMLElement;
- expect(wrap).toBeTruthy();
- fireEvent.mouseDown(wrap);
- fireEvent.mouseUp(wrap);
- fireEvent.click(wrap);
+ const backdrop = document.querySelector('[data-slot="dialog-overlay"]') as HTMLElement;
+ expect(backdrop).toBeTruthy();
+ fireEvent.mouseDown(backdrop);
+ fireEvent.mouseUp(backdrop);
+ fireEvent.click(backdrop);
expect(onClose).not.toHaveBeenCalled();
});
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx
index 0ca852feb52..fc09ff1a763 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx
@@ -1,4 +1,3 @@
-import { Modal } from "antd";
import React, { useEffect, useMemo, useState } from "react";
import { useForm, type UseFormReturn } from "react-hook-form";
import { toast } from "@/lib/toast";
@@ -57,6 +56,7 @@ import GuardrailProviderFields from "./guardrail_provider_fields";
import LLMJudgeFields from "./llm_judge/LLMJudgeFields";
import PiiConfiguration from "./pii_configuration";
import ToolPermissionRulesEditor, { ToolPermissionConfig } from "./tool_permission/ToolPermissionRulesEditor";
+import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
// Define human-friendly descriptions for each mode
const modeDescriptions = {
@@ -1092,107 +1092,102 @@ const AddGuardrailForm: React.FC<AddGuardrailFormProps> = ({ visible, onClose, a
const stepConfigs = getStepConfigs();
return (
- <Modal
- title={null}
- open={visible}
- onCancel={handleClose}
- maskClosable={false}
- footer={null}
- width={1000}
- closable={false}
- className="top-8"
- styles={{
- body: { padding: 0 },
- }}
- >
- <TooltipProvider>
- <div className="flex flex-col">
- {/* Header */}
- <div className="flex items-center justify-between border-b border-border px-6 py-4">
- <h3 className="m-0 text-base font-semibold text-foreground">Create guardrail</h3>
- <button
- type="button"
- onClick={handleClose}
- className="cursor-pointer border-none bg-transparent p-1 text-base leading-none text-muted-foreground hover:text-foreground"
- >
- &#x2715;
- </button>
- </div>
-
- {/* Scrollable content - inline vertical stepper */}
- <div className="max-h-[calc(80vh-120px)] overflow-auto px-6 py-4">
- <form onSubmit={(event) => event.preventDefault()}>
- {stepConfigs.map((step, index) => {
- const isDone = index < currentStep;
- const isCurrent = index === currentStep;
- const isLast = index === stepConfigs.length - 1;
- return (
- <div key={index} className={`relative flex gap-4 ${isLast ? "" : "pb-2"}`}>
- {/* Vertical line + step indicator */}
- <div className="flex w-6 shrink-0 flex-col items-center">
- <div
- className={`flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-medium ${getStepIndicatorClass(isDone, isCurrent)}`}
- >
- {isDone ? "\u2713" : index + 1}
- </div>
- {!isLast && (
+ <Dialog open={visible} onOpenChange={(open) => !open && handleClose()} disablePointerDismissal>
+ <DialogContent
+ className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-[1000px]"
+ showCloseButton={false}
+ >
+ <TooltipProvider>
+ <div className="flex flex-col">
+ {/* Header */}
+ <div className="flex items-center justify-between border-b border-border px-6 py-4">
+ <DialogTitle className="m-0 text-base font-semibold text-foreground">Create guardrail</DialogTitle>
+ <button
+ type="button"
+ onClick={handleClose}
+ className="cursor-pointer border-none bg-transparent p-1 text-base leading-none text-muted-foreground hover:text-foreground"
+ >
+ &#x2715;
+ </button>
+ </div>
+
+ {/* Scrollable content - inline vertical stepper */}
+ <div className="max-h-[calc(80vh-120px)] overflow-auto px-6 py-4">
+ <form onSubmit={(event) => event.preventDefault()}>
+ {stepConfigs.map((step, index) => {
+ const isDone = index < currentStep;
+ const isCurrent = index === currentStep;
+ const isLast = index === stepConfigs.length - 1;
+ return (
+ <div key={index} className={`relative flex gap-4 ${isLast ? "" : "pb-2"}`}>
+ {/* Vertical line + step indicator */}
+ <div className="flex w-6 shrink-0 flex-col items-center">
<div
- className={`min-h-4 w-px flex-1 ${isDone ? "bg-indigo-600 dark:bg-indigo-500" : "bg-border"}`}
- />
- )}
- </div>
-
- {/* Step content */}
- <div className={`min-w-0 flex-1 ${isLast ? "" : "pb-4"}`}>
- {/* Step header - clickable for completed steps */}
- <div
- className={`flex min-h-6 items-center gap-2 ${isDone ? "cursor-pointer" : ""}`}
- onClick={() => {
- if (isDone) setCurrentStep(index);
- }}
- >
- <span className={`text-sm ${getStepTitleClass(isDone, isCurrent)}`}>{step.title}</span>
- {step.optional && !isCurrent && (
- <span className="text-[11px] text-muted-foreground">optional</span>
- )}
- {isDone && (
- <span className="text-[11px] text-indigo-600 hover:underline dark:text-indigo-400">Edit</span>
+ className={`flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-medium ${getStepIndicatorClass(isDone, isCurrent)}`}
+ >
+ {isDone ? "\u2713" : index + 1}
+ </div>
+ {!isLast && (
+ <div
+ className={`min-h-4 w-px flex-1 ${isDone ? "bg-indigo-600 dark:bg-indigo-500" : "bg-border"}`}
+ />
)}
</div>
- {/* Expanded form content for current step */}
- {isCurrent && <div className="mt-3">{renderStepContent()}</div>}
- </div>
- </div>
- );
- })}
- </form>
- </div>
+ {/* Step content */}
+ <div className={`min-w-0 flex-1 ${isLast ? "" : "pb-4"}`}>
+ {/* Step header - clickable for completed steps */}
+ <div
+ className={`flex min-h-6 items-center gap-2 ${isDone ? "cursor-pointer" : ""}`}
+ onClick={() => {
+ if (isDone) setCurrentStep(index);
+ }}
+ >
+ <span className={`text-sm ${getStepTitleClass(isDone, isCurrent)}`}>{step.title}</span>
+ {step.optional && !isCurrent && (
+ <span className="text-[11px] text-muted-foreground">optional</span>
+ )}
+ {isDone && (
+ <span className="text-[11px] text-indigo-600 hover:underline dark:text-indigo-400">
+ Edit
+ </span>
+ )}
+ </div>
- {/* Bottom bar */}
- <div className="flex items-center justify-end space-x-3 border-t border-border px-6 py-3">
- <Button type="button" variant="outline" onClick={handleClose}>
- Cancel
- </Button>
- {currentStep > 0 && (
- <Button type="button" variant="outline" onClick={prevStep}>
- Previous
- </Button>
- )}
- {currentStep < stepConfigs.length - 1 ? (
- <Button type="button" onClick={nextStep}>
- Next
- </Button>
- ) : (
- <Button type="button" onClick={handleSubmit} disabled={loading}>
- {loading && <UiLoadingSpinner className="size-4" />}
- Create Guardrail
+ {/* Expanded form content for current step */}
+ {isCurrent && <div className="mt-3">{renderStepContent()}</div>}
+ </div>
+ </div>
+ );
+ })}
+ </form>
+ </div>
+
+ {/* Bottom bar */}
+ <div className="flex items-center justify-end space-x-3 border-t border-border px-6 py-3">
+ <Button type="button" variant="outline" onClick={handleClose}>
+ Cancel
</Button>
- )}
+ {currentStep > 0 && (
+ <Button type="button" variant="outline" onClick={prevStep}>
+ Previous
+ </Button>
+ )}
+ {currentStep < stepConfigs.length - 1 ? (
+ <Button type="button" onClick={nextStep}>
+ Next
+ </Button>
+ ) : (
+ <Button type="button" onClick={handleSubmit} disabled={loading}>
+ {loading && <UiLoadingSpinner className="size-4" />}
+ Create Guardrail
+ </Button>
+ )}
+ </div>
</div>
- </div>
- </TooltipProvider>
- </Modal>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.characterization.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.characterization.test.tsx
index d1b5c49bacd..5d16e899408 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.characterization.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.characterization.test.tsx
@@ -3,6 +3,7 @@ import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest";
import GuardrailInfoView from "./guardrail_info";
+import { chooseSelectOption } from "@/../tests/test-utils";
vi.mock("@/components/networking", () => ({
getGuardrailInfo: vi.fn(),
@@ -152,8 +153,11 @@ describe("GuardrailInfoView update payload characterization", () => {
renderView();
await openEditor(user);
- await user.click(screen.getByLabelText("Skip system messages in guardrail"));
- await user.click(await screen.findByText("Yes — exclude from guardrail scan"));
+ await chooseSelectOption(
+ user,
+ screen.getByLabelText("Skip system messages in guardrail"),
+ /exclude from guardrail scan/,
+ );
await saveChanges(user);
await waitFor(() => expect(networking.updateGuardrailCall).toHaveBeenCalledTimes(1));
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx
index 29887989cb7..11f7a5f7f90 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.integration.test.tsx
@@ -1883,15 +1883,15 @@ describe("CreateMCPServer", () => {
// Parent dismisses the modal without routing through Cancel or create.
rerender(<CreateMCPServer {...defaultProps} isModalVisible={false} />);
- // Stale tools are cleared even though neither handler ran.
await waitFor(() => {
- expect(toolCount()).toBe("0");
+ expect(screen.queryByTestId("mcp-connection-status")).not.toBeInTheDocument();
});
- // Reopening starts clean: the URL the prior server left in the Ant form store is gone.
+ // Reopening starts clean: neither the prior server's URL nor its tool list survives.
rerender(<CreateMCPServer {...defaultProps} isModalVisible={true} />);
const reopenedUrlInput = screen.getByPlaceholderText("https://your-mcp-server.com") as HTMLInputElement;
expect(reopenedUrlInput.value).toBe("");
+ expect(toolCount()).toBe("0");
});
it("does not reset an in-flight OAuth resume when mounted with the modal closed (post-redirect restore)", () => {
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.tsx
index 92bdd14754c..5233081fc39 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/CreateMCPServer.tsx
@@ -1,5 +1,5 @@
import React, { useState } from "react";
-import { Modal, Tooltip, Select, Input as AntdInput, InputNumber, Collapse } from "antd";
+import { Tooltip, Select, Input as AntdInput, InputNumber, Collapse } from "antd";
import { FormProvider, useForm, useWatch } from "react-hook-form";
import { InfoCircleOutlined } from "@ant-design/icons";
import { Button } from "@/components/ui/button";
@@ -61,6 +61,7 @@ import { antdRequired, antdRules } from "@/components/common_components/antdForm
import { allFieldsValue, mountedPaths, resetFields, setFieldsValue, singleBranchChange } from "./mcpFormStore";
import { numberControl, notOnlyWhitespace, selectControl, textControl } from "./mcpFieldRules";
import mcpLogo from "../../../../../public/assets/logos/mcp_logo.png";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
export const mcpLogoImg = mcpLogo.src;
@@ -643,411 +644,404 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
// rendering
return (
- <Modal
- title={
- <div className="flex items-center pb-4 border-b border-gray-100" style={{ gap: 12 }}>
- {onBackToDiscovery && (
- <button
- onClick={onBackToDiscovery}
- className="text-sm text-blue-600 hover:text-blue-800 cursor-pointer bg-transparent border-none"
- style={{ flexShrink: 0 }}
- >
- &#8592;
- </button>
- )}
- <img
- src={mcpLogoImg}
- alt="MCP Logo"
- className="w-8 h-8 object-contain"
- style={{
- height: "20px",
- width: "20px",
- objectFit: "contain",
- }}
- />
- <h2 className="text-xl font-semibold text-gray-900">
- {isAdmin ? "Add New MCP Server" : "Submit MCP Server for Review"}
- </h2>
- </div>
- }
- open={isModalVisible}
- width={1000}
- onCancel={handleCancel}
- footer={null}
- forceRender
- className="top-8"
- styles={{
- body: { padding: "24px" },
- header: { padding: "24px 24px 0 24px", border: "none" },
- }}
- >
- <div className="mt-6">
- <FormProvider {...form}>
- <MountedFormProvider value={{ control: form.control, registry }}>
- <form onSubmit={handleSubmit} className="space-y-6">
- {!isAdmin && (
- <div className="rounded-md bg-blue-50 border border-blue-200 px-4 py-3 text-sm text-blue-800">
- Your submission will be sent for admin review. Once approved, the server will appear in your MCP
- Servers list. The request must be made with a team-scoped API key.
- </div>
- )}
- <div className="grid grid-cols-1 gap-6">
- <MountedFormField
- label={
- <span className="text-sm font-medium text-gray-700 flex items-center">
- MCP Server Name
- <Tooltip title="Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Cannot contain spaces or hyphens; use underscores instead. Names must comply with SEP-986 and will be rejected if invalid (https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names).">
- <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
- </Tooltip>
- </span>
- }
- name="server_name"
- rules={{ validate: antdRules({ validator: (_, value) => validateMCPServerName(value) }) }}
- >
- {(control) => (
- <Input
- {...textControl(control)}
- placeholder="e.g., GitHub_MCP, Zapier_MCP, etc."
- className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
- />
- )}
- </MountedFormField>
-
- <MountedFormField
- label={
- <span className="text-sm font-medium text-gray-700 flex items-center">
- Alias
- <Tooltip title="A short, unique identifier for this server. Defaults to the server name if not provided. Cannot contain spaces or hyphens; use underscores instead.">
- <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
- </Tooltip>
- </span>
- }
- name="alias"
- rules={{ validate: antdRules({ validator: (_, value) => validateMCPServerName(value) }) }}
- >
- {(control) => (
- <Input
- {...textControl(control)}
- placeholder="e.g., GitHub_MCP, Zapier_MCP, etc."
- className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
- onChange={(event) => {
- control.onChange(event);
- setAliasManuallyEdited(true);
- }}
- />
- )}
- </MountedFormField>
-
- <MountedFormField
- label={<span className="text-sm font-medium text-gray-700">Description</span>}
- name="description"
- >
- {(control) => (
- <Input
- {...textControl(control)}
- placeholder="Brief description of what this server does"
- className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
- />
- )}
- </MountedFormField>
-
- <MCPLogoSelector value={logoUrl} onChange={setLogoUrl} />
-
- <MountedFormField
- label={<span className="text-sm font-medium text-gray-700">GitHub / Source URL</span>}
- name="source_url"
- >
- {(control) => (
- <Input
- {...textControl(control)}
- placeholder="https://github.com/org/mcp-server"
- className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
- />
- )}
- </MountedFormField>
-
- <MountedFormField
- label={<span className="text-sm font-medium text-gray-700">Transport Type</span>}
- name="transport"
- required
- rules={{ validate: { required: antdRequired("Please select a transport type") } }}
- >
- {(control) => (
- <Select
- {...selectControl<string>(control)}
- placeholder="Select transport"
- className="rounded-lg"
- size="large"
- onChange={(value: string) => {
- control.onChange(value);
- handleTransportChange(value);
- }}
- >
- <Select.Option value="http">Streamable HTTP (Recommended)</Select.Option>
- <Select.Option value="sse">Server-Sent Events (SSE)</Select.Option>
- <Select.Option value="stdio">Standard Input/Output (stdio)</Select.Option>
- <Select.Option value={TRANSPORT.OPENAPI}>OpenAPI Spec</Select.Option>
- </Select>
- )}
- </MountedFormField>
-
- {/* URL field - only show for HTTP and SSE */}
- {(transportType === "http" || transportType === "sse") && (
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <div className="flex items-center pb-4 border-b border-gray-100" style={{ gap: 12 }}>
+ {onBackToDiscovery && (
+ <button
+ onClick={onBackToDiscovery}
+ className="text-sm text-blue-600 hover:text-blue-800 cursor-pointer bg-transparent border-none"
+ style={{ flexShrink: 0 }}
+ >
+ &#8592;
+ </button>
+ )}
+ <img
+ src={mcpLogoImg}
+ alt="MCP Logo"
+ className="w-8 h-8 object-contain"
+ style={{
+ height: "20px",
+ width: "20px",
+ objectFit: "contain",
+ }}
+ />
+ <DialogTitle className="text-xl font-semibold text-gray-900">
+ {isAdmin ? "Add New MCP Server" : "Submit MCP Server for Review"}
+ </DialogTitle>
+ </div>
+ </DialogHeader>
+ <div className="mt-6">
+ <FormProvider {...form}>
+ <MountedFormProvider value={{ control: form.control, registry }}>
+ <form onSubmit={handleSubmit} className="space-y-6">
+ {!isAdmin && (
+ <div className="rounded-md bg-blue-50 border border-blue-200 px-4 py-3 text-sm text-blue-800">
+ Your submission will be sent for admin review. Once approved, the server will appear in your MCP
+ Servers list. The request must be made with a team-scoped API key.
+ </div>
+ )}
+ <div className="grid grid-cols-1 gap-6">
<MountedFormField
- label={<span className="text-sm font-medium text-gray-700">MCP Server URL</span>}
- name="url"
- required
- rules={{
- validate: {
- required: antdRequired("Please enter a server URL"),
- ...antdRules({ validator: (_, value) => validateMCPServerUrl(value) }),
- },
- }}
+ label={
+ <span className="text-sm font-medium text-gray-700 flex items-center">
+ MCP Server Name
+ <Tooltip title="Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Cannot contain spaces or hyphens; use underscores instead. Names must comply with SEP-986 and will be rejected if invalid (https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names).">
+ <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
+ </Tooltip>
+ </span>
+ }
+ name="server_name"
+ rules={{ validate: antdRules({ validator: (_, value) => validateMCPServerName(value) }) }}
>
{(control) => (
- <AntdInput
+ <Input
{...textControl(control)}
- placeholder="https://your-mcp-server.com"
+ placeholder="e.g., GitHub_MCP, Zapier_MCP, etc."
className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
/>
)}
</MountedFormField>
- )}
- {/* OpenAPI: logo picker + spec URL input */}
- {transportType === TRANSPORT.OPENAPI && (
- <OpenAPIFormSection
- form={form}
- accessToken={isModalVisible ? accessToken : null}
- onValuesChange={(updates) =>
- handleFormValuesChange(updates, { ...allFieldsValue(form), ...updates })
+ <MountedFormField
+ label={
+ <span className="text-sm font-medium text-gray-700 flex items-center">
+ Alias
+ <Tooltip title="A short, unique identifier for this server. Defaults to the server name if not provided. Cannot contain spaces or hyphens; use underscores instead.">
+ <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
+ </Tooltip>
+ </span>
}
- onKeyToolsChange={setKeyTools}
- onLogoUrlChange={setLogoUrl}
- onOAuthDocsUrlChange={setOauthDocsUrl}
- />
- )}
+ name="alias"
+ rules={{ validate: antdRules({ validator: (_, value) => validateMCPServerName(value) }) }}
+ >
+ {(control) => (
+ <Input
+ {...textControl(control)}
+ placeholder="e.g., GitHub_MCP, Zapier_MCP, etc."
+ className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
+ onChange={(event) => {
+ control.onChange(event);
+ setAliasManuallyEdited(true);
+ }}
+ />
+ )}
+ </MountedFormField>
- {/* BYOK toggle - only for OpenAPI */}
- {transportType === TRANSPORT.OPENAPI && <OpenApiByokFields />}
-
- <MountedFormField
- label={
- <span className="text-sm font-medium text-gray-700 flex items-center">
- Max Concurrent Requests (optional)
- <Tooltip title="Maximum number of tool calls LiteLLM will run against this server at the same time. Additional calls wait for a free slot. Leave blank for no limit.">
- <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
- </Tooltip>
- </span>
- }
- name="max_concurrent_requests"
- >
- {(control) => (
- <InputNumber
- {...numberControl(control)}
- min={1}
- precision={0}
- placeholder="e.g. 10"
- style={{ width: "100%" }}
- className="rounded-lg"
+ <MountedFormField
+ label={<span className="text-sm font-medium text-gray-700">Description</span>}
+ name="description"
+ >
+ {(control) => (
+ <Input
+ {...textControl(control)}
+ placeholder="Brief description of what this server does"
+ className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
+ />
+ )}
+ </MountedFormField>
+
+ <MCPLogoSelector value={logoUrl} onChange={setLogoUrl} />
+
+ <MountedFormField
+ label={<span className="text-sm font-medium text-gray-700">GitHub / Source URL</span>}
+ name="source_url"
+ >
+ {(control) => (
+ <Input
+ {...textControl(control)}
+ placeholder="https://github.com/org/mcp-server"
+ className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
+ />
+ )}
+ </MountedFormField>
+
+ <MountedFormField
+ label={<span className="text-sm font-medium text-gray-700">Transport Type</span>}
+ name="transport"
+ required
+ rules={{ validate: { required: antdRequired("Please select a transport type") } }}
+ >
+ {(control) => (
+ <Select
+ {...selectControl<string>(control)}
+ placeholder="Select transport"
+ className="rounded-lg"
+ size="large"
+ onChange={(value: string) => {
+ control.onChange(value);
+ handleTransportChange(value);
+ }}
+ >
+ <Select.Option value="http">Streamable HTTP (Recommended)</Select.Option>
+ <Select.Option value="sse">Server-Sent Events (SSE)</Select.Option>
+ <Select.Option value="stdio">Standard Input/Output (stdio)</Select.Option>
+ <Select.Option value={TRANSPORT.OPENAPI}>OpenAPI Spec</Select.Option>
+ </Select>
+ )}
+ </MountedFormField>
+
+ {/* URL field - only show for HTTP and SSE */}
+ {(transportType === "http" || transportType === "sse") && (
+ <MountedFormField
+ label={<span className="text-sm font-medium text-gray-700">MCP Server URL</span>}
+ name="url"
+ required
+ rules={{
+ validate: {
+ required: antdRequired("Please enter a server URL"),
+ ...antdRules({ validator: (_, value) => validateMCPServerUrl(value) }),
+ },
+ }}
+ >
+ {(control) => (
+ <AntdInput
+ {...textControl(control)}
+ placeholder="https://your-mcp-server.com"
+ className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
+ />
+ )}
+ </MountedFormField>
+ )}
+
+ {/* OpenAPI: logo picker + spec URL input */}
+ {transportType === TRANSPORT.OPENAPI && (
+ <OpenAPIFormSection
+ form={form}
+ accessToken={isModalVisible ? accessToken : null}
+ onValuesChange={(updates) =>
+ handleFormValuesChange(updates, { ...allFieldsValue(form), ...updates })
+ }
+ onKeyToolsChange={setKeyTools}
+ onLogoUrlChange={setLogoUrl}
+ onOAuthDocsUrlChange={setOauthDocsUrl}
/>
)}
- </MountedFormField>
-
- {/* Authentication - show for HTTP, SSE, and OpenAPI */}
- {transportType !== "stdio" && transportType !== "" && (
- <Collapse
- defaultActiveKey={["auth"]}
- className="mb-4"
- items={[
- {
- key: "auth",
- label: <span className="text-sm font-semibold text-gray-700">Authentication</span>,
- children: (
- <>
- <MountedFormField
- name="auth_type"
- required
- rules={{ validate: { required: antdRequired("Please select an auth type") } }}
- >
- {(control) => (
- <Select
- {...selectControl<string>(control)}
- placeholder="Select auth type"
- className="rounded-lg"
- size="large"
- virtual={false}
- >
- <Select.Option value="none">None</Select.Option>
- <Select.Option value="api_key">API Key</Select.Option>
- <Select.Option value="bearer_token">Bearer Token</Select.Option>
- <Select.Option value="token">Token</Select.Option>
- <Select.Option value="basic">Basic Auth</Select.Option>
- <Select.Option value="oauth2">OAuth</Select.Option>
- <Select.Option value="oauth2_token_exchange">
- OAuth Token Exchange (OBO)
- </Select.Option>
- <Select.Option value="oauth2_id_jag">ID-JAG (Okta Cross App Access)</Select.Option>
- <Select.Option value="aws_sigv4">AWS SigV4 (Bedrock AgentCore MCPs)</Select.Option>
- <Select.Option value="true_passthrough">
- True Passthrough (no LiteLLM auth)
- </Select.Option>
- <Select.Option value="oauth_delegate">
- OAuth Delegate (client-supplied upstream token)
- </Select.Option>
- </Select>
- )}
- </MountedFormField>
-
- <TruePassthroughWarning authType={authType} />
-
- <PassthroughAuthorizeSection
- authType={authType}
- dcrBridgeInitialChecked
- oauthFlow={{
- startOAuthFlow,
- status: oauthStatus,
- error: oauthError,
- tokenResponse: oauthTokenResponse,
- }}
- appMayNotMatchUpstream={appMayNotMatchUpstream}
- />
-
- {shouldShowAuthValueField && (
+
+ {/* BYOK toggle - only for OpenAPI */}
+ {transportType === TRANSPORT.OPENAPI && <OpenApiByokFields />}
+
+ <MountedFormField
+ label={
+ <span className="text-sm font-medium text-gray-700 flex items-center">
+ Max Concurrent Requests (optional)
+ <Tooltip title="Maximum number of tool calls LiteLLM will run against this server at the same time. Additional calls wait for a free slot. Leave blank for no limit.">
+ <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
+ </Tooltip>
+ </span>
+ }
+ name="max_concurrent_requests"
+ >
+ {(control) => (
+ <InputNumber
+ {...numberControl(control)}
+ min={1}
+ precision={0}
+ placeholder="e.g. 10"
+ style={{ width: "100%" }}
+ className="rounded-lg"
+ />
+ )}
+ </MountedFormField>
+
+ {/* Authentication - show for HTTP, SSE, and OpenAPI */}
+ {transportType !== "stdio" && transportType !== "" && (
+ <Collapse
+ defaultActiveKey={["auth"]}
+ className="mb-4"
+ items={[
+ {
+ key: "auth",
+ label: <span className="text-sm font-semibold text-gray-700">Authentication</span>,
+ children: (
+ <>
<MountedFormField
- label={
- <span className="text-sm font-medium text-gray-700 flex items-center">
- Authentication Value
- <Tooltip title="Token, password, or header value to send with each request for the selected auth type.">
- <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
- </Tooltip>
- </span>
- }
- name={["credentials", "auth_value"]}
- rules={{
- validate: {
- notWhitespace: notOnlyWhitespace("Authentication value cannot be empty whitespace"),
- },
- }}
+ name="auth_type"
+ required
+ rules={{ validate: { required: antdRequired("Please select an auth type") } }}
>
{(control) => (
- <AntdInput.Password
- {...textControl(control)}
- placeholder="Enter token or secret"
- className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
- />
+ <Select
+ {...selectControl<string>(control)}
+ placeholder="Select auth type"
+ className="rounded-lg"
+ size="large"
+ virtual={false}
+ >
+ <Select.Option value="none">None</Select.Option>
+ <Select.Option value="api_key">API Key</Select.Option>
+ <Select.Option value="bearer_token">Bearer Token</Select.Option>
+ <Select.Option value="token">Token</Select.Option>
+ <Select.Option value="basic">Basic Auth</Select.Option>
+ <Select.Option value="oauth2">OAuth</Select.Option>
+ <Select.Option value="oauth2_token_exchange">
+ OAuth Token Exchange (OBO)
+ </Select.Option>
+ <Select.Option value="oauth2_id_jag">ID-JAG (Okta Cross App Access)</Select.Option>
+ <Select.Option value="aws_sigv4">AWS SigV4 (Bedrock AgentCore MCPs)</Select.Option>
+ <Select.Option value="true_passthrough">
+ True Passthrough (no LiteLLM auth)
+ </Select.Option>
+ <Select.Option value="oauth_delegate">
+ OAuth Delegate (client-supplied upstream token)
+ </Select.Option>
+ </Select>
)}
</MountedFormField>
- )}
- {isOAuthAuthType && (
- <OAuthFormFields
- isM2M={isM2MFlow}
- initialFlowType={OAUTH_FLOW.INTERACTIVE}
- docsUrl={oauthDocsUrl}
+ <TruePassthroughWarning authType={authType} />
+
+ <PassthroughAuthorizeSection
+ authType={authType}
+ dcrBridgeInitialChecked
oauthFlow={{
startOAuthFlow,
status: oauthStatus,
error: oauthError,
tokenResponse: oauthTokenResponse,
}}
+ appMayNotMatchUpstream={appMayNotMatchUpstream}
/>
- )}
- {isTokenExchangeAuthType && <TokenExchangeFormFields />}
+ {shouldShowAuthValueField && (
+ <MountedFormField
+ label={
+ <span className="text-sm font-medium text-gray-700 flex items-center">
+ Authentication Value
+ <Tooltip title="Token, password, or header value to send with each request for the selected auth type.">
+ <InfoCircleOutlined className="ml-2 text-blue-400 hover:text-blue-600 cursor-help" />
+ </Tooltip>
+ </span>
+ }
+ name={["credentials", "auth_value"]}
+ rules={{
+ validate: {
+ notWhitespace: notOnlyWhitespace(
+ "Authentication value cannot be empty whitespace",
+ ),
+ },
+ }}
+ >
+ {(control) => (
+ <AntdInput.Password
+ {...textControl(control)}
+ placeholder="Enter token or secret"
+ className="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"
+ />
+ )}
+ </MountedFormField>
+ )}
+
+ {isOAuthAuthType && (
+ <OAuthFormFields
+ isM2M={isM2MFlow}
+ initialFlowType={OAUTH_FLOW.INTERACTIVE}
+ docsUrl={oauthDocsUrl}
+ oauthFlow={{
+ startOAuthFlow,
+ status: oauthStatus,
+ error: oauthError,
+ tokenResponse: oauthTokenResponse,
+ }}
+ />
+ )}
+
+ {isTokenExchangeAuthType && <TokenExchangeFormFields />}
+
+ {isIdJagAuthType && <IdJagFormFields />}
+ </>
+ ),
+ },
+ ]}
+ />
+ )}
- {isIdJagAuthType && <IdJagFormFields />}
- </>
- ),
- },
- ]}
+ {transportType !== "stdio" && transportType !== "" && isAwsSigV4AuthType && <AwsSigV4Fields />}
+
+ {/* Stdio Configuration - only show for stdio transport */}
+ <StdioConfiguration isVisible={transportType === "stdio"} />
+ </div>
+
+ {/* Environment Variables Section */}
+ <div className="mt-8">
+ <EnvVarsSection />
+ </div>
+
+ {/* Permission Management / Access Control Section */}
+ <div className="mt-8">
+ <MCPPermissionManagement
+ availableAccessGroups={availableAccessGroups}
+ mcpServer={null}
+ mountedAuthType={authSectionMounted ? watchedAuthType : undefined}
+ searchValue={searchValue}
+ setSearchValue={setSearchValue}
+ getAccessGroupOptions={getAccessGroupOptions}
/>
- )}
+ </div>
+
+ {/* Connection Status Section */}
+ <div className="mt-8 pt-6 border-t border-gray-200">
+ <MCPConnectionStatus
+ formValues={formValues}
+ tools={tools}
+ isLoadingTools={isLoadingTools}
+ toolsError={toolsError}
+ toolsErrorStatus={toolsErrorStatus}
+ toolsErrorStackTrace={toolsErrorStackTrace}
+ canFetchTools={canFetchTools}
+ fetchTools={fetchTools}
+ />
+ </div>
+
+ {/* Tool Configuration Section */}
+ <div className="mt-6">
+ <MCPToolConfiguration
+ accessToken={accessToken}
+ formValues={formValues}
+ allowedTools={allowedTools}
+ existingAllowedTools={null}
+ onAllowedToolsChange={setAllowedTools}
+ hasToolAllowlistInteraction={hasToolAllowlistInteraction}
+ onToolAllowlistInteraction={() => setHasToolAllowlistInteraction(true)}
+ toolNameToDisplayName={toolNameToDisplayName}
+ toolNameToDescription={toolNameToDescription}
+ onToolNameToDisplayNameChange={setToolNameToDisplayName}
+ onToolNameToDescriptionChange={setToolNameToDescription}
+ keyTools={keyTools}
+ externalTools={tools}
+ externalIsLoading={isLoadingTools}
+ externalError={toolsError}
+ externalErrorStatus={toolsErrorStatus}
+ externalCanFetch={canFetchTools}
+ />
+ </div>
+
+ {/* Cost Configuration Section */}
+ <div className="mt-6">
+ <MCPServerCostConfig
+ value={costConfig}
+ onChange={setCostConfig}
+ tools={tools.filter((tool) => allowedTools.includes(tool.name))}
+ disabled={false}
+ />
+ </div>
- {transportType !== "stdio" && transportType !== "" && isAwsSigV4AuthType && <AwsSigV4Fields />}
-
- {/* Stdio Configuration - only show for stdio transport */}
- <StdioConfiguration isVisible={transportType === "stdio"} />
- </div>
-
- {/* Environment Variables Section */}
- <div className="mt-8">
- <EnvVarsSection />
- </div>
-
- {/* Permission Management / Access Control Section */}
- <div className="mt-8">
- <MCPPermissionManagement
- availableAccessGroups={availableAccessGroups}
- mcpServer={null}
- mountedAuthType={authSectionMounted ? watchedAuthType : undefined}
- searchValue={searchValue}
- setSearchValue={setSearchValue}
- getAccessGroupOptions={getAccessGroupOptions}
- />
- </div>
-
- {/* Connection Status Section */}
- <div className="mt-8 pt-6 border-t border-gray-200">
- <MCPConnectionStatus
- formValues={formValues}
- tools={tools}
- isLoadingTools={isLoadingTools}
- toolsError={toolsError}
- toolsErrorStatus={toolsErrorStatus}
- toolsErrorStackTrace={toolsErrorStackTrace}
- canFetchTools={canFetchTools}
- fetchTools={fetchTools}
- />
- </div>
-
- {/* Tool Configuration Section */}
- <div className="mt-6">
- <MCPToolConfiguration
- accessToken={accessToken}
- formValues={formValues}
- allowedTools={allowedTools}
- existingAllowedTools={null}
- onAllowedToolsChange={setAllowedTools}
- hasToolAllowlistInteraction={hasToolAllowlistInteraction}
- onToolAllowlistInteraction={() => setHasToolAllowlistInteraction(true)}
- toolNameToDisplayName={toolNameToDisplayName}
- toolNameToDescription={toolNameToDescription}
- onToolNameToDisplayNameChange={setToolNameToDisplayName}
- onToolNameToDescriptionChange={setToolNameToDescription}
- keyTools={keyTools}
- externalTools={tools}
- externalIsLoading={isLoadingTools}
- externalError={toolsError}
- externalErrorStatus={toolsErrorStatus}
- externalCanFetch={canFetchTools}
- />
- </div>
-
- {/* Cost Configuration Section */}
- <div className="mt-6">
- <MCPServerCostConfig
- value={costConfig}
- onChange={setCostConfig}
- tools={tools.filter((tool) => allowedTools.includes(tool.name))}
- disabled={false}
- />
- </div>
-
- <div className="flex items-center justify-end space-x-3 pt-6 border-t border-gray-100">
- <Button variant="secondary" onClick={handleCancel}>
- Cancel
- </Button>
- <Button type="submit" disabled={isLoading} aria-busy={isLoading}>
- {isLoading && <UiLoadingSpinner className="size-4" />}
- {isLoading ? "Creating..." : "Add MCP Server"}
- </Button>
- </div>
- </form>
- </MountedFormProvider>
- </FormProvider>
- </div>
- </Modal>
+ <div className="flex items-center justify-end space-x-3 pt-6 border-t border-gray-100">
+ <Button variant="secondary" onClick={handleCancel}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={isLoading} aria-busy={isLoading}>
+ {isLoading && <UiLoadingSpinner className="size-4" />}
+ {isLoading ? "Creating..." : "Add MCP Server"}
+ </Button>
+ </div>
+ </form>
+ </MountedFormProvider>
+ </FormProvider>
+ </div>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/MCPToolsetsTab.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/MCPToolsetsTab.tsx
index 8d0901d7176..d61d6056972 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/MCPToolsetsTab.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/MCPToolsetsTab.tsx
@@ -1,5 +1,5 @@
import React, { useState, useCallback } from "react";
-import { Modal, Input, message, Spin } from "antd";
+import { Input, message, Spin } from "antd";
import { z } from "zod/v4";
import { SortingState } from "@tanstack/react-table";
import { Inbox, Plus } from "lucide-react";
@@ -22,6 +22,7 @@ import { Input as ShadcnInput } from "@/components/ui/input";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { useZodForm } from "@/lib/forms/useZodForm";
import { displayToolName, getMCPToolsetTableColumns } from "./MCPToolsetTableColumns";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface MCPToolsetsTabProps {
accessToken: string | null;
@@ -203,106 +204,104 @@ function CreateToolsetModal({ open, onClose, onSave, accessToken, initialToolset
});
return (
- <Modal
- open={open}
- onCancel={onClose}
- title={initialToolset ? "Edit Toolset" : "New Toolset"}
- width={960}
- footer={null}
- forceRender
- >
- <form onSubmit={(event) => event.preventDefault()} className="mt-2">
- <FieldGroup className="mb-4 flex-row gap-4">
- <FormField control={form.control} name="toolset_name" label="Toolset Name" className="flex-1">
- {(field) => <ShadcnInput {...field} placeholder="e.g. github-linear-tools" />}
- </FormField>
- <FormField control={form.control} name="description" label="Description" className="flex-1">
- {(field) => <ShadcnInput {...field} placeholder="Optional description" />}
- </FormField>
- </FieldGroup>
- </form>
-
- <div className="flex gap-4 mt-2" style={{ minHeight: 360 }}>
- {/* Left panel: Available Tools */}
- <div className="flex-1 min-w-0">
- <div className="flex items-center justify-between mb-2">
- <p className="text-sm font-semibold text-foreground">Available Tools</p>
- </div>
- <Input
- placeholder="Search MCP servers..."
- value={serverSearch}
- onChange={(e) => setServerSearch(e.target.value)}
- className="mb-2"
- allowClear
- />
- <div className="space-y-2 overflow-y-auto" style={{ maxHeight: 300 }}>
- {filteredServers.length === 0 ? (
- <p className="text-muted-foreground text-sm">
- {mcpServers.length === 0 ? "No MCP servers configured" : "No servers match your search"}
- </p>
- ) : (
- filteredServers.map((server) => (
- <MCPToolList
- key={server.server_id}
- serverId={server.server_id}
- serverName={server.alias || server.server_name || server.server_id}
- accessToken={accessToken}
- selectedTools={selectedTools}
- onToggle={handleToggleTool}
- />
- ))
- )}
+ <Dialog open={open} onOpenChange={(open) => !open && onClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[960px]">
+ <DialogHeader>
+ <DialogTitle>{initialToolset ? "Edit Toolset" : "New Toolset"}</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={(event) => event.preventDefault()} className="mt-2">
+ <FieldGroup className="mb-4 flex-row gap-4">
+ <FormField control={form.control} name="toolset_name" label="Toolset Name" className="flex-1">
+ {(field) => <ShadcnInput {...field} placeholder="e.g. github-linear-tools" />}
+ </FormField>
+ <FormField control={form.control} name="description" label="Description" className="flex-1">
+ {(field) => <ShadcnInput {...field} placeholder="Optional description" />}
+ </FormField>
+ </FieldGroup>
+ </form>
+
+ <div className="flex gap-4 mt-2" style={{ minHeight: 360 }}>
+ {/* Left panel: Available Tools */}
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center justify-between mb-2">
+ <p className="text-sm font-semibold text-foreground">Available Tools</p>
+ </div>
+ <Input
+ placeholder="Search MCP servers..."
+ value={serverSearch}
+ onChange={(e) => setServerSearch(e.target.value)}
+ className="mb-2"
+ allowClear
+ />
+ <div className="space-y-2 overflow-y-auto" style={{ maxHeight: 300 }}>
+ {filteredServers.length === 0 ? (
+ <p className="text-muted-foreground text-sm">
+ {mcpServers.length === 0 ? "No MCP servers configured" : "No servers match your search"}
+ </p>
+ ) : (
+ filteredServers.map((server) => (
+ <MCPToolList
+ key={server.server_id}
+ serverId={server.server_id}
+ serverName={server.alias || server.server_name || server.server_id}
+ accessToken={accessToken}
+ selectedTools={selectedTools}
+ onToggle={handleToggleTool}
+ />
+ ))
+ )}
+ </div>
</div>
- </div>
-
- {/* Divider */}
- <div className="w-px bg-border shrink-0" />
- {/* Right panel: Your Toolset */}
- <div className="w-72 shrink-0">
- <p className="text-sm font-semibold text-foreground mb-2 block">
- Your Toolset{" "}
- <span className="text-xs font-normal text-muted-foreground">({selectedTools.length} tools)</span>
- </p>
- <div className="space-y-1 overflow-y-auto" style={{ maxHeight: 340 }}>
- {selectedTools.length === 0 ? (
- <p className="text-muted-foreground text-sm">No tools added yet</p>
- ) : (
- selectedTools.map((tool, idx) => (
- <button
- key={idx}
- type="button"
- onClick={() => handleToggleTool(tool)}
- className="w-full flex items-center justify-between px-3 py-1.5 rounded-lg border border-purple-200 bg-purple-50 hover:bg-red-50 hover:border-red-200 group transition-colors dark:border-purple-800 dark:bg-purple-950 dark:hover:bg-red-950 dark:hover:border-red-800"
- >
- <div className="min-w-0 text-left">
- <span className="text-xs font-medium text-purple-800 group-hover:text-red-600 truncate block dark:text-purple-200 dark:group-hover:text-red-400">
- {displayToolName(serverPrefixById.get(tool.server_id), tool.tool_name)}
- </span>
- <span className="text-[10px] text-purple-400 truncate block dark:text-purple-500">
- {tool.server_id.slice(0, 8)}…
+ {/* Divider */}
+ <div className="w-px bg-border shrink-0" />
+
+ {/* Right panel: Your Toolset */}
+ <div className="w-72 shrink-0">
+ <p className="text-sm font-semibold text-foreground mb-2 block">
+ Your Toolset{" "}
+ <span className="text-xs font-normal text-muted-foreground">({selectedTools.length} tools)</span>
+ </p>
+ <div className="space-y-1 overflow-y-auto" style={{ maxHeight: 340 }}>
+ {selectedTools.length === 0 ? (
+ <p className="text-muted-foreground text-sm">No tools added yet</p>
+ ) : (
+ selectedTools.map((tool, idx) => (
+ <button
+ key={idx}
+ type="button"
+ onClick={() => handleToggleTool(tool)}
+ className="w-full flex items-center justify-between px-3 py-1.5 rounded-lg border border-purple-200 bg-purple-50 hover:bg-red-50 hover:border-red-200 group transition-colors dark:border-purple-800 dark:bg-purple-950 dark:hover:bg-red-950 dark:hover:border-red-800"
+ >
+ <div className="min-w-0 text-left">
+ <span className="text-xs font-medium text-purple-800 group-hover:text-red-600 truncate block dark:text-purple-200 dark:group-hover:text-red-400">
+ {displayToolName(serverPrefixById.get(tool.server_id), tool.tool_name)}
+ </span>
+ <span className="text-[10px] text-purple-400 truncate block dark:text-purple-500">
+ {tool.server_id.slice(0, 8)}…
+ </span>
+ </div>
+ <span className="ml-2 text-purple-300 group-hover:text-red-400 text-xs shrink-0 dark:text-purple-600">
+ ✕
</span>
- </div>
- <span className="ml-2 text-purple-300 group-hover:text-red-400 text-xs shrink-0 dark:text-purple-600">
- ✕
- </span>
- </button>
- ))
- )}
+ </button>
+ ))
+ )}
+ </div>
</div>
</div>
- </div>
- <div className="flex justify-end gap-2 mt-4 pt-4 border-t border-border">
- <Button variant="outline" onClick={onClose}>
- Cancel
- </Button>
- <Button onClick={() => void form.handleSubmit(handleSubmit)()} disabled={saving} aria-busy={saving}>
- {saving && <UiLoadingSpinner className="size-4" />}
- {initialToolset ? "Save Changes" : "Create Toolset"}
- </Button>
- </div>
- </Modal>
+ <div className="flex justify-end gap-2 mt-4 pt-4 border-t border-border">
+ <Button variant="outline" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button onClick={() => void form.handleSubmit(handleSubmit)()} disabled={saving} aria-busy={saving}>
+ {saving && <UiLoadingSpinner className="size-4" />}
+ {initialToolset ? "Save Changes" : "Create Toolset"}
+ </Button>
+ </div>
+ </DialogContent>
+ </Dialog>
);
}
@@ -472,18 +471,24 @@ export function MCPToolsetsTab({ accessToken, userRole }: MCPToolsetsTabProps) {
/>
)}
- <Modal
- open={!!deleteId}
- onCancel={() => setDeleteId(null)}
- onOk={handleDelete}
- okText="Delete"
- okButtonProps={{ danger: true, loading: deleting }}
- title="Delete Toolset"
- >
- <p>
- Are you sure you want to delete this toolset? Keys and teams using it will lose access to the scoped tools.
- </p>
- </Modal>
+ <Dialog open={!!deleteId} onOpenChange={(open) => !open && setDeleteId(null)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Delete Toolset</DialogTitle>
+ </DialogHeader>
+ <p>
+ Are you sure you want to delete this toolset? Keys and teams using it will lose access to the scoped tools.
+ </p>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setDeleteId(null)}>
+ Cancel
+ </Button>
+ <Button onClick={handleDelete} variant="destructive" disabled={deleting} aria-busy={deleting}>
+ Delete
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</div>
);
}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.integration.test.tsx
index ee9efdd3e72..daf53ed9291 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.integration.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.integration.test.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import { fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
import userEvent, { PointerEventsCheckLevel } from "@testing-library/user-event";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -23,21 +23,27 @@ const statusWith = (required: MCPUserEnvVarsStatus["required"]): MCPUserEnvVarsS
const renderModal = (status: MCPUserEnvVarsStatus, onSaved = vi.fn(), onClose = vi.fn()) => {
vi.mocked(networking.getMCPUserEnvVars).mockResolvedValue(status);
- render(
+ const view = render(
<QueryClientProvider client={createQueryClient()}>
<UserEnvVarsModal server={server} open accessToken="sk-test" onClose={onClose} onSaved={onSaved} />
</QueryClientProvider>,
);
- return { onSaved, onClose };
+ const setOpen = (open: boolean) =>
+ view.rerender(
+ <QueryClientProvider client={createQueryClient()}>
+ <UserEnvVarsModal server={server} open={open} accessToken="sk-test" onClose={onClose} onSaved={onSaved} />
+ </QueryClientProvider>,
+ );
+ return { onSaved, onClose, setOpen };
};
const save = (user: ReturnType<typeof setup>) => user.click(screen.getByRole("button", { name: "Save Credentials" }));
+// Opening the modal remounts the form so nothing carries over from the last time it was open.
+// Settle that remount before handing back a node, or the caller holds a detached one.
const fieldAfterOpen = async (label: RegExp): Promise<HTMLElement> => {
- const initial = await screen.findByLabelText(label);
- await waitFor(() => {
- expect(initial).not.toBeInTheDocument();
- });
+ await screen.findByLabelText(label);
+ await act(async () => {});
return screen.getByLabelText(label);
};
@@ -149,6 +155,22 @@ describe("UserEnvVarsModal", () => {
expect(screen.getByLabelText(/^API_KEY/)).toHaveAttribute("type", "password");
});
+ it("starts from a blank form each time it is opened", async () => {
+ const { setOpen } = renderModal(statusWith([{ name: "API_KEY", description: null, is_set: false }]));
+
+ const input = await fieldAfterOpen(/^API_KEY/);
+ fireEvent.change(input, { target: { value: "hunter2" } });
+ expect(screen.getByLabelText(/^API_KEY/)).toHaveValue("hunter2");
+
+ setOpen(false);
+ await waitFor(() => {
+ expect(screen.queryByLabelText(/^API_KEY/)).not.toBeInTheDocument();
+ });
+
+ setOpen(true);
+ expect(await fieldAfterOpen(/^API_KEY/)).toHaveValue("");
+ });
+
it("reports the empty state instead of a form when nothing is required", async () => {
renderModal(statusWith([]));
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.tsx
index f8595ccf460..e494af11c04 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/mcp-servers/_components/UserEnvVarsModal.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import { Modal, Spin, Tag, Typography } from "antd";
+import { Spin, Tag, Typography } from "antd";
import { CircleAlert, Info } from "lucide-react";
import { Alert, AlertTitle } from "@/components/shared/Alert";
import { useMutation, useQuery } from "@tanstack/react-query";
@@ -11,10 +11,11 @@ import { FieldGroup } from "@/components/shared/form/field";
import { FormField } from "@/components/shared/form/FormField";
import { PasswordInput } from "@/components/shared/PasswordInput";
import { Button } from "@/components/ui/button";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { useZodForm } from "@/lib/forms/useZodForm";
-const { Text, Title } = Typography;
+const { Text } = Typography;
interface UserEnvVarsModalProps {
server: MCPServer | null;
@@ -93,8 +94,6 @@ const UserEnvVarsForm: React.FC<UserEnvVarsFormProps> = ({ required, isSaving, o
* description as the placeholder.
*/
const UserEnvVarsModal: React.FC<UserEnvVarsModalProps> = ({ server, open, accessToken, onClose, onSaved }) => {
- const [formGeneration, setFormGeneration] = React.useState(0);
-
const {
data: status,
isLoading,
@@ -131,62 +130,45 @@ const UserEnvVarsModal: React.FC<UserEnvVarsModalProps> = ({ server, open, acces
const isSaving = saveMutation.isPending;
return (
- <Modal
- open={open}
- onCancel={onClose}
- footer={null}
- width={520}
- destroyOnHidden
- afterOpenChange={(opened) => {
- if (opened) setFormGeneration((generation) => generation + 1);
- }}
- title={
- <div>
+ <Dialog open={open} onOpenChange={(nextOpen) => !nextOpen && onClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[520px]">
+ <DialogHeader>
<div className="flex items-center gap-2">
- <Title level={5} style={{ margin: 0 }}>
- Set your credentials
- </Title>
+ <DialogTitle>Set your credentials</DialogTitle>
<Tag color="blue">Per-user</Tag>
</div>
<Text type="secondary" className="text-xs">
{displayName}
</Text>
+ </DialogHeader>
+ <div className="space-y-4 mt-2">
+ {isLoading ? (
+ <div className="flex items-center justify-center py-8">
+ <Spin />
+ </div>
+ ) : isError ? (
+ <Alert variant="error">
+ <CircleAlert />
+ <AlertTitle>Failed to load env vars</AlertTitle>
+ </Alert>
+ ) : required.length === 0 ? (
+ <Alert variant="info">
+ <Info />
+ <AlertTitle>No per-user fields configured for this server.</AlertTitle>
+ </Alert>
+ ) : (
+ <>
+ <Text className="text-sm text-muted-foreground block">
+ These values are private to you. Your admin configured this MCP server to require these per-user
+ credentials. Saved values are never shown back; leave an already-set field blank to keep it, or enter a
+ value to set or change it.
+ </Text>
+ <UserEnvVarsForm required={required} isSaving={isSaving} onCancel={onClose} onSubmit={handleSave} />
+ </>
+ )}
</div>
- }
- >
- <div className="space-y-4 mt-2">
- {isLoading ? (
- <div className="flex items-center justify-center py-8">
- <Spin />
- </div>
- ) : isError ? (
- <Alert variant="error">
- <CircleAlert />
- <AlertTitle>Failed to load env vars</AlertTitle>
- </Alert>
- ) : required.length === 0 ? (
- <Alert variant="info">
- <Info />
- <AlertTitle>No per-user fields configured for this server.</AlertTitle>
- </Alert>
- ) : (
- <>
- <Text className="text-sm text-muted-foreground block">
- These values are private to you. Your admin configured this MCP server to require these per-user
- credentials. Saved values are never shown back; leave an already-set field blank to keep it, or enter a
- value to set or change it.
- </Text>
- <UserEnvVarsForm
- key={formGeneration}
- required={required}
- isSaving={isSaving}
- onCancel={onClose}
- onSubmit={handleSave}
- />
- </>
- )}
- </div>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryEditModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryEditModal.tsx
index f36f6cb30c4..cd238406237 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryEditModal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryEditModal.tsx
@@ -1,6 +1,5 @@
"use client";
-import { Modal } from "antd";
import { CircleHelp } from "lucide-react";
import React, { useEffect, useState } from "react";
import { z } from "zod/v4";
@@ -12,6 +11,8 @@ import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { useZodForm } from "@/lib/forms/useZodForm";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
const memorySchema = z.object({
key: z.string().min(1, "Key is required"),
@@ -68,63 +69,78 @@ export const MemoryEditModal: React.FC<MemoryEditModalProps> = ({ open, mode, in
});
return (
- <Modal
+ <Dialog
open={open}
- title={mode === "create" ? "Create memory" : `Edit ${initialRow?.key ?? ""}`}
- onCancel={() => {
- form.reset(EMPTY_MEMORY);
- onClose();
+ onOpenChange={(open) => {
+ if (!open) {
+ form.reset(EMPTY_MEMORY);
+ onClose();
+ }
}}
- onOk={handleOk}
- okText={mode === "create" ? "Create" : "Save"}
- confirmLoading={submitting}
- width={640}
- destroyOnClose
>
- <form onSubmit={(event) => event.preventDefault()} noValidate>
- <TooltipProvider>
- <FieldGroup>
- <FormField
- control={form.control}
- name="key"
- label={labelWithHint(
- "Key",
- "Globally unique — two memories cannot share a key. Namespace your own keys if you need per-user isolation (e.g. user:123:notes).",
- )}
- >
- {({ ref, ...field }) => (
- <Input {...field} ref={ref} placeholder="e.g. user_role" disabled={mode === "edit"} />
- )}
- </FormField>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[640px]">
+ <DialogHeader>
+ <DialogTitle>{mode === "create" ? "Create memory" : `Edit ${initialRow?.key ?? ""}`}</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={(event) => event.preventDefault()} noValidate>
+ <TooltipProvider>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="key"
+ label={labelWithHint(
+ "Key",
+ "Globally unique — two memories cannot share a key. Namespace your own keys if you need per-user isolation (e.g. user:123:notes).",
+ )}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="e.g. user_role" disabled={mode === "edit"} />
+ )}
+ </FormField>
- <FormField
- control={form.control}
- name="value"
- label={labelWithHint("Value", "Markdown/text injected into LLM context. Plain strings are fine.")}
- >
- {({ ref, ...field }) => (
- <Textarea {...field} ref={ref} rows={8} placeholder="What the agent should remember…" />
- )}
- </FormField>
+ <FormField
+ control={form.control}
+ name="value"
+ label={labelWithHint("Value", "Markdown/text injected into LLM context. Plain strings are fine.")}
+ >
+ {({ ref, ...field }) => (
+ <Textarea {...field} ref={ref} rows={8} placeholder="What the agent should remember…" />
+ )}
+ </FormField>
- <FormField
- control={form.control}
- name="metadata"
- label={labelWithHint(
- <span>
- Metadata <span className="text-muted-foreground">(optional JSON)</span>
- </span>,
- "Optional structured metadata — must be valid JSON if provided.",
- )}
- >
- {({ ref, ...field }) => (
- <Textarea {...field} ref={ref} rows={4} placeholder='{"tags": ["example"]}' className="font-mono" />
- )}
- </FormField>
- </FieldGroup>
- </TooltipProvider>
- </form>
- </Modal>
+ <FormField
+ control={form.control}
+ name="metadata"
+ label={labelWithHint(
+ <span>
+ Metadata <span className="text-muted-foreground">(optional JSON)</span>
+ </span>,
+ "Optional structured metadata — must be valid JSON if provided.",
+ )}
+ >
+ {({ ref, ...field }) => (
+ <Textarea {...field} ref={ref} rows={4} placeholder='{"tags": ["example"]}' className="font-mono" />
+ )}
+ </FormField>
+ </FieldGroup>
+ </TooltipProvider>
+ </form>
+ <DialogFooter>
+ <Button
+ variant="outline"
+ onClick={() => {
+ form.reset(EMPTY_MEMORY);
+ onClose();
+ }}
+ >
+ Cancel
+ </Button>
+ <Button onClick={handleOk} disabled={submitting} aria-busy={submitting}>
+ {mode === "create" ? "Create" : "Save"}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx
index 292d22f23e6..83dee5c7075 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx
@@ -1,5 +1,4 @@
import React, { useState, useEffect } from "react";
-import { Modal } from "antd";
import { CircleHelp } from "lucide-react";
import { z } from "zod/v4";
import { Policy } from "@/components/policies/types";
@@ -18,6 +17,7 @@ import { buildAttachmentData } from "./build_attachment_data";
import { getInvalidTeamEntries } from "./scope_validation";
import ImpactPreviewAlert from "./impact_preview_alert";
import { TokenSelect } from "./TokenSelect";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AddAttachmentFormProps {
visible: boolean;
@@ -231,216 +231,228 @@ const AddAttachmentForm: React.FC<AddAttachmentFormProps> = ({
const policyOptions = policies.map((p) => p.policy_name);
return (
- <Modal title="Create Policy Attachment" open={visible} onCancel={handleClose} footer={null} width={600}>
- <TooltipProvider>
- <form onSubmit={(event) => event.preventDefault()} noValidate>
- <FieldGroup>
- <FormField control={form.control} name="policy_names" label="Policies">
- {({ id, value, onChange, onBlur, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <TokenSelect
- id={id}
- value={value}
- onValueChange={onChange}
- onBlur={onBlur}
- placeholder="Select policies to attach"
- options={policyOptions}
- emptyText="No matching policies"
- ariaInvalid={ariaInvalid}
- ariaDescribedBy={ariaDescribedBy}
- />
+ <Dialog open={visible} onOpenChange={(open) => !open && handleClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[600px]">
+ <DialogHeader>
+ <DialogTitle>Create Policy Attachment</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={(event) => event.preventDefault()} noValidate>
+ <FieldGroup>
+ <FormField control={form.control} name="policy_names" label="Policies">
+ {({
+ id,
+ value,
+ onChange,
+ onBlur,
+ "aria-invalid": ariaInvalid,
+ "aria-describedby": ariaDescribedBy,
+ }) => (
+ <TokenSelect
+ id={id}
+ value={value}
+ onValueChange={onChange}
+ onBlur={onBlur}
+ placeholder="Select policies to attach"
+ options={policyOptions}
+ emptyText="No matching policies"
+ ariaInvalid={ariaInvalid}
+ ariaDescribedBy={ariaDescribedBy}
+ />
+ )}
+ </FormField>
+
+ <div className="flex items-center gap-3">
+ <span className="text-sm font-semibold">Scope</span>
+ <Separator className="flex-1" />
+ </div>
+
+ <div>
+ <FieldTitle className="mb-2">Scope Type</FieldTitle>
+ <RadioGroup value={scopeType} onValueChange={(value: unknown) => setScopeType(value as ScopeType)}>
+ <FieldLabel className="font-normal">
+ <RadioGroupItem value="specific" />
+ Specific (teams, keys, models, or tags)
+ </FieldLabel>
+ <FieldLabel className="font-normal">
+ <RadioGroupItem value="global" />
+ Global (applies to all requests)
+ </FieldLabel>
+ </RadioGroup>
+ </div>
+
+ {scopeType === "specific" && (
+ <>
+ <FormField
+ control={form.control}
+ name="teams"
+ label={labelWithHint(
+ "Teams",
+ "Select team aliases or enter custom patterns. Supports wildcards (e.g., healthcare-*)",
+ )}
+ >
+ {({
+ id,
+ value,
+ onChange,
+ onBlur,
+ "aria-invalid": ariaInvalid,
+ "aria-describedby": ariaDescribedBy,
+ }) => (
+ <TokenSelect
+ id={id}
+ value={value}
+ onValueChange={onChange}
+ onBlur={onBlur}
+ placeholder={isLoadingTeams ? "Loading teams..." : "Select or enter team aliases"}
+ options={availableTeams}
+ allowCustomValues
+ tokenSeparators={[","]}
+ emptyText="No matching teams"
+ ariaInvalid={ariaInvalid}
+ ariaDescribedBy={ariaDescribedBy}
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="keys"
+ label={labelWithHint(
+ "Keys",
+ "Select key aliases or enter custom patterns. Supports wildcards (e.g., dev-*)",
+ )}
+ >
+ {({
+ id,
+ value,
+ onChange,
+ onBlur,
+ "aria-invalid": ariaInvalid,
+ "aria-describedby": ariaDescribedBy,
+ }) => (
+ <TokenSelect
+ id={id}
+ value={value}
+ onValueChange={onChange}
+ onBlur={onBlur}
+ placeholder={isLoadingKeys ? "Loading keys..." : "Select or enter key aliases"}
+ options={availableKeys}
+ allowCustomValues
+ tokenSeparators={[","]}
+ emptyText="No matching keys"
+ ariaInvalid={ariaInvalid}
+ ariaDescribedBy={ariaDescribedBy}
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="models"
+ label={labelWithHint(
+ "Models",
+ "Model names this attachment applies to. Supports wildcards (e.g., gpt-4*). Leave empty to apply to all models.",
+ )}
+ >
+ {({
+ id,
+ value,
+ onChange,
+ onBlur,
+ "aria-invalid": ariaInvalid,
+ "aria-describedby": ariaDescribedBy,
+ }) => (
+ <TokenSelect
+ id={id}
+ value={value}
+ onValueChange={onChange}
+ onBlur={onBlur}
+ placeholder={
+ isLoadingModels ? "Loading models..." : "Select or enter model names (e.g., gpt-4, bedrock/*)"
+ }
+ options={availableModels}
+ allowCustomValues
+ tokenSeparators={[","]}
+ emptyText="No matching models"
+ ariaInvalid={ariaInvalid}
+ ariaDescribedBy={ariaDescribedBy}
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="tags"
+ label={labelWithHint(
+ "Tags",
+ "Match against tags set in key or team metadata. Use exact values (e.g., healthcare) or wildcard patterns (e.g., health-*) where * matches any suffix.",
+ )}
+ description={
+ <span className="text-xs">
+ Matches tags from key/team <code>metadata.tags</code> or tags passed dynamically in the request
+ body. Use <code>*</code> as a suffix wildcard (e.g., <code>prod-*</code> matches{" "}
+ <code>prod-us</code>, <code>prod-eu</code>).
+ </span>
+ }
+ >
+ {({
+ id,
+ value,
+ onChange,
+ onBlur,
+ "aria-invalid": ariaInvalid,
+ "aria-describedby": ariaDescribedBy,
+ }) => (
+ <TokenSelect
+ id={id}
+ value={value}
+ onValueChange={onChange}
+ onBlur={onBlur}
+ placeholder="Type a tag and press Enter (e.g. healthcare, prod-*)"
+ allowCustomValues
+ tokenSeparators={[",", " "]}
+ ariaInvalid={ariaInvalid}
+ ariaDescribedBy={ariaDescribedBy}
+ />
+ )}
+ </FormField>
+ </>
)}
- </FormField>
+ </FieldGroup>
- <div className="flex items-center gap-3">
- <span className="text-sm font-semibold">Scope</span>
- <Separator className="flex-1" />
- </div>
-
- <div>
- <FieldTitle className="mb-2">Scope Type</FieldTitle>
- <RadioGroup value={scopeType} onValueChange={(value: unknown) => setScopeType(value as ScopeType)}>
- <FieldLabel className="font-normal">
- <RadioGroupItem value="specific" />
- Specific (teams, keys, models, or tags)
- </FieldLabel>
- <FieldLabel className="font-normal">
- <RadioGroupItem value="global" />
- Global (applies to all requests)
- </FieldLabel>
- </RadioGroup>
- </div>
+ {impactResult && <ImpactPreviewAlert impactResult={impactResult} />}
- {scopeType === "specific" && (
- <>
- <FormField
- control={form.control}
- name="teams"
- label={labelWithHint(
- "Teams",
- "Select team aliases or enter custom patterns. Supports wildcards (e.g., healthcare-*)",
- )}
- >
- {({
- id,
- value,
- onChange,
- onBlur,
- "aria-invalid": ariaInvalid,
- "aria-describedby": ariaDescribedBy,
- }) => (
- <TokenSelect
- id={id}
- value={value}
- onValueChange={onChange}
- onBlur={onBlur}
- placeholder={isLoadingTeams ? "Loading teams..." : "Select or enter team aliases"}
- options={availableTeams}
- allowCustomValues
- tokenSeparators={[","]}
- emptyText="No matching teams"
- ariaInvalid={ariaInvalid}
- ariaDescribedBy={ariaDescribedBy}
- />
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="keys"
- label={labelWithHint(
- "Keys",
- "Select key aliases or enter custom patterns. Supports wildcards (e.g., dev-*)",
- )}
- >
- {({
- id,
- value,
- onChange,
- onBlur,
- "aria-invalid": ariaInvalid,
- "aria-describedby": ariaDescribedBy,
- }) => (
- <TokenSelect
- id={id}
- value={value}
- onValueChange={onChange}
- onBlur={onBlur}
- placeholder={isLoadingKeys ? "Loading keys..." : "Select or enter key aliases"}
- options={availableKeys}
- allowCustomValues
- tokenSeparators={[","]}
- emptyText="No matching keys"
- ariaInvalid={ariaInvalid}
- ariaDescribedBy={ariaDescribedBy}
- />
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="models"
- label={labelWithHint(
- "Models",
- "Model names this attachment applies to. Supports wildcards (e.g., gpt-4*). Leave empty to apply to all models.",
- )}
- >
- {({
- id,
- value,
- onChange,
- onBlur,
- "aria-invalid": ariaInvalid,
- "aria-describedby": ariaDescribedBy,
- }) => (
- <TokenSelect
- id={id}
- value={value}
- onValueChange={onChange}
- onBlur={onBlur}
- placeholder={
- isLoadingModels ? "Loading models..." : "Select or enter model names (e.g., gpt-4, bedrock/*)"
- }
- options={availableModels}
- allowCustomValues
- tokenSeparators={[","]}
- emptyText="No matching models"
- ariaInvalid={ariaInvalid}
- ariaDescribedBy={ariaDescribedBy}
- />
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="tags"
- label={labelWithHint(
- "Tags",
- "Match against tags set in key or team metadata. Use exact values (e.g., healthcare) or wildcard patterns (e.g., health-*) where * matches any suffix.",
- )}
- description={
- <span className="text-xs">
- Matches tags from key/team <code>metadata.tags</code> or tags passed dynamically in the request
- body. Use <code>*</code> as a suffix wildcard (e.g., <code>prod-*</code> matches{" "}
- <code>prod-us</code>, <code>prod-eu</code>).
- </span>
- }
+ <div className="flex justify-end space-x-2 mt-4">
+ <Button type="button" variant="secondary" onClick={handleClose}>
+ Cancel
+ </Button>
+ {scopeType === "specific" && (
+ <Button
+ type="button"
+ variant="secondary"
+ onClick={handlePreviewImpact}
+ disabled={isEstimating}
+ aria-busy={isEstimating}
>
- {({
- id,
- value,
- onChange,
- onBlur,
- "aria-invalid": ariaInvalid,
- "aria-describedby": ariaDescribedBy,
- }) => (
- <TokenSelect
- id={id}
- value={value}
- onValueChange={onChange}
- onBlur={onBlur}
- placeholder="Type a tag and press Enter (e.g. healthcare, prod-*)"
- allowCustomValues
- tokenSeparators={[",", " "]}
- ariaInvalid={ariaInvalid}
- ariaDescribedBy={ariaDescribedBy}
- />
- )}
- </FormField>
- </>
- )}
- </FieldGroup>
-
- {impactResult && <ImpactPreviewAlert impactResult={impactResult} />}
-
- <div className="flex justify-end space-x-2 mt-4">
- <Button type="button" variant="secondary" onClick={handleClose}>
- Cancel
- </Button>
- {scopeType === "specific" && (
+ {isEstimating && <UiLoadingSpinner className="size-4" />}
+ Estimate Impact
+ </Button>
+ )}
<Button
type="button"
- variant="secondary"
- onClick={handlePreviewImpact}
- disabled={isEstimating}
- aria-busy={isEstimating}
+ onClick={form.handleSubmit(handleSubmit)}
+ disabled={isSubmitting}
+ aria-busy={isSubmitting}
>
- {isEstimating && <UiLoadingSpinner className="size-4" />}
- Estimate Impact
+ {isSubmitting && <UiLoadingSpinner className="size-4" />}
+ Create Attachment
</Button>
- )}
- <Button
- type="button"
- onClick={form.handleSubmit(handleSubmit)}
- disabled={isSubmitting}
- aria-busy={isSubmitting}
- >
- {isSubmitting && <UiLoadingSpinner className="size-4" />}
- Create Attachment
- </Button>
- </div>
- </form>
- </TooltipProvider>
- </Modal>
+ </div>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_policy_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_policy_form.tsx
index a1289027f46..b1f00ee64ad 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_policy_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_policy_form.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
-import { Modal, Tag } from "antd";
+import { Tag } from "antd";
import { z } from "zod/v4";
import { Policy, PolicyCreateRequest, PolicyUpdateRequest } from "@/components/policies/types";
import { Guardrail } from "@/components/guardrails/types";
@@ -20,6 +20,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { useZodForm } from "@/lib/forms/useZodForm";
import { CircleHelp, Info } from "lucide-react";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";
interface AddPolicyFormProps {
@@ -336,231 +337,236 @@ const AddPolicyForm: React.FC<AddPolicyFormProps> = ({
// ── Mode Picker Step ──────────────────────────────────────────────────────
if (step === "pick_mode") {
return (
- <Modal title="Create New Policy" open={visible} onCancel={handleClose} footer={null} width={620}>
- <ModePicker selected={selectedMode} onSelect={setSelectedMode} />
-
- {selectedMode === "flow_builder" && (
- <Alert
- variant="info"
- className="mt-4 border border-indigo-200 bg-indigo-50 dark:border-indigo-800 dark:bg-indigo-950"
- >
- <AlertTitle>
- You&apos;ll be redirected to the full-screen Flow Builder to design your policy logic visually.
- </AlertTitle>
- </Alert>
- )}
-
- <div className="mt-6 flex justify-end gap-2">
- <Button type="button" variant="outline" onClick={handleClose}>
- Cancel
- </Button>
- <Button type="button" onClick={handleModeConfirm}>
- {selectedMode === "flow_builder" ? "Continue to Builder" : "Create Policy"}
- </Button>
- </div>
- </Modal>
+ <Dialog open={visible} onOpenChange={(open) => !open && handleClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[620px]">
+ <DialogHeader>
+ <DialogTitle>Create New Policy</DialogTitle>
+ </DialogHeader>
+ <ModePicker selected={selectedMode} onSelect={setSelectedMode} />
+
+ {selectedMode === "flow_builder" && (
+ <Alert
+ variant="info"
+ className="mt-4 border border-indigo-200 bg-indigo-50 dark:border-indigo-800 dark:bg-indigo-950"
+ >
+ <AlertTitle>
+ You&apos;ll be redirected to the full-screen Flow Builder to design your policy logic visually.
+ </AlertTitle>
+ </Alert>
+ )}
+
+ <div className="mt-6 flex justify-end gap-2">
+ <Button type="button" variant="outline" onClick={handleClose}>
+ Cancel
+ </Button>
+ <Button type="button" onClick={handleModeConfirm}>
+ {selectedMode === "flow_builder" ? "Continue to Builder" : "Create Policy"}
+ </Button>
+ </div>
+ </DialogContent>
+ </Dialog>
);
}
// ── Simple Form Step ──────────────────────────────────────────────────────
return (
- <Modal
- title={isEditing ? "Edit Policy" : "Create New Policy"}
- open={visible}
- onCancel={handleClose}
- footer={null}
- width={700}
- >
- <TooltipProvider>
- <form onSubmit={(event) => event.preventDefault()} noValidate>
- <FieldGroup>
- <FormField control={form.control} name="policy_name" label="Policy Name">
- {({ ref, ...control }) => (
- <Input
- {...control}
- ref={ref}
- placeholder="e.g., global-baseline, healthcare-compliance"
- disabled={isEditing}
- />
- )}
- </FormField>
-
- <FormField control={form.control} name="description" label="Description">
- {({ ref, ...control }) => (
- <Textarea {...control} ref={ref} rows={2} placeholder="Describe what this policy does..." />
- )}
- </FormField>
-
- <SectionHeading label="Inheritance" />
-
- <FormField
- control={form.control}
- name="inherit"
- label={labelWithHint(
- "Inherit From",
- "Inherit guardrails from another policy. The child policy will include all guardrails from the parent.",
- )}
- >
- {({ id, value, onChange }) => (
- <SearchSelect
- inputId={id}
- options={policyOptions}
- value={value}
- onValueChange={(selected) => {
- onChange(selected);
- refreshResolvedGuardrails({ inherit: selected });
- }}
- placeholder="Select a parent policy (optional)"
- className="h-9"
- />
+ <Dialog open={visible} onOpenChange={(open) => !open && handleClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>{isEditing ? "Edit Policy" : "Create New Policy"}</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={(event) => event.preventDefault()} noValidate>
+ <FieldGroup>
+ <FormField control={form.control} name="policy_name" label="Policy Name">
+ {({ ref, ...control }) => (
+ <Input
+ {...control}
+ ref={ref}
+ placeholder="e.g., global-baseline, healthcare-compliance"
+ disabled={isEditing}
+ />
+ )}
+ </FormField>
+
+ <FormField control={form.control} name="description" label="Description">
+ {({ ref, ...control }) => (
+ <Textarea {...control} ref={ref} rows={2} placeholder="Describe what this policy does..." />
+ )}
+ </FormField>
+
+ <SectionHeading label="Inheritance" />
+
+ <FormField
+ control={form.control}
+ name="inherit"
+ label={labelWithHint(
+ "Inherit From",
+ "Inherit guardrails from another policy. The child policy will include all guardrails from the parent.",
+ )}
+ >
+ {({ id, value, onChange }) => (
+ <SearchSelect
+ inputId={id}
+ options={policyOptions}
+ value={value}
+ onValueChange={(selected) => {
+ onChange(selected);
+ refreshResolvedGuardrails({ inherit: selected });
+ }}
+ placeholder="Select a parent policy (optional)"
+ className="h-9"
+ />
+ )}
+ </FormField>
+
+ <SectionHeading label="Guardrails" />
+
+ <FormField
+ control={form.control}
+ name="guardrails_add"
+ label={labelWithHint(
+ "Guardrails to Add",
+ "These guardrails will be added to requests matching this policy",
+ )}
+ >
+ {({ value, onChange }) => (
+ <MultiSelect
+ options={guardrailOptions}
+ value={value}
+ onValueChange={(selected) => {
+ onChange(selected);
+ refreshResolvedGuardrails({ guardrails_add: selected });
+ }}
+ placeholder="Select guardrails to add"
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="guardrails_remove"
+ label={labelWithHint(
+ "Guardrails to Remove",
+ "These guardrails will be removed from inherited guardrails",
+ )}
+ >
+ {({ value, onChange }) => (
+ <MultiSelect
+ options={guardrailOptions}
+ value={value}
+ onValueChange={(selected) => {
+ onChange(selected);
+ refreshResolvedGuardrails({ guardrails_remove: selected });
+ }}
+ placeholder="Select guardrails to remove (from inherited)"
+ />
+ )}
+ </FormField>
+
+ {resolvedGuardrails.length > 0 && (
+ <Alert variant="info">
+ <Info />
+ <AlertTitle>Resolved Guardrails</AlertTitle>
+ <AlertDescription>
+ <span className="mb-2 block text-muted-foreground">
+ These are the final guardrails that will be applied (including inheritance):
+ </span>
+ <div className="flex flex-wrap gap-1">
+ {resolvedGuardrails.map((g) => (
+ <Tag key={g} color="blue">
+ {g}
+ </Tag>
+ ))}
+ </div>
+ </AlertDescription>
+ </Alert>
)}
- </FormField>
-
- <SectionHeading label="Guardrails" />
- <FormField
- control={form.control}
- name="guardrails_add"
- label={labelWithHint(
- "Guardrails to Add",
- "These guardrails will be added to requests matching this policy",
- )}
- >
- {({ value, onChange }) => (
- <MultiSelect
- options={guardrailOptions}
- value={value}
- onValueChange={(selected) => {
- onChange(selected);
- refreshResolvedGuardrails({ guardrails_add: selected });
- }}
- placeholder="Select guardrails to add"
- />
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="guardrails_remove"
- label={labelWithHint(
- "Guardrails to Remove",
- "These guardrails will be removed from inherited guardrails",
- )}
- >
- {({ value, onChange }) => (
- <MultiSelect
- options={guardrailOptions}
- value={value}
- onValueChange={(selected) => {
- onChange(selected);
- refreshResolvedGuardrails({ guardrails_remove: selected });
- }}
- placeholder="Select guardrails to remove (from inherited)"
- />
- )}
- </FormField>
+ <SectionHeading label="Conditions (Optional)" />
- {resolvedGuardrails.length > 0 && (
<Alert variant="info">
<Info />
- <AlertTitle>Resolved Guardrails</AlertTitle>
+ <AlertTitle>Model Scope</AlertTitle>
<AlertDescription>
- <span className="mb-2 block text-muted-foreground">
- These are the final guardrails that will be applied (including inheritance):
- </span>
- <div className="flex flex-wrap gap-1">
- {resolvedGuardrails.map((g) => (
- <Tag key={g} color="blue">
- {g}
- </Tag>
- ))}
- </div>
+ By default, this policy will run on all models. You can optionally restrict it to specific models
+ below.
</AlertDescription>
</Alert>
- )}
-
- <SectionHeading label="Conditions (Optional)" />
- <Alert variant="info">
- <Info />
- <AlertTitle>Model Scope</AlertTitle>
- <AlertDescription>
- By default, this policy will run on all models. You can optionally restrict it to specific models below.
- </AlertDescription>
- </Alert>
-
- <div role="group" className="flex w-full flex-col gap-3">
- <span className="text-sm leading-snug font-medium text-foreground">Model Condition Type</span>
- <RadioGroup
- value={modelConditionType}
- onValueChange={(value) => {
- setModelConditionType(value as ModelConditionType);
- form.setValue("model_condition", "");
- }}
- className="flex flex-row gap-6"
+ <div role="group" className="flex w-full flex-col gap-3">
+ <span className="text-sm leading-snug font-medium text-foreground">Model Condition Type</span>
+ <RadioGroup
+ value={modelConditionType}
+ onValueChange={(value) => {
+ setModelConditionType(value as ModelConditionType);
+ form.setValue("model_condition", "");
+ }}
+ className="flex flex-row gap-6"
+ >
+ <label className="flex cursor-pointer items-center gap-2 text-sm">
+ <RadioGroupItem value="model" />
+ Select Model
+ </label>
+ <label className="flex cursor-pointer items-center gap-2 text-sm">
+ <RadioGroupItem value="regex" />
+ Custom Regex Pattern
+ </label>
+ </RadioGroup>
+ </div>
+
+ <FormField
+ control={form.control}
+ name="model_condition"
+ label={labelWithHint(
+ modelConditionType === "model" ? "Model (Optional)" : "Regex Pattern (Optional)",
+ modelConditionType === "model"
+ ? "Select a specific model to apply this policy to. Leave empty to apply to all models."
+ : "Enter a regex pattern to match models (e.g., gpt-4.* or bedrock/.*). Leave empty to apply to all models.",
+ )}
+ >
+ {({ ref, id, value, onChange, ...control }) =>
+ modelConditionType === "model" ? (
+ <SearchSelect
+ inputId={id}
+ options={availableModels.map((model) => ({ label: model, value: model }))}
+ value={value}
+ onValueChange={onChange}
+ placeholder="Leave empty to apply to all models"
+ className="h-9"
+ />
+ ) : (
+ <Input
+ {...control}
+ id={id}
+ ref={ref}
+ value={value}
+ onChange={onChange}
+ placeholder="Leave empty to apply to all models (e.g., gpt-4.* or bedrock/claude-.*)"
+ />
+ )
+ }
+ </FormField>
+ </FieldGroup>
+
+ <div className="mt-6 flex justify-end gap-2">
+ <Button type="button" variant="outline" onClick={handleClose}>
+ Cancel
+ </Button>
+ <Button
+ type="button"
+ onClick={form.handleSubmit(handleSubmit)}
+ disabled={isSubmitting}
+ aria-busy={isSubmitting}
>
- <label className="flex cursor-pointer items-center gap-2 text-sm">
- <RadioGroupItem value="model" />
- Select Model
- </label>
- <label className="flex cursor-pointer items-center gap-2 text-sm">
- <RadioGroupItem value="regex" />
- Custom Regex Pattern
- </label>
- </RadioGroup>
+ {isSubmitting && <UiLoadingSpinner className="size-4" />}
+ {isEditing ? "Update Policy" : "Create Policy"}
+ </Button>
</div>
-
- <FormField
- control={form.control}
- name="model_condition"
- label={labelWithHint(
- modelConditionType === "model" ? "Model (Optional)" : "Regex Pattern (Optional)",
- modelConditionType === "model"
- ? "Select a specific model to apply this policy to. Leave empty to apply to all models."
- : "Enter a regex pattern to match models (e.g., gpt-4.* or bedrock/.*). Leave empty to apply to all models.",
- )}
- >
- {({ ref, id, value, onChange, ...control }) =>
- modelConditionType === "model" ? (
- <SearchSelect
- inputId={id}
- options={availableModels.map((model) => ({ label: model, value: model }))}
- value={value}
- onValueChange={onChange}
- placeholder="Leave empty to apply to all models"
- className="h-9"
- />
- ) : (
- <Input
- {...control}
- id={id}
- ref={ref}
- value={value}
- onChange={onChange}
- placeholder="Leave empty to apply to all models (e.g., gpt-4.* or bedrock/claude-.*)"
- />
- )
- }
- </FormField>
- </FieldGroup>
-
- <div className="mt-6 flex justify-end gap-2">
- <Button type="button" variant="outline" onClick={handleClose}>
- Cancel
- </Button>
- <Button
- type="button"
- onClick={form.handleSubmit(handleSubmit)}
- disabled={isSubmitting}
- aria-busy={isSubmitting}
- >
- {isSubmitting && <UiLoadingSpinner className="size-4" />}
- {isEditing ? "Update Policy" : "Create Policy"}
- </Button>
- </div>
- </form>
- </TooltipProvider>
- </Modal>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/CreateProjectModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/CreateProjectModal.tsx
index 7e2d74c0944..14bcc40bfea 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/CreateProjectModal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/CreateProjectModal.tsx
@@ -1,7 +1,6 @@
"use client";
import { useState } from "react";
-import { Modal } from "antd";
import { FolderPlus } from "lucide-react";
import { toast } from "@/lib/toast";
@@ -12,6 +11,7 @@ import { useCreateProject, ProjectCreateParams } from "@/app/(dashboard)/hooks/p
import { ProjectBaseForm } from "./ProjectBaseForm";
import { emptyProjectFormValues, projectFormSchema } from "./projectFormSchema";
import { buildProjectApiParams } from "./projectFormUtils";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface CreateProjectModalProps {
isOpen: boolean;
@@ -65,15 +65,13 @@ function CreateProjectForm({ onClose }: { onClose: () => void }) {
export function CreateProjectModal({ isOpen, onClose }: CreateProjectModalProps) {
return (
- <Modal
- title={<span className="text-lg font-semibold text-foreground">Create New Project</span>}
- open={isOpen}
- onCancel={onClose}
- width={720}
- destroyOnHidden
- footer={null}
- >
- <CreateProjectForm onClose={onClose} />
- </Modal>
+ <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[720px]">
+ <DialogHeader>
+ <DialogTitle className="text-lg">Create New Project</DialogTitle>
+ </DialogHeader>
+ <CreateProjectForm onClose={onClose} />
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/EditProjectModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/EditProjectModal.tsx
index d8b4076f404..307ba88e0f3 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/EditProjectModal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectModals/EditProjectModal.tsx
@@ -1,7 +1,6 @@
"use client";
import { useState } from "react";
-import { Modal } from "antd";
import { Save } from "lucide-react";
import { toast } from "@/lib/toast";
@@ -13,6 +12,7 @@ import { useUpdateProject, ProjectUpdateParams } from "@/app/(dashboard)/hooks/p
import { ProjectBaseForm } from "./ProjectBaseForm";
import { projectFormSchema, type ProjectFormValues } from "./projectFormSchema";
import { buildProjectApiParams } from "./projectFormUtils";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface EditProjectModalProps {
isOpen: boolean;
@@ -107,15 +107,13 @@ function EditProjectForm({ project, onClose, onSuccess }: Omit<EditProjectModalP
export function EditProjectModal({ isOpen, project, onClose, onSuccess }: EditProjectModalProps) {
return (
- <Modal
- title={<span className="text-lg font-semibold text-foreground">Edit Project</span>}
- open={isOpen}
- onCancel={onClose}
- width={720}
- destroyOnHidden
- footer={null}
- >
- <EditProjectForm key={project.project_id} project={project} onClose={onClose} onSuccess={onSuccess} />
- </Modal>
+ <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[720px]">
+ <DialogHeader>
+ <DialogTitle className="text-lg">Edit Project</DialogTitle>
+ </DialogHeader>
+ <EditProjectForm key={project.project_id} project={project} onClose={onClose} onSuccess={onSuccess} />
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/add_prompt_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/add_prompt_form.tsx
index dc5221f9983..67e0b4e604b 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/add_prompt_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/add_prompt_form.tsx
@@ -1,5 +1,5 @@
import React, { useState } from "react";
-import { Modal, Upload } from "antd";
+import { Upload } from "antd";
import type { UploadFile, UploadProps } from "antd";
import { Upload as UploadIcon } from "lucide-react";
import { z } from "zod/v4";
@@ -12,6 +12,7 @@ import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { useZodForm } from "@/lib/forms/useZodForm";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AddPromptFormProps {
visible: boolean;
@@ -144,67 +145,70 @@ const AddPromptForm: React.FC<AddPromptFormProps> = ({ visible, onClose, accessT
};
return (
- <Modal
- title="Add New Prompt"
- open={visible}
- onCancel={handleCancel}
- footer={[
- <Button key="cancel" type="button" variant="outline" onClick={handleCancel}>
- Cancel
- </Button>,
- <Button key="submit" type="button" disabled={loading} onClick={() => void form.handleSubmit(handleSubmit)()}>
- {loading && <UiLoadingSpinner className="size-4" />}
- Create Prompt
- </Button>,
- ]}
- width={600}
- >
- <form onSubmit={(event) => event.preventDefault()} noValidate>
- <FieldGroup>
- <FormField control={form.control} name="prompt_id" label="Prompt ID">
- {({ ref, ...field }) => (
- <Input {...field} ref={ref} placeholder="Enter unique prompt ID (e.g., my_prompt_id)" />
+ <Dialog open={visible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[600px]">
+ <DialogHeader>
+ <DialogTitle>Add New Prompt</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={(event) => event.preventDefault()} noValidate>
+ <FieldGroup>
+ <FormField control={form.control} name="prompt_id" label="Prompt ID">
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="Enter unique prompt ID (e.g., my_prompt_id)" />
+ )}
+ </FormField>
+
+ <FormField control={form.control} name="prompt_integration" label="Prompt Integration">
+ {({ id, value, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Select items={PROMPT_INTEGRATION_OPTIONS} value={value} onValueChange={handleIntegrationChange}>
+ <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {PROMPT_INTEGRATION_OPTIONS.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+
+ {promptIntegration === "dotprompt" && (
+ <>
+ <FieldSeparator />
+ <Field>
+ <FieldTitle>Prompt File</FieldTitle>
+ <Upload {...uploadProps}>
+ <Button type="button" variant="outline">
+ <UploadIcon />
+ Select .prompt File
+ </Button>
+ </Upload>
+ {fileList.length > 0 && (
+ <div className="mt-2 text-sm text-muted-foreground">Selected: {fileList[0].name}</div>
+ )}
+ <FieldDescription>Upload a .prompt file that follows the Dotprompt specification</FieldDescription>
+ </Field>
+ </>
)}
- </FormField>
-
- <FormField control={form.control} name="prompt_integration" label="Prompt Integration">
- {({ id, value, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Select items={PROMPT_INTEGRATION_OPTIONS} value={value} onValueChange={handleIntegrationChange}>
- <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {PROMPT_INTEGRATION_OPTIONS.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- )}
- </FormField>
-
- {promptIntegration === "dotprompt" && (
- <>
- <FieldSeparator />
- <Field>
- <FieldTitle>Prompt File</FieldTitle>
- <Upload {...uploadProps}>
- <Button type="button" variant="outline">
- <UploadIcon />
- Select .prompt File
- </Button>
- </Upload>
- {fileList.length > 0 && (
- <div className="mt-2 text-sm text-muted-foreground">Selected: {fileList[0].name}</div>
- )}
- <FieldDescription>Upload a .prompt file that follows the Dotprompt specification</FieldDescription>
- </Field>
- </>
- )}
- </FieldGroup>
- </form>
- </Modal>
+ </FieldGroup>
+ </form>
+ <DialogFooter>
+ {" "}
+ <Button type="button" variant="outline" onClick={handleCancel}>
+ Cancel
+ </Button>
+ ,
+ <Button type="button" disabled={loading} onClick={() => void form.handleSubmit(handleSubmit)()}>
+ {loading && <UiLoadingSpinner className="size-4" />}
+ Create Prompt
+ </Button>
+ , ]
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/prompt_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/prompt_info.tsx
index 5ce91f15bd4..c58975ed500 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/prompt_info.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/prompt_info.tsx
@@ -4,7 +4,6 @@ import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import { Modal } from "antd";
import {
getPromptInfo,
getPromptVersions,
@@ -17,6 +16,7 @@ import { ArrowLeft, CheckIcon, CopyIcon, Pencil, Trash2 } from "lucide-react";
import { toast } from "@/lib/toast";
import PromptCodeSnippets from "./prompt_editor_view/PromptCodeSnippets";
import { extractModel, extractTemplateVariables, getBasePromptId, getCurrentVersion } from "./prompt_utils";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
export interface PromptInfoProps {
promptId: string;
@@ -489,20 +489,25 @@ const PromptInfoView: React.FC<PromptInfoProps> = ({ promptId, onClose, accessTo
</Tabs>
{/* Delete Confirmation Modal */}
- <Modal
- title="Delete Prompt"
- open={showDeleteConfirm}
- onOk={handleDeleteConfirm}
- onCancel={handleDeleteCancel}
- confirmLoading={isDeleting}
- okText="Delete"
- okButtonProps={{ danger: true }}
- >
- <p>
- Are you sure you want to delete prompt: <strong>{basePromptId}</strong>?
- </p>
- <p>This action cannot be undone.</p>
- </Modal>
+ <Dialog open={showDeleteConfirm} onOpenChange={(open) => !open && handleDeleteCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Delete Prompt</DialogTitle>
+ </DialogHeader>
+ <p>
+ Are you sure you want to delete prompt: <strong>{basePromptId}</strong>?
+ </p>
+ <p>This action cannot be undone.</p>
+ <DialogFooter>
+ <Button variant="outline" onClick={handleDeleteCancel}>
+ Cancel
+ </Button>
+ <Button onClick={handleDeleteConfirm} variant="destructive" disabled={isDeleting} aria-busy={isDeleting}>
+ Delete
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</div>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/CreateSearchTools.tsx b/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/CreateSearchTools.tsx
index 86baba7470a..9b21525a948 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/CreateSearchTools.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/CreateSearchTools.tsx
@@ -1,6 +1,5 @@
import { isAdminRole } from "@/utils/roles";
import { useQuery } from "@tanstack/react-query";
-import { Modal } from "antd";
import { CircleHelp } from "lucide-react";
import React, { useCallback, useMemo, useState } from "react";
import { useWatch } from "react-hook-form";
@@ -35,6 +34,7 @@ import nimbleLogo from "../../../../../public/assets/logos/nimble.png";
import parallelAiLogo from "../../../../../public/assets/logos/parallel_ai.png";
import perplexityLogo from "../../../../../public/assets/logos/perplexity.png";
import tavilyLogo from "../../../../../public/assets/logos/tavily.png";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const searchProviderLogoMap: Record<string, string> = {
perplexity: perplexityLogo.src,
@@ -172,186 +172,183 @@ const CreateSearchTool: React.FC<CreateSearchToolProps> = ({
}
return (
- <Modal
- title={
- <div className="flex items-center space-x-3 pb-4 border-b border-border">
- <span className="text-2xl">🔍</span>
- <h2 className="text-xl font-semibold text-foreground">Add New Search Tool</h2>
- </div>
- }
- open={isModalVisible}
- width={800}
- onCancel={handleCancel}
- footer={null}
- className="top-8"
- styles={{
- body: { padding: "24px" },
- header: { padding: "24px 24px 0 24px", border: "none" },
- }}
- >
- <div className="mt-6">
- <TooltipProvider>
- <form onSubmit={form.handleSubmit(handleCreate)} className="space-y-6">
- <FieldGroup>
- <FormField
- control={form.control}
- name="search_tool_name"
- label={labelWithHint(
- "Search Tool Name",
- "A unique name to identify this search tool configuration (e.g., 'perplexity-search', 'tavily-news-search').",
- )}
- >
- {({ ref, ...field }) => (
- <Input
- {...field}
- ref={ref}
- placeholder="e.g., perplexity-search, my-tavily-tool"
- className="rounded-lg"
- />
- )}
- </FormField>
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <div className="flex items-center space-x-3 pb-4 border-b border-border">
+ <span className="text-2xl">🔍</span>
+ <DialogTitle className="text-xl font-semibold text-foreground">Add New Search Tool</DialogTitle>
+ </div>
+ </DialogHeader>
+ <div className="mt-6">
+ <TooltipProvider>
+ <form onSubmit={form.handleSubmit(handleCreate)} className="space-y-6">
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="search_tool_name"
+ label={labelWithHint(
+ "Search Tool Name",
+ "A unique name to identify this search tool configuration (e.g., 'perplexity-search', 'tavily-news-search').",
+ )}
+ >
+ {({ ref, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ placeholder="e.g., perplexity-search, my-tavily-tool"
+ className="rounded-lg"
+ />
+ )}
+ </FormField>
- <FormField
- control={form.control}
- name="search_provider"
- label={labelWithHint(
- "Search Provider",
- "Select the search provider you want to use. Each provider has different capabilities and pricing.",
- )}
- >
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Combobox
- items={providerNames}
- itemToStringLabel={providerLabel}
- value={value === "" ? null : value}
- onValueChange={(provider: string | null) => onChange(provider ?? "")}
- >
- <ComboboxInput
- id={id}
- aria-invalid={ariaInvalid}
- aria-describedby={ariaDescribedBy}
- placeholder="Select a search provider"
- className="h-10 w-full rounded-lg"
- disabled={isLoadingProviders}
- showClear={value !== ""}
+ <FormField
+ control={form.control}
+ name="search_provider"
+ label={labelWithHint(
+ "Search Provider",
+ "Select the search provider you want to use. Each provider has different capabilities and pricing.",
+ )}
+ >
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Combobox
+ items={providerNames}
+ itemToStringLabel={providerLabel}
+ value={value === "" ? null : value}
+ onValueChange={(provider: string | null) => onChange(provider ?? "")}
+ >
+ <ComboboxInput
+ id={id}
+ aria-invalid={ariaInvalid}
+ aria-describedby={ariaDescribedBy}
+ placeholder="Select a search provider"
+ className="h-10 w-full rounded-lg"
+ disabled={isLoadingProviders}
+ showClear={value !== ""}
+ />
+ <ComboboxContent>
+ <ComboboxEmpty>No matching search providers</ComboboxEmpty>
+ <ComboboxList>
+ {(providerName: string) => (
+ <ComboboxItem key={providerName} value={providerName}>
+ <SearchProviderLabel
+ providerName={providerName}
+ displayName={providerLabel(providerName)}
+ />
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="api_key"
+ label={labelWithHint(
+ "API Key",
+ "The API key for authenticating with the search provider. This will be securely stored.",
+ )}
+ >
+ {({ ref, value, ...field }) => (
+ <PasswordInput
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ placeholder="Enter your API key"
+ groupClassName="h-10 rounded-lg"
/>
- <ComboboxContent>
- <ComboboxEmpty>No matching search providers</ComboboxEmpty>
- <ComboboxList>
- {(providerName: string) => (
- <ComboboxItem key={providerName} value={providerName}>
- <SearchProviderLabel
- providerName={providerName}
- displayName={providerLabel(providerName)}
- />
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
- )}
- </FormField>
+ )}
+ </FormField>
- <FormField
- control={form.control}
- name="api_key"
- label={labelWithHint(
- "API Key",
- "The API key for authenticating with the search provider. This will be securely stored.",
- )}
- >
- {({ ref, value, ...field }) => (
- <PasswordInput
- {...field}
- ref={ref}
- value={value ?? ""}
- placeholder="Enter your API key"
- groupClassName="h-10 rounded-lg"
- />
- )}
- </FormField>
+ <FormField control={form.control} name="description" label="Description (Optional)">
+ {({ ref, value, ...field }) => (
+ <Textarea
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ rows={3}
+ placeholder="Brief description of this search tool's purpose"
+ className="rounded-lg"
+ />
+ )}
+ </FormField>
+ </FieldGroup>
- <FormField control={form.control} name="description" label="Description (Optional)">
- {({ ref, value, ...field }) => (
- <Textarea
- {...field}
- ref={ref}
- value={value ?? ""}
- rows={3}
- placeholder="Brief description of this search tool's purpose"
- className="rounded-lg"
+ <div className="flex justify-between items-center pt-6 border-t border-border">
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <a
+ className="text-sm text-blue-600 hover:underline dark:text-blue-400"
+ href="https://github.com/BerriAI/litellm/issues"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Need Help?
+ </a>
+ }
/>
- )}
- </FormField>
- </FieldGroup>
-
- <div className="flex justify-between items-center pt-6 border-t border-border">
- <Tooltip>
- <TooltipTrigger
- render={
- <a
- className="text-sm text-blue-600 hover:underline dark:text-blue-400"
- href="https://github.com/BerriAI/litellm/issues"
- target="_blank"
- rel="noopener noreferrer"
- >
- Need Help?
- </a>
- }
- />
- <TooltipContent>Get help on our github</TooltipContent>
- </Tooltip>
- <div className="flex gap-2">
- <Button type="submit" variant="outline" onClick={handleTestConnection} disabled={isTestingConnection}>
- {isTestingConnection && <UiLoadingSpinner className="size-4" />}
- Test Connection
- </Button>
- <Button type="submit" variant="outline" disabled={isLoading}>
- {isLoading && <UiLoadingSpinner className="size-4" />}
- Add Search Tool
- </Button>
+ <TooltipContent>Get help on our github</TooltipContent>
+ </Tooltip>
+ <div className="flex gap-2">
+ <Button type="submit" variant="outline" onClick={handleTestConnection} disabled={isTestingConnection}>
+ {isTestingConnection && <UiLoadingSpinner className="size-4" />}
+ Test Connection
+ </Button>
+ <Button type="submit" variant="outline" disabled={isLoading}>
+ {isLoading && <UiLoadingSpinner className="size-4" />}
+ Add Search Tool
+ </Button>
+ </div>
</div>
- </div>
- </form>
- </TooltipProvider>
- </div>
+ </form>
+ </TooltipProvider>
+ </div>
- <Modal
- title="Connection Test Results"
- open={isTestModalVisible}
- onCancel={() => {
- setIsTestModalVisible(false);
- setIsTestingConnection(false);
- }}
- footer={[
- <Button
- key="close"
- type="button"
- variant="outline"
- onClick={() => {
+ <Dialog
+ open={isTestModalVisible}
+ onOpenChange={(open) => {
+ if (!open) {
setIsTestModalVisible(false);
setIsTestingConnection(false);
- }}
- >
- Close
- </Button>,
- ]}
- width={700}
- >
- {isTestModalVisible && accessToken && (
- <SearchConnectionTest
- key={connectionTestId}
- litellmParams={{
- search_provider: watchedProvider,
- api_key: watchedApiKey,
- api_base: undefined,
- }}
- accessToken={accessToken}
- onTestComplete={() => setIsTestingConnection(false)}
- />
- )}
- </Modal>
- </Modal>
+ }
+ }}
+ >
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Connection Test Results</DialogTitle>
+ </DialogHeader>
+ {isTestModalVisible && accessToken && (
+ <SearchConnectionTest
+ key={connectionTestId}
+ litellmParams={{
+ search_provider: watchedProvider,
+ api_key: watchedApiKey,
+ api_base: undefined,
+ }}
+ accessToken={accessToken}
+ onTestComplete={() => setIsTestingConnection(false)}
+ />
+ )}
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => {
+ setIsTestModalVisible(false);
+ setIsTestingConnection(false);
+ }}
+ >
+ Close
+ </Button>
+ , ]
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/SearchTools.tsx b/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/SearchTools.tsx
index 153734a6aa9..e171ed9969b 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/SearchTools.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/search-tools/_components/SearchTools.tsx
@@ -1,6 +1,5 @@
import { isAdminRole } from "@/utils/roles";
import { useQuery } from "@tanstack/react-query";
-import { Modal } from "antd";
import React, { useState } from "react";
import { z } from "zod/v4";
import DeleteResourceModal from "@/components/common_components/DeleteResourceModal";
@@ -25,6 +24,7 @@ import { buildSearchToolPayload } from "./searchToolPayload";
import SearchToolTable from "./SearchToolTable";
import { SearchToolView } from "./SearchToolView";
import { AvailableSearchProvider, SearchTool } from "./types";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface SearchToolsProps {
accessToken: string | null;
@@ -284,19 +284,36 @@ const SearchTools: React.FC<SearchToolsProps> = ({ accessToken, userRole, userID
setModalVisible={setCreateModalVisible}
/>
- <Modal
- title="Edit Search Tool"
+ <Dialog
open={isEditModalVisible}
- onOk={handleEditSubmit}
- onCancel={() => {
- setEditModalVisible(false);
- form.reset(EMPTY_EDIT_VALUES);
- setSelectedToolId(null);
+ onOpenChange={(open) => {
+ if (!open) {
+ setEditModalVisible(false);
+ form.reset(EMPTY_EDIT_VALUES);
+ setSelectedToolId(null);
+ }
}}
- width={600}
>
- {renderEditForm()}
- </Modal>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[600px]">
+ <DialogHeader>
+ <DialogTitle>Edit Search Tool</DialogTitle>
+ </DialogHeader>
+ {renderEditForm()}
+ <DialogFooter>
+ <Button
+ variant="outline"
+ onClick={() => {
+ setEditModalVisible(false);
+ form.reset(EMPTY_EDIT_VALUES);
+ setSelectedToolId(null);
+ }}
+ >
+ Cancel
+ </Button>
+ <Button onClick={handleEditSubmit}>OK</Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
<h1 className="text-lg font-semibold text-foreground">Search Tools</h1>
<p className="mt-2 text-sm text-muted-foreground">Configure and manage your search providers</p>
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/skills/_components/add_plugin_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/skills/_components/add_plugin_form.tsx
index 4fa0fed9eee..5fb13f2b124 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/skills/_components/add_plugin_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/skills/_components/add_plugin_form.tsx
@@ -1,5 +1,4 @@
import React, { useState } from "react";
-import { Modal } from "antd";
import { CircleHelp } from "lucide-react";
import { z } from "zod/v4";
import { toast } from "@/lib/toast";
@@ -30,6 +29,7 @@ import {
SkillSourcePreview,
} from "@/components/claude_code_plugins/helpers";
import { PluginAuthor, PluginSource, SkillRegisterRequest } from "@/components/claude_code_plugins/types";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AddPluginFormProps {
visible: boolean;
@@ -195,194 +195,199 @@ const AddPluginForm: React.FC<AddPluginFormProps> = ({ visible, onClose, accessT
};
return (
- <Modal title="Add New Skill" open={visible} onCancel={handleCancel} footer={null} width={700} className="top-8">
- <TooltipProvider>
- <form onSubmit={form.handleSubmit(handleSubmit)} noValidate className="mt-4">
- <FieldGroup>
- <FormField
- control={form.control}
- name="skillUrl"
- label={labelWithHint(
- "Repository URL",
- "Paste an HTTPS git repository URL from GitHub, GitLab, Bitbucket, or a self-hosted host. E.g. github.com/org/repo, gitlab.com/org/repo, or github.com/org/repo/tree/main/my-skill",
- )}
- >
- {({ ref, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- placeholder="https://github.com/org/repo or https://gitlab.com/org/repo"
- className="rounded-lg"
- onChange={(event) => {
- onChange(event);
- recomputePreview(event.target.value, form.getValues("subPath"));
- }}
- />
- )}
- </FormField>
+ <Dialog open={visible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Add New Skill</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={form.handleSubmit(handleSubmit)} noValidate className="mt-4">
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="skillUrl"
+ label={labelWithHint(
+ "Repository URL",
+ "Paste an HTTPS git repository URL from GitHub, GitLab, Bitbucket, or a self-hosted host. E.g. github.com/org/repo, gitlab.com/org/repo, or github.com/org/repo/tree/main/my-skill",
+ )}
+ >
+ {({ ref, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ placeholder="https://github.com/org/repo or https://gitlab.com/org/repo"
+ className="rounded-lg"
+ onChange={(event) => {
+ onChange(event);
+ recomputePreview(event.target.value, form.getValues("subPath"));
+ }}
+ />
+ )}
+ </FormField>
- <FormField
- control={form.control}
- name="subPath"
- label={labelWithHint(
- "Subfolder path (Optional)",
- "Path within the repository where the skill lives (e.g., plugins/my-skill). Leave empty if the skill is at the repo root.",
- )}
- description={
- urlEncodesSubdir ? "The URL already points to a subfolder, so this field is disabled" : undefined
- }
- >
- {({ ref, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- placeholder="plugins/my-skill"
- className="rounded-lg"
- onChange={(event) => {
- onChange(event);
- recomputePreview(form.getValues("skillUrl"), event.target.value);
- }}
- disabled={urlEncodesSubdir}
- />
+ <FormField
+ control={form.control}
+ name="subPath"
+ label={labelWithHint(
+ "Subfolder path (Optional)",
+ "Path within the repository where the skill lives (e.g., plugins/my-skill). Leave empty if the skill is at the repo root.",
+ )}
+ description={
+ urlEncodesSubdir ? "The URL already points to a subfolder, so this field is disabled" : undefined
+ }
+ >
+ {({ ref, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ placeholder="plugins/my-skill"
+ className="rounded-lg"
+ onChange={(event) => {
+ onChange(event);
+ recomputePreview(form.getValues("skillUrl"), event.target.value);
+ }}
+ disabled={urlEncodesSubdir}
+ />
+ )}
+ </FormField>
+
+ {urlPreview && (
+ <div className="rounded-lg border border-blue-200 bg-blue-50 px-3 py-2 text-sm text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300">
+ Detected: {urlPreview.label}
+ </div>
)}
- </FormField>
- {urlPreview && (
- <div className="rounded-lg border border-blue-200 bg-blue-50 px-3 py-2 text-sm text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300">
- Detected: {urlPreview.label}
- </div>
- )}
+ <FormField
+ control={form.control}
+ name="name"
+ label={labelWithHint("Skill Name", "Unique identifier in kebab-case format (e.g., my-skill)")}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="my-skill" className="rounded-lg" />}
+ </FormField>
- <FormField
- control={form.control}
- name="name"
- label={labelWithHint("Skill Name", "Unique identifier in kebab-case format (e.g., my-skill)")}
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="my-skill" className="rounded-lg" />}
- </FormField>
+ <div className="flex gap-4">
+ <FormField
+ control={form.control}
+ name="domain"
+ label={labelWithHint("Domain (Optional)", "Top-level grouping in the Skill Hub (e.g., Productivity)")}
+ className="flex-1"
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="Productivity" className="rounded-lg" />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="namespace"
+ label={labelWithHint("Namespace (Optional)", "Sub-grouping within domain (e.g., workflows)")}
+ className="flex-1"
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="workflows" className="rounded-lg" />}
+ </FormField>
+ </div>
- <div className="flex gap-4">
<FormField
control={form.control}
- name="domain"
- label={labelWithHint("Domain (Optional)", "Top-level grouping in the Skill Hub (e.g., Productivity)")}
- className="flex-1"
+ name="description"
+ label={labelWithHint("Description (Optional)", "Brief description of what the skill does")}
>
{({ ref, ...field }) => (
- <Input {...field} ref={ref} placeholder="Productivity" className="rounded-lg" />
+ <Textarea
+ {...field}
+ ref={ref}
+ rows={3}
+ placeholder="A skill that helps with..."
+ maxLength={500}
+ className="rounded-lg"
+ />
)}
</FormField>
+
<FormField
control={form.control}
- name="namespace"
- label={labelWithHint("Namespace (Optional)", "Sub-grouping within domain (e.g., workflows)")}
- className="flex-1"
+ name="category"
+ label={labelWithHint("Category (Optional)", "Select a category or enter a custom one")}
>
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="workflows" className="rounded-lg" />}
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Combobox
+ items={PREDEFINED_CATEGORIES}
+ value={value === "" ? null : value}
+ onValueChange={(category: string | null) => onChange(category ?? "")}
+ >
+ <ComboboxInput
+ id={id}
+ aria-invalid={ariaInvalid}
+ aria-describedby={ariaDescribedBy}
+ placeholder="Select or type a category"
+ className="w-full rounded-lg"
+ showClear={value !== ""}
+ />
+ <ComboboxContent>
+ <ComboboxEmpty>No matching categories</ComboboxEmpty>
+ <ComboboxList>
+ {(category: string) => (
+ <ComboboxItem key={category} value={category}>
+ {category}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ )}
</FormField>
- </div>
-
- <FormField
- control={form.control}
- name="description"
- label={labelWithHint("Description (Optional)", "Brief description of what the skill does")}
- >
- {({ ref, ...field }) => (
- <Textarea
- {...field}
- ref={ref}
- rows={3}
- placeholder="A skill that helps with..."
- maxLength={500}
- className="rounded-lg"
- />
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="category"
- label={labelWithHint("Category (Optional)", "Select a category or enter a custom one")}
- >
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Combobox
- items={PREDEFINED_CATEGORIES}
- value={value === "" ? null : value}
- onValueChange={(category: string | null) => onChange(category ?? "")}
- >
- <ComboboxInput
- id={id}
- aria-invalid={ariaInvalid}
- aria-describedby={ariaDescribedBy}
- placeholder="Select or type a category"
- className="w-full rounded-lg"
- showClear={value !== ""}
- />
- <ComboboxContent>
- <ComboboxEmpty>No matching categories</ComboboxEmpty>
- <ComboboxList>
- {(category: string) => (
- <ComboboxItem key={category} value={category}>
- {category}
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
- )}
- </FormField>
- <FormField
- control={form.control}
- name="keywords"
- label={labelWithHint("Keywords (Optional)", "Comma-separated list of keywords for search")}
- >
- {({ ref, ...field }) => (
- <Input {...field} ref={ref} placeholder="search, web, api" className="rounded-lg" />
- )}
- </FormField>
+ <FormField
+ control={form.control}
+ name="keywords"
+ label={labelWithHint("Keywords (Optional)", "Comma-separated list of keywords for search")}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="search, web, api" className="rounded-lg" />
+ )}
+ </FormField>
- <FormField
- control={form.control}
- name="version"
- label={labelWithHint("Version (Optional)", "Semantic version (e.g., 1.0.0)")}
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="1.0.0" className="rounded-lg" />}
- </FormField>
+ <FormField
+ control={form.control}
+ name="version"
+ label={labelWithHint("Version (Optional)", "Semantic version (e.g., 1.0.0)")}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="1.0.0" className="rounded-lg" />}
+ </FormField>
- <FormField
- control={form.control}
- name="authorName"
- label={labelWithHint("Author Name (Optional)", "Name of the skill author or organization")}
- >
- {({ ref, ...field }) => (
- <Input {...field} ref={ref} placeholder="Your Name or Organization" className="rounded-lg" />
- )}
- </FormField>
+ <FormField
+ control={form.control}
+ name="authorName"
+ label={labelWithHint("Author Name (Optional)", "Name of the skill author or organization")}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="Your Name or Organization" className="rounded-lg" />
+ )}
+ </FormField>
- <FormField
- control={form.control}
- name="authorEmail"
- label={labelWithHint("Author Email (Optional)", "Contact email for the skill author")}
- >
- {({ ref, ...field }) => (
- <Input {...field} ref={ref} type="email" placeholder="[email protected]" className="rounded-lg" />
- )}
- </FormField>
- </FieldGroup>
+ <FormField
+ control={form.control}
+ name="authorEmail"
+ label={labelWithHint("Author Email (Optional)", "Contact email for the skill author")}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} type="email" placeholder="[email protected]" className="rounded-lg" />
+ )}
+ </FormField>
+ </FieldGroup>
- <div className="mt-6 flex justify-end gap-2">
- <Button type="button" variant="outline" onClick={handleCancel} disabled={isSubmitting}>
- Cancel
- </Button>
- <Button type="submit" disabled={isSubmitting} aria-busy={isSubmitting}>
- {isSubmitting && <UiLoadingSpinner className="size-4" />}
- {isSubmitting ? "Adding..." : "Add Skill"}
- </Button>
- </div>
- </form>
- </TooltipProvider>
- </Modal>
+ <div className="mt-6 flex justify-end gap-2">
+ <Button type="button" variant="outline" onClick={handleCancel} disabled={isSubmitting}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={isSubmitting} aria-busy={isSubmitting}>
+ {isSubmitting && <UiLoadingSpinner className="size-4" />}
+ {isSubmitting ? "Adding..." : "Add Skill"}
+ </Button>
+ </div>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/components/CreateTagModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/components/CreateTagModal.tsx
index c43e5be3b64..6ea940130c2 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/components/CreateTagModal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/components/CreateTagModal.tsx
@@ -1,6 +1,5 @@
"use client";
-import { Modal } from "antd";
import { ChevronRight, CircleHelp } from "lucide-react";
import React from "react";
import { z } from "zod/v4";
@@ -15,6 +14,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/component
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { useZodForm } from "@/lib/forms/useZodForm";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const labelWithHint = (label: React.ReactNode, hint: string): React.ReactNode => (
<>
@@ -77,96 +77,101 @@ const CreateTagModal: React.FC<CreateTagModalProps> = ({ visible, onCancel, onSu
};
return (
- <Modal title="Create New Tag" open={visible} width={800} footer={null} onCancel={handleCancel}>
- <form onSubmit={form.handleSubmit(handleFinish)} noValidate>
- <TooltipProvider>
- <FieldGroup>
- <FormField control={form.control} name="tag_name" label="Tag Name">
- {({ ref, ...field }) => <Input {...field} ref={ref} />}
- </FormField>
-
- <FormField control={form.control} name="description" label="Description">
- {({ ref, value, ...field }) => <Textarea {...field} ref={ref} value={value ?? ""} rows={4} />}
- </FormField>
-
- <FormField
- control={form.control}
- name="allowed_llms"
- label={labelWithHint(
- "Allowed Models",
- "Select which models are allowed to process requests from this tag",
- )}
+ <Dialog open={visible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>Create New Tag</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={form.handleSubmit(handleFinish)} noValidate>
+ <TooltipProvider>
+ <FieldGroup>
+ <FormField control={form.control} name="tag_name" label="Tag Name">
+ {({ ref, ...field }) => <Input {...field} ref={ref} />}
+ </FormField>
+
+ <FormField control={form.control} name="description" label="Description">
+ {({ ref, value, ...field }) => <Textarea {...field} ref={ref} value={value ?? ""} rows={4} />}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="allowed_llms"
+ label={labelWithHint(
+ "Allowed Models",
+ "Select which models are allowed to process requests from this tag",
+ )}
+ >
+ {({ value, onChange }) => (
+ <MultiSelect
+ options={modelOptions}
+ value={value}
+ onValueChange={onChange}
+ placeholder="Select Models"
+ />
+ )}
+ </FormField>
+ </FieldGroup>
+
+ <Collapsible
+ open={budgetSectionOpen}
+ onOpenChange={setBudgetSectionOpen}
+ className="mt-4 mb-4 rounded-md border border-border"
>
- {({ value, onChange }) => (
- <MultiSelect
- options={modelOptions}
- value={value}
- onValueChange={onChange}
- placeholder="Select Models"
- />
- )}
- </FormField>
- </FieldGroup>
-
- <Collapsible
- open={budgetSectionOpen}
- onOpenChange={setBudgetSectionOpen}
- className="mt-4 mb-4 rounded-md border border-border"
- >
- <CollapsibleTrigger className="group flex w-full items-center justify-between px-4 py-3 text-base font-medium text-foreground">
- Budget & Rate Limits (Optional)
- <ChevronRight className="size-4 text-muted-foreground transition-transform group-data-panel-open:rotate-90" />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-4">
- <FieldGroup className="mt-4">
- <FormField
- control={form.control}
- name="max_budget"
- label={labelWithHint(
- "Max Budget (USD)",
- "Maximum amount in USD this tag can spend. When reached, requests with this tag will be blocked",
- )}
- >
- {({ ref, value, ...field }) => <NumericalInput {...field} value={value ?? ""} step={0.01} />}
- </FormField>
-
- <FormField
- control={form.control}
- name="budget_duration"
- label={labelWithHint(
- "Reset Budget",
- "How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",
- )}
- >
- {({ id, value, onChange }) => (
- <BudgetDurationDropdown id={id} value={value ?? null} onChange={onChange} />
- )}
- </FormField>
- </FieldGroup>
-
- <div className="mt-4 rounded-md border border-border bg-muted p-3">
- <p className="text-sm text-muted-foreground">
- TPM/RPM limits for tags are not currently supported. If you need this feature, please{" "}
- <a
- href="https://github.com/BerriAI/litellm/issues/new"
- target="_blank"
- rel="noopener noreferrer"
- className="text-blue-600 underline hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
+ <CollapsibleTrigger className="group flex w-full items-center justify-between px-4 py-3 text-base font-medium text-foreground">
+ Budget & Rate Limits (Optional)
+ <ChevronRight className="size-4 text-muted-foreground transition-transform group-data-panel-open:rotate-90" />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-4">
+ <FieldGroup className="mt-4">
+ <FormField
+ control={form.control}
+ name="max_budget"
+ label={labelWithHint(
+ "Max Budget (USD)",
+ "Maximum amount in USD this tag can spend. When reached, requests with this tag will be blocked",
+ )}
>
- create a GitHub issue
- </a>
- .
- </p>
- </div>
- </CollapsibleContent>
- </Collapsible>
-
- <div className="mt-2.5 text-right">
- <Button type="submit">Create Tag</Button>
- </div>
- </TooltipProvider>
- </form>
- </Modal>
+ {({ ref, value, ...field }) => <NumericalInput {...field} value={value ?? ""} step={0.01} />}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="budget_duration"
+ label={labelWithHint(
+ "Reset Budget",
+ "How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",
+ )}
+ >
+ {({ id, value, onChange }) => (
+ <BudgetDurationDropdown id={id} value={value ?? null} onChange={onChange} />
+ )}
+ </FormField>
+ </FieldGroup>
+
+ <div className="mt-4 rounded-md border border-border bg-muted p-3">
+ <p className="text-sm text-muted-foreground">
+ TPM/RPM limits for tags are not currently supported. If you need this feature, please{" "}
+ <a
+ href="https://github.com/BerriAI/litellm/issues/new"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-blue-600 underline hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
+ >
+ create a GitHub issue
+ </a>
+ .
+ </p>
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <div className="mt-2.5 text-right">
+ <Button type="submit">Create Tag</Button>
+ </div>
+ </TooltipProvider>
+ </form>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/BulkEditUsers.tsx b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/BulkEditUsers.tsx
index 207cee4bc1b..5e540baaaf9 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/BulkEditUsers.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/BulkEditUsers.tsx
@@ -1,9 +1,10 @@
import React, { useState } from "react";
-import { Modal, Typography, Divider, Table, Select, InputNumber, Card, Space, Checkbox } from "antd";
+import { Typography, Divider, Table, Select, InputNumber, Card, Space, Checkbox } from "antd";
import { userBulkUpdateUserCall, teamBulkMemberAddCall, Member } from "@/components/networking";
import { UserEditView } from "./user_edit_view";
import { toast } from "@/lib/toast";
import { MoneyCell } from "@/components/shared/table_cells";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const { Text, Title } = Typography;
@@ -200,163 +201,164 @@ const BulkEditUserModal: React.FC<BulkEditUserModalProps> = ({
};
return (
- <Modal
- open={open}
- onCancel={handleCancel}
- footer={null}
- title={updateAllUsers ? "Bulk Edit All Users" : `Bulk Edit ${selectedUsers.length} User(s)`}
- width={800}
- >
- {allowAllUsers && (
+ <Dialog open={open} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>
+ {updateAllUsers ? "Bulk Edit All Users" : `Bulk Edit ${selectedUsers.length} User(s)`}
+ </DialogTitle>
+ </DialogHeader>
+ {allowAllUsers && (
+ <div className="mb-4">
+ <Checkbox checked={updateAllUsers} onChange={(e) => setUpdateAllUsers(e.target.checked)}>
+ <Text strong>Update ALL users in the system</Text>
+ </Checkbox>
+ {updateAllUsers && (
+ <div style={{ marginTop: 8 }}>
+ <Text type="warning" style={{ fontSize: "12px" }}>
+ ⚠️ This will apply changes to ALL users in the system, not just the selected ones.
+ </Text>
+ </div>
+ )}
+ </div>
+ )}
+
+ {!updateAllUsers && (
+ <div className="mb-4">
+ <Title level={5}>Selected Users ({selectedUsers.length}):</Title>
+ <Table
+ size="small"
+ bordered
+ dataSource={selectedUsers}
+ pagination={false}
+ scroll={{ y: 200 }}
+ rowKey="user_id"
+ columns={[
+ {
+ title: "User ID",
+ dataIndex: "user_id",
+ key: "user_id",
+ width: "30%",
+ render: (text: string) => (
+ <Text strong style={{ fontSize: "12px" }}>
+ {text.length > 20 ? `${text.slice(0, 20)}...` : text}
+ </Text>
+ ),
+ },
+ {
+ title: "Email",
+ dataIndex: "user_email",
+ key: "user_email",
+ width: "25%",
+ render: (text: string) => (
+ <Text type="secondary" style={{ fontSize: "12px" }}>
+ {text || "No email"}
+ </Text>
+ ),
+ },
+ {
+ title: "Current Role",
+ dataIndex: "user_role",
+ key: "user_role",
+ width: "25%",
+ render: (role: string) => (
+ <Text style={{ fontSize: "12px" }}>{possibleUIRoles?.[role]?.ui_label || role}</Text>
+ ),
+ },
+ {
+ title: "Budget",
+ dataIndex: "max_budget",
+ key: "max_budget",
+ width: "20%",
+ render: (budget: number | null) => (
+ <MoneyCell value={budget} decimals={2} emptyText="Unlimited" showZero />
+ ),
+ },
+ ]}
+ />
+ </div>
+ )}
+
+ <Divider />
+
<div className="mb-4">
- <Checkbox checked={updateAllUsers} onChange={(e) => setUpdateAllUsers(e.target.checked)}>
- <Text strong>Update ALL users in the system</Text>
- </Checkbox>
- {updateAllUsers && (
- <div style={{ marginTop: 8 }}>
- <Text type="warning" style={{ fontSize: "12px" }}>
- ⚠️ This will apply changes to ALL users in the system, not just the selected ones.
- </Text>
- </div>
- )}
+ <Text>
+ <strong>Instructions:</strong> Fill in the fields below with the values you want to apply to all selected
+ users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams.
+ </Text>
</div>
- )}
- {!updateAllUsers && (
- <div className="mb-4">
- <Title level={5}>Selected Users ({selectedUsers.length}):</Title>
- <Table
- size="small"
- bordered
- dataSource={selectedUsers}
- pagination={false}
- scroll={{ y: 200 }}
- rowKey="user_id"
- columns={[
- {
- title: "User ID",
- dataIndex: "user_id",
- key: "user_id",
- width: "30%",
- render: (text: string) => (
- <Text strong style={{ fontSize: "12px" }}>
- {text.length > 20 ? `${text.slice(0, 20)}...` : text}
- </Text>
- ),
- },
- {
- title: "Email",
- dataIndex: "user_email",
- key: "user_email",
- width: "25%",
- render: (text: string) => (
+ {/* Team Management Section */}
+ <Card title="Team Management" size="small" className="mb-4" style={{ backgroundColor: "#fafafa" }}>
+ <Space direction="vertical" style={{ width: "100%" }}>
+ <Checkbox checked={addToTeams} onChange={(e) => setAddToTeams(e.target.checked)}>
+ Add selected users to teams
+ </Checkbox>
+
+ {addToTeams && (
+ <>
+ <div>
+ <Text strong>Select Teams:</Text>
+ <Select
+ mode="multiple"
+ placeholder="Select teams to add users to"
+ value={selectedTeams}
+ onChange={setSelectedTeams}
+ style={{ width: "100%", marginTop: 8 }}
+ options={
+ teams?.map((team) => ({
+ label: team.team_alias || team.team_id,
+ value: team.team_id,
+ })) || []
+ }
+ />
+ </div>
+
+ <div>
+ <Text strong>Team Budget (Optional):</Text>
+ <InputNumber
+ placeholder="Max budget per user in team"
+ value={teamBudget}
+ onChange={(value) => setTeamBudget(value)}
+ style={{ width: "100%", marginTop: 8 }}
+ min={0}
+ step={0.01}
+ precision={2}
+ />
<Text type="secondary" style={{ fontSize: "12px" }}>
- {text || "No email"}
+ Leave empty for unlimited budget within team limits
</Text>
- ),
- },
- {
- title: "Current Role",
- dataIndex: "user_role",
- key: "user_role",
- width: "25%",
- render: (role: string) => (
- <Text style={{ fontSize: "12px" }}>{possibleUIRoles?.[role]?.ui_label || role}</Text>
- ),
- },
- {
- title: "Budget",
- dataIndex: "max_budget",
- key: "max_budget",
- width: "20%",
- render: (budget: number | null) => (
- <MoneyCell value={budget} decimals={2} emptyText="Unlimited" showZero />
- ),
- },
- ]}
- />
- </div>
- )}
-
- <Divider />
-
- <div className="mb-4">
- <Text>
- <strong>Instructions:</strong> Fill in the fields below with the values you want to apply to all selected
- users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams.
- </Text>
- </div>
-
- {/* Team Management Section */}
- <Card title="Team Management" size="small" className="mb-4" style={{ backgroundColor: "#fafafa" }}>
- <Space direction="vertical" style={{ width: "100%" }}>
- <Checkbox checked={addToTeams} onChange={(e) => setAddToTeams(e.target.checked)}>
- Add selected users to teams
- </Checkbox>
-
- {addToTeams && (
- <>
- <div>
- <Text strong>Select Teams:</Text>
- <Select
- mode="multiple"
- placeholder="Select teams to add users to"
- value={selectedTeams}
- onChange={setSelectedTeams}
- style={{ width: "100%", marginTop: 8 }}
- options={
- teams?.map((team) => ({
- label: team.team_alias || team.team_id,
- value: team.team_id,
- })) || []
- }
- />
- </div>
+ </div>
- <div>
- <Text strong>Team Budget (Optional):</Text>
- <InputNumber
- placeholder="Max budget per user in team"
- value={teamBudget}
- onChange={(value) => setTeamBudget(value)}
- style={{ width: "100%", marginTop: 8 }}
- min={0}
- step={0.01}
- precision={2}
- />
<Text type="secondary" style={{ fontSize: "12px" }}>
- Leave empty for unlimited budget within team limits
+ Users will be added with &quot;user&quot; role by default. All users will be added to each selected
+ team.
</Text>
- </div>
-
- <Text type="secondary" style={{ fontSize: "12px" }}>
- Users will be added with &quot;user&quot; role by default. All users will be added to each selected
- team.
- </Text>
- </>
- )}
- </Space>
- </Card>
-
- <UserEditView
- userData={mockUserData}
- onCancel={handleCancel}
- onSubmit={handleSubmit}
- teams={teams}
- accessToken={accessToken}
- userID="bulk_edit"
- userRole={userRole}
- userModels={userModels}
- possibleUIRoles={possibleUIRoles}
- isBulkEdit={true}
- />
-
- {loading && (
- <div style={{ textAlign: "center", marginTop: "10px" }}>
- <Text>Updating {updateAllUsers ? "all users" : selectedUsers.length} user(s)...</Text>
- </div>
- )}
- </Modal>
+ </>
+ )}
+ </Space>
+ </Card>
+
+ <UserEditView
+ userData={mockUserData}
+ onCancel={handleCancel}
+ onSubmit={handleSubmit}
+ teams={teams}
+ accessToken={accessToken}
+ userID="bulk_edit"
+ userRole={userRole}
+ userModels={userModels}
+ possibleUIRoles={possibleUIRoles}
+ isBulkEdit={true}
+ />
+
+ {loading && (
+ <div style={{ textAlign: "center", marginTop: "10px" }}>
+ <Text>Updating {updateAllUsers ? "all users" : selectedUsers.length} user(s)...</Text>
+ </div>
+ )}
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx
index 9fb4dad67e4..3db7e010a71 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx
@@ -18,7 +18,6 @@ import {
Member,
} from "@/components/networking";
import { SimpleTooltip } from "@/components/ui/tooltip";
-import { Modal } from "antd";
import { Field, FieldGroup, FieldLabel } from "@/components/shared/form/field";
import {
Combobox,
@@ -43,6 +42,7 @@ import MCPServerPermissions from "@/components/permissions/MCPServerPermissions"
import { useMCPServers } from "@/app/(dashboard)/hooks/mcpServers/useMCPServers";
import { useMCPToolsets } from "@/app/(dashboard)/hooks/mcpServers/useMCPToolsets";
import { extractMcpEntitlement } from "@/components/mcp_server_management/mcpEntitlement";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface UserInfoViewProps {
userId: string;
@@ -703,71 +703,73 @@ export default function UserInfoView({
/>
{/* Add to Team Modal */}
- <Modal
- title="Add User to Team"
+ <Dialog
open={isAddTeamModalOpen}
- onCancel={() => setIsAddTeamModalOpen(false)}
- footer={null}
- width={500}
- maskClosable={!isAddingTeam}
+ onOpenChange={(open) => !open && setIsAddTeamModalOpen(false)}
+ disablePointerDismissal={isAddingTeam}
>
- <form
- onSubmit={(event) => {
- event.preventDefault();
- handleAddTeamSubmit();
- }}
- >
- <FieldGroup>
- <Field>
- <FieldLabel htmlFor={ADD_TEAM_FIELD_ID}>Team</FieldLabel>
- <Combobox
- items={availableTeamsForAdd}
- value={selectedTeamOption}
- onValueChange={(team: TeamOption | null) => setSelectedTeamId(team?.team_id ?? "")}
- itemToStringLabel={(team: TeamOption) => team.team_alias}
- isItemEqualToValue={(team: TeamOption, value: TeamOption) => team.team_id === value.team_id}
- >
- <ComboboxInput id={ADD_TEAM_FIELD_ID} placeholder="Select a team" className="w-full" />
- <ComboboxContent>
- <ComboboxEmpty>No teams found</ComboboxEmpty>
- <ComboboxList>
- {(team: TeamOption) => (
- <ComboboxItem key={team.team_id} value={team} title={team.team_alias}>
- {team.team_alias}
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
- </Field>
-
- <Field>
- <FieldLabel htmlFor={ADD_TEAM_ROLE_FIELD_ID}>Member Role</FieldLabel>
- <Select value={selectedRole} onValueChange={(value) => value !== null && setSelectedRole(value)}>
- <SelectTrigger id={ADD_TEAM_ROLE_FIELD_ID} className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {MEMBER_ROLE_OPTIONS.map((option) => (
- <SelectItem key={option.value} value={option.value} title={option.value}>
- <SimpleTooltip content={option.hint}>
- <span className="font-medium">{option.value}</span>
- <span className="ml-2 text-muted-foreground text-sm">- {option.hint}</span>
- </SimpleTooltip>
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </Field>
- </FieldGroup>
-
- <div className="text-right mt-4">
- <Button type="submit" disabled={isAddingTeam || !selectedTeamId} aria-busy={isAddingTeam}>
- {isAddingTeam ? "Adding..." : "Add to Team"}
- </Button>
- </div>
- </form>
- </Modal>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[500px]">
+ <DialogHeader>
+ <DialogTitle>Add User to Team</DialogTitle>
+ </DialogHeader>
+ <form
+ onSubmit={(event) => {
+ event.preventDefault();
+ handleAddTeamSubmit();
+ }}
+ >
+ <FieldGroup>
+ <Field>
+ <FieldLabel htmlFor={ADD_TEAM_FIELD_ID}>Team</FieldLabel>
+ <Combobox
+ items={availableTeamsForAdd}
+ value={selectedTeamOption}
+ onValueChange={(team: TeamOption | null) => setSelectedTeamId(team?.team_id ?? "")}
+ itemToStringLabel={(team: TeamOption) => team.team_alias}
+ isItemEqualToValue={(team: TeamOption, value: TeamOption) => team.team_id === value.team_id}
+ >
+ <ComboboxInput id={ADD_TEAM_FIELD_ID} placeholder="Select a team" className="w-full" />
+ <ComboboxContent>
+ <ComboboxEmpty>No teams found</ComboboxEmpty>
+ <ComboboxList>
+ {(team: TeamOption) => (
+ <ComboboxItem key={team.team_id} value={team} title={team.team_alias}>
+ {team.team_alias}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ </Field>
+
+ <Field>
+ <FieldLabel htmlFor={ADD_TEAM_ROLE_FIELD_ID}>Member Role</FieldLabel>
+ <Select value={selectedRole} onValueChange={(value) => value !== null && setSelectedRole(value)}>
+ <SelectTrigger id={ADD_TEAM_ROLE_FIELD_ID} className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {MEMBER_ROLE_OPTIONS.map((option) => (
+ <SelectItem key={option.value} value={option.value} title={option.value}>
+ <SimpleTooltip content={option.hint}>
+ <span className="font-medium">{option.value}</span>
+ <span className="ml-2 text-muted-foreground text-sm">- {option.hint}</span>
+ </SimpleTooltip>
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+ </FieldGroup>
+
+ <div className="text-right mt-4">
+ <Button type="submit" disabled={isAddingTeam || !selectedTeamId} aria-busy={isAddingTeam}>
+ {isAddingTeam ? "Adding..." : "Add to Team"}
+ </Button>
+ </div>
+ </form>
+ </DialogContent>
+ </Dialog>
</div>
);
}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx
index ff6c10bf428..0c7d8cebb4b 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx
@@ -1,5 +1,4 @@
import React, { useState, useEffect } from "react";
-import { Modal } from "antd";
import { CircleHelp, Eye, EyeOff, Info } from "lucide-react";
import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { useWatch } from "react-hook-form";
@@ -27,6 +26,7 @@ import {
ComboboxItem,
ComboboxList,
} from "@/components/ui/combobox";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
@@ -265,268 +265,274 @@ const VectorStoreForm: React.FC<VectorStoreFormProps> = ({
: "Enter vector store ID from your provider";
return (
- <Modal title="Add New Vector Store" open={isVisible} width={1000} footer={null} onCancel={handleCancel}>
- <TooltipProvider>
- <form onSubmit={form.handleSubmit(handleCreate)}>
- <FieldGroup>
- <FormField
- control={form.control}
- name="custom_llm_provider"
- label={labelWithHint("Provider", "Select the provider for this vector store")}
- >
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Select value={value} onValueChange={makeProviderChangeHandler(onChange)}>
- <SelectTrigger
- id={id}
- aria-invalid={ariaInvalid}
- aria-describedby={ariaDescribedBy}
- className="w-full"
- >
- <SelectValue>
- {(provider: string) => {
- const { displayName, logo } = getVectorStoreProviderLogoAndName(provider);
- return (
- <>
- <Logo src={logo} label={displayName} className="w-5 h-5" />
- <span>{displayName}</span>
- </>
- );
- }}
- </SelectValue>
- </SelectTrigger>
- <SelectContent alignItemWithTrigger={false}>
- {Object.entries(VectorStoreProviders).map(([providerEnum, providerDisplayName]) => (
- <SelectItem key={providerEnum} value={vectorStoreProviderMap[providerEnum]}>
- <Logo
- src={vectorStoreProviderLogoMap[providerDisplayName]}
- label={providerDisplayName}
- className="w-5 h-5"
- />
- <span>{providerDisplayName}</span>
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ <Dialog open={isVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <DialogTitle>Add New Vector Store</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={form.handleSubmit(handleCreate)}>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="custom_llm_provider"
+ label={labelWithHint("Provider", "Select the provider for this vector store")}
+ >
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Select value={value} onValueChange={makeProviderChangeHandler(onChange)}>
+ <SelectTrigger
+ id={id}
+ aria-invalid={ariaInvalid}
+ aria-describedby={ariaDescribedBy}
+ className="w-full"
+ >
+ <SelectValue>
+ {(provider: string) => {
+ const { displayName, logo } = getVectorStoreProviderLogoAndName(provider);
+ return (
+ <>
+ <Logo src={logo} label={displayName} className="w-5 h-5" />
+ <span>{displayName}</span>
+ </>
+ );
+ }}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent alignItemWithTrigger={false}>
+ {Object.entries(VectorStoreProviders).map(([providerEnum, providerDisplayName]) => (
+ <SelectItem key={providerEnum} value={vectorStoreProviderMap[providerEnum]}>
+ <Logo
+ src={vectorStoreProviderLogoMap[providerDisplayName]}
+ label={providerDisplayName}
+ className="w-5 h-5"
+ />
+ <span>{providerDisplayName}</span>
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+
+ {selectedProvider === "pg_vector" && (
+ <Alert variant="info">
+ <Info />
+ <AlertTitle>PG Vector Setup Required</AlertTitle>
+ <AlertDescription>
+ <p>LiteLLM provides a server to connect to PG Vector. To use this provider:</p>
+ <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
+ <li>
+ Deploy the litellm-pgvector server from:{" "}
+ <a href="https://github.com/BerriAI/litellm-pgvector" target="_blank" rel="noopener noreferrer">
+ https://github.com/BerriAI/litellm-pgvector
+ </a>
+ </li>
+ <li>Configure your PostgreSQL database with pgvector extension</li>
+ <li>Start the server and note the API base URL and API key</li>
+ <li>Enter those details in the fields below</li>
+ </ol>
+ </AlertDescription>
+ </Alert>
)}
- </FormField>
-
- {selectedProvider === "pg_vector" && (
- <Alert variant="info">
- <Info />
- <AlertTitle>PG Vector Setup Required</AlertTitle>
- <AlertDescription>
- <p>LiteLLM provides a server to connect to PG Vector. To use this provider:</p>
- <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
- <li>
- Deploy the litellm-pgvector server from:{" "}
- <a href="https://github.com/BerriAI/litellm-pgvector" target="_blank" rel="noopener noreferrer">
- https://github.com/BerriAI/litellm-pgvector
- </a>
- </li>
- <li>Configure your PostgreSQL database with pgvector extension</li>
- <li>Start the server and note the API base URL and API key</li>
- <li>Enter those details in the fields below</li>
- </ol>
- </AlertDescription>
- </Alert>
- )}
-
- {selectedProvider === "valkey" && (
- <Alert variant="info">
- <Info />
- <AlertTitle>Valkey Setup Required</AlertTitle>
- <AlertDescription>
- <p>
- LiteLLM searches documents you have already stored in Valkey. It does not create the index or upload
- documents for you. Before creating this vector store, make sure:
- </p>
- <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
- <li>
- Your Valkey server has vector search enabled (the valkey-search module, included in the
- valkey-bundle image and in AWS ElastiCache / MemoryDB for Valkey)
- </li>
- <li>
- You have already created a search index and loaded your documents and their embeddings into it.
- Enter that index name as the Vector Store ID
- </li>
- <li>
- You know which embedding model created those stored embeddings. That model must be added to this
- proxy under Models so you can pick it below. Using a different model returns wrong results
- </li>
- <li>
- You know the field names your documents use for their text and their embedding. If they are not
- &quot;text&quot; and &quot;embedding&quot;, set them below
- </li>
- </ol>
- <p style={{ marginTop: "8px" }}>
- When a query comes in, LiteLLM converts it to an embedding with the model below and returns the
- closest matching documents from your index.
- </p>
- </AlertDescription>
- </Alert>
- )}
-
- {selectedProvider === "vertex_rag_engine" && (
- <Alert variant="info">
- <Info />
- <AlertTitle>Vertex AI RAG Engine Setup</AlertTitle>
- <AlertDescription>
- <p>To use Vertex AI RAG Engine:</p>
- <p style={{ marginTop: "4px", fontStyle: "italic" }}>
- Note: Google Cloud has renamed this to &quot;RAG Engine&quot; in its console — the steps below still
- apply.
- </p>
- <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
- <li>
- Set up your Vertex AI RAG Engine corpus following the guide:{" "}
- <a
- href="https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview"
- target="_blank"
- rel="noopener noreferrer"
- >
- Vertex AI RAG Engine Overview
- </a>
- </li>
- <li>Create a corpus in your Google Cloud project</li>
- <li>
- Note the corpus ID from the Vertex AI console (now labeled &quot;RAG Engine&quot; in Google Cloud)
- </li>
- <li>Enter the corpus ID in the Vector Store ID field below</li>
- </ol>
- </AlertDescription>
- </Alert>
- )}
-
- {selectedProvider === "vertex_ai/search_api" && (
- <Alert variant="info">
- <Info />
- <AlertTitle>Vertex AI Search Setup</AlertTitle>
- <AlertDescription>
- <p>To use Vertex AI Search (Discovery Engine):</p>
- <p style={{ marginTop: "4px", fontStyle: "italic" }}>
- Note: Google Cloud has renamed this to &quot;Agent Search&quot; in its console — the steps below
- still apply.
- </p>
- <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
- <li>
- Enable the Discovery Engine API on your Google Cloud project and create a data store following the
- guide:{" "}
- <a
- href="https://cloud.google.com/generative-ai-app-builder/docs/create-data-store-es"
- target="_blank"
- rel="noopener noreferrer"
- style={{ textDecoration: "underline" }}
- >
- Create a Vertex AI Search data store
- </a>
- </li>
- <li>Pick a supported location: global, us, or eu</li>
- <li>
- For most data store types (Cloud Storage, BigQuery, Media): copy the data store ID and enter it in
- the Vector Store ID field below.
- </li>
- <li>
- For website, healthcare, and connector-based sources (Drive, Gmail, Slack, Jira, etc.): create a
- search app on top of the data store, then copy the <strong>Engine ID</strong> and enter it in the
- Engine ID field. The Vector Store ID is still required as the LiteLLM-side name for this record,
- but it isn&apos;t used in the GCP URL when Engine ID is set.
- </li>
- </ol>
- </AlertDescription>
- </Alert>
- )}
-
- <FormField
- control={form.control}
- name="vector_store_id"
- label={labelWithHint("Vector Store ID", "Enter the vector store ID from your api provider")}
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder={vectorStoreIdPlaceholder} />}
- </FormField>
-
- {getProviderSpecificFields(selectedProvider)
- .filter(isSupportedProviderField)
- .map((field) => (
- <ProviderField key={field.name} field={field} control={form.control} modelInfo={modelInfo} />
- ))}
-
- <FormField
- control={form.control}
- name="vector_store_name"
- label={labelWithHint(
- "Vector Store Name",
- "Custom name you want to give to the vector store, this name will be rendered on the LiteLLM UI",
+
+ {selectedProvider === "valkey" && (
+ <Alert variant="info">
+ <Info />
+ <AlertTitle>Valkey Setup Required</AlertTitle>
+ <AlertDescription>
+ <p>
+ LiteLLM searches documents you have already stored in Valkey. It does not create the index or
+ upload documents for you. Before creating this vector store, make sure:
+ </p>
+ <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
+ <li>
+ Your Valkey server has vector search enabled (the valkey-search module, included in the
+ valkey-bundle image and in AWS ElastiCache / MemoryDB for Valkey)
+ </li>
+ <li>
+ You have already created a search index and loaded your documents and their embeddings into it.
+ Enter that index name as the Vector Store ID
+ </li>
+ <li>
+ You know which embedding model created those stored embeddings. That model must be added to this
+ proxy under Models so you can pick it below. Using a different model returns wrong results
+ </li>
+ <li>
+ You know the field names your documents use for their text and their embedding. If they are not
+ &quot;text&quot; and &quot;embedding&quot;, set them below
+ </li>
+ </ol>
+ <p style={{ marginTop: "8px" }}>
+ When a query comes in, LiteLLM converts it to an embedding with the model below and returns the
+ closest matching documents from your index.
+ </p>
+ </AlertDescription>
+ </Alert>
)}
- >
- {({ ref, value, ...field }) => <Input {...field} ref={ref} value={value ?? ""} />}
- </FormField>
-
- <FormField control={form.control} name="vector_store_description" label="Description">
- {({ ref, value, ...field }) => <Textarea {...field} ref={ref} value={value ?? ""} rows={4} />}
- </FormField>
-
- <FormField
- control={form.control}
- name="litellm_credential_name"
- label={labelWithHint(
- "Existing Credentials",
- "Optionally select API provider credentials for this vector store eg. Bedrock API KEY",
+
+ {selectedProvider === "vertex_rag_engine" && (
+ <Alert variant="info">
+ <Info />
+ <AlertTitle>Vertex AI RAG Engine Setup</AlertTitle>
+ <AlertDescription>
+ <p>To use Vertex AI RAG Engine:</p>
+ <p style={{ marginTop: "4px", fontStyle: "italic" }}>
+ Note: Google Cloud has renamed this to &quot;RAG Engine&quot; in its console — the steps below
+ still apply.
+ </p>
+ <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
+ <li>
+ Set up your Vertex AI RAG Engine corpus following the guide:{" "}
+ <a
+ href="https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Vertex AI RAG Engine Overview
+ </a>
+ </li>
+ <li>Create a corpus in your Google Cloud project</li>
+ <li>
+ Note the corpus ID from the Vertex AI console (now labeled &quot;RAG Engine&quot; in Google
+ Cloud)
+ </li>
+ <li>Enter the corpus ID in the Vector Store ID field below</li>
+ </ol>
+ </AlertDescription>
+ </Alert>
)}
- >
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Combobox
- items={credentialOptions}
- value={credentialOptions.find((option) => option.value === value) ?? null}
- onValueChange={(option: CredentialOption | null) => onChange(option ? option.value : undefined)}
- itemToStringLabel={(option: CredentialOption) => option.label}
- isItemEqualToValue={(option: CredentialOption, selected: CredentialOption) =>
- option.value === selected.value
- }
- >
- <ComboboxInput
- id={id}
- aria-invalid={ariaInvalid}
- aria-describedby={ariaDescribedBy}
- placeholder="Select or search for existing credentials"
- className="w-full"
- showClear={value !== undefined}
- />
- <ComboboxContent>
- <ComboboxEmpty>No matching credentials</ComboboxEmpty>
- <ComboboxList>
- {(option: CredentialOption) => (
- <ComboboxItem key={option.label} value={option}>
- {option.label}
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
+
+ {selectedProvider === "vertex_ai/search_api" && (
+ <Alert variant="info">
+ <Info />
+ <AlertTitle>Vertex AI Search Setup</AlertTitle>
+ <AlertDescription>
+ <p>To use Vertex AI Search (Discovery Engine):</p>
+ <p style={{ marginTop: "4px", fontStyle: "italic" }}>
+ Note: Google Cloud has renamed this to &quot;Agent Search&quot; in its console — the steps below
+ still apply.
+ </p>
+ <ol style={{ marginLeft: "16px", marginTop: "8px", listStyleType: "decimal" }}>
+ <li>
+ Enable the Discovery Engine API on your Google Cloud project and create a data store following
+ the guide:{" "}
+ <a
+ href="https://cloud.google.com/generative-ai-app-builder/docs/create-data-store-es"
+ target="_blank"
+ rel="noopener noreferrer"
+ style={{ textDecoration: "underline" }}
+ >
+ Create a Vertex AI Search data store
+ </a>
+ </li>
+ <li>Pick a supported location: global, us, or eu</li>
+ <li>
+ For most data store types (Cloud Storage, BigQuery, Media): copy the data store ID and enter it
+ in the Vector Store ID field below.
+ </li>
+ <li>
+ For website, healthcare, and connector-based sources (Drive, Gmail, Slack, Jira, etc.): create a
+ search app on top of the data store, then copy the <strong>Engine ID</strong> and enter it in
+ the Engine ID field. The Vector Store ID is still required as the LiteLLM-side name for this
+ record, but it isn&apos;t used in the GCP URL when Engine ID is set.
+ </li>
+ </ol>
+ </AlertDescription>
+ </Alert>
)}
- </FormField>
-
- <div role="group" className="flex w-full flex-col gap-3">
- <span className="flex w-fit gap-2 text-sm leading-snug font-medium">
- {labelWithHint("Metadata", "JSON metadata for the vector store (optional)")}
- </span>
- <Textarea
- rows={4}
- value={metadataJson}
- onChange={(event) => setMetadataJson(event.target.value)}
- placeholder='{"key": "value"}'
- />
+
+ <FormField
+ control={form.control}
+ name="vector_store_id"
+ label={labelWithHint("Vector Store ID", "Enter the vector store ID from your api provider")}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder={vectorStoreIdPlaceholder} />}
+ </FormField>
+
+ {getProviderSpecificFields(selectedProvider)
+ .filter(isSupportedProviderField)
+ .map((field) => (
+ <ProviderField key={field.name} field={field} control={form.control} modelInfo={modelInfo} />
+ ))}
+
+ <FormField
+ control={form.control}
+ name="vector_store_name"
+ label={labelWithHint(
+ "Vector Store Name",
+ "Custom name you want to give to the vector store, this name will be rendered on the LiteLLM UI",
+ )}
+ >
+ {({ ref, value, ...field }) => <Input {...field} ref={ref} value={value ?? ""} />}
+ </FormField>
+
+ <FormField control={form.control} name="vector_store_description" label="Description">
+ {({ ref, value, ...field }) => <Textarea {...field} ref={ref} value={value ?? ""} rows={4} />}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="litellm_credential_name"
+ label={labelWithHint(
+ "Existing Credentials",
+ "Optionally select API provider credentials for this vector store eg. Bedrock API KEY",
+ )}
+ >
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Combobox
+ items={credentialOptions}
+ value={credentialOptions.find((option) => option.value === value) ?? null}
+ onValueChange={(option: CredentialOption | null) => onChange(option ? option.value : undefined)}
+ itemToStringLabel={(option: CredentialOption) => option.label}
+ isItemEqualToValue={(option: CredentialOption, selected: CredentialOption) =>
+ option.value === selected.value
+ }
+ >
+ <ComboboxInput
+ id={id}
+ aria-invalid={ariaInvalid}
+ aria-describedby={ariaDescribedBy}
+ placeholder="Select or search for existing credentials"
+ className="w-full"
+ showClear={value !== undefined}
+ />
+ <ComboboxContent>
+ <ComboboxEmpty>No matching credentials</ComboboxEmpty>
+ <ComboboxList>
+ {(option: CredentialOption) => (
+ <ComboboxItem key={option.label} value={option}>
+ {option.label}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ )}
+ </FormField>
+
+ <div role="group" className="flex w-full flex-col gap-3">
+ <span className="flex w-fit gap-2 text-sm leading-snug font-medium">
+ {labelWithHint("Metadata", "JSON metadata for the vector store (optional)")}
+ </span>
+ <Textarea
+ rows={4}
+ value={metadataJson}
+ onChange={(event) => setMetadataJson(event.target.value)}
+ placeholder='{"key": "value"}'
+ />
+ </div>
+ </FieldGroup>
+
+ <div className="mt-6 flex justify-end space-x-3">
+ <Button type="button" variant="outline" onClick={handleCancel}>
+ Cancel
+ </Button>
+ <Button type="submit">Create</Button>
</div>
- </FieldGroup>
-
- <div className="mt-6 flex justify-end space-x-3">
- <Button type="button" variant="outline" onClick={handleCancel}>
- Cancel
- </Button>
- <Button type="submit">Create</Button>
- </div>
- </form>
- </TooltipProvider>
- </Modal>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroCreateModal.tsx b/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroCreateModal.tsx
index 4b1bffb5f52..5d89386493d 100644
--- a/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroCreateModal.tsx
+++ b/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroCreateModal.tsx
@@ -1,4 +1,3 @@
-import { Modal } from "antd";
import { useEffect } from "react";
import { z } from "zod/v4";
@@ -13,6 +12,8 @@ import { toast } from "@/lib/toast";
import { CloudZeroApiKeyInput, labelWithHint } from "./CloudZeroFormControls";
import { buildCloudZeroPayload, EMPTY_CLOUDZERO_FORM_VALUES, type CloudZeroFormValues } from "./cloudZeroPayload";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
interface CloudZeroCreationModalProps {
open: boolean;
@@ -56,42 +57,45 @@ export default function CloudZeroCreationModal({ open, onOk, onCancel }: CloudZe
};
return (
- <Modal
- title="Create CloudZero Integration"
- open={open}
- onOk={() => void form.handleSubmit(handleSubmit)()}
- onCancel={handleCancel}
- confirmLoading={createMutation.isPending}
- okText={createMutation.isPending ? "Creating..." : "Create"}
- cancelText="Cancel"
- okButtonProps={{
- disabled: createMutation.isPending,
- }}
- cancelButtonProps={{
- disabled: createMutation.isPending,
- }}
- >
- <TooltipProvider>
- <form onSubmit={(event) => event.preventDefault()} noValidate>
- <FieldGroup>
- <FormField control={form.control} name="api_key" label="CloudZero API Key">
- {({ ref, ...field }) => (
- <CloudZeroApiKeyInput {...field} ref={ref} placeholder="Enter your CloudZero API key" />
- )}
- </FormField>
- <FormField control={form.control} name="connection_id" label="Connection ID">
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="Enter your CloudZero connection ID" />}
- </FormField>
- <FormField
- control={form.control}
- name="timezone"
- label={labelWithHint("Timezone", "Timezone for date handling (defaults to UTC if not provided)")}
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="UTC" />}
- </FormField>
- </FieldGroup>
- </form>
- </TooltipProvider>
- </Modal>
+ <Dialog open={open} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Create CloudZero Integration</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={(event) => event.preventDefault()} noValidate>
+ <FieldGroup>
+ <FormField control={form.control} name="api_key" label="CloudZero API Key">
+ {({ ref, ...field }) => (
+ <CloudZeroApiKeyInput {...field} ref={ref} placeholder="Enter your CloudZero API key" />
+ )}
+ </FormField>
+ <FormField control={form.control} name="connection_id" label="Connection ID">
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="Enter your CloudZero connection ID" />}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="timezone"
+ label={labelWithHint("Timezone", "Timezone for date handling (defaults to UTC if not provided)")}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="UTC" />}
+ </FormField>
+ </FieldGroup>
+ </form>
+ </TooltipProvider>
+ <DialogFooter>
+ <Button variant="outline" onClick={handleCancel} disabled={createMutation.isPending}>
+ Cancel
+ </Button>
+ <Button
+ onClick={() => void form.handleSubmit(handleSubmit)()}
+ disabled={createMutation.isPending}
+ aria-busy={createMutation.isPending}
+ >
+ {createMutation.isPending ? "Creating..." : "Create"}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroUpdateModal.tsx b/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroUpdateModal.tsx
index 74c16624887..ceee32df4aa 100644
--- a/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroUpdateModal.tsx
+++ b/ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroUpdateModal.tsx
@@ -1,4 +1,3 @@
-import { Modal } from "antd";
import { useEffect } from "react";
import { z } from "zod/v4";
@@ -14,6 +13,8 @@ import { toast } from "@/lib/toast";
import { CloudZeroApiKeyInput, labelWithHint } from "./CloudZeroFormControls";
import { buildCloudZeroPayload, EMPTY_CLOUDZERO_FORM_VALUES, type CloudZeroFormValues } from "./cloudZeroPayload";
import { CloudZeroSettings } from "./types";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
interface CloudZeroUpdateModalProps {
open: boolean;
@@ -64,46 +65,49 @@ export default function CloudZeroUpdateModal({ open, onOk, onCancel, settings }:
};
return (
- <Modal
- title="Edit CloudZero Integration"
- open={open}
- onOk={() => void form.handleSubmit(handleSubmit)()}
- onCancel={handleCancel}
- confirmLoading={updateMutation.isPending}
- okText={updateMutation.isPending ? "Updating..." : "Update"}
- cancelText="Cancel"
- okButtonProps={{
- disabled: updateMutation.isPending,
- }}
- cancelButtonProps={{
- disabled: updateMutation.isPending,
- }}
- >
- <TooltipProvider>
- <form onSubmit={(event) => event.preventDefault()} noValidate>
- <FieldGroup>
- <FormField
- control={form.control}
- name="api_key"
- label={labelWithHint("CloudZero API Key", "Leave empty to keep the existing API key")}
- >
- {({ ref, ...field }) => (
- <CloudZeroApiKeyInput {...field} ref={ref} placeholder="Leave empty to keep existing" />
- )}
- </FormField>
- <FormField control={form.control} name="connection_id" label="Connection ID">
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="Enter your CloudZero connection ID" />}
- </FormField>
- <FormField
- control={form.control}
- name="timezone"
- label={labelWithHint("Timezone", "Timezone for date handling (defaults to UTC if not provided)")}
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="UTC" />}
- </FormField>
- </FieldGroup>
- </form>
- </TooltipProvider>
- </Modal>
+ <Dialog open={open} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Edit CloudZero Integration</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={(event) => event.preventDefault()} noValidate>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="api_key"
+ label={labelWithHint("CloudZero API Key", "Leave empty to keep the existing API key")}
+ >
+ {({ ref, ...field }) => (
+ <CloudZeroApiKeyInput {...field} ref={ref} placeholder="Leave empty to keep existing" />
+ )}
+ </FormField>
+ <FormField control={form.control} name="connection_id" label="Connection ID">
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="Enter your CloudZero connection ID" />}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="timezone"
+ label={labelWithHint("Timezone", "Timezone for date handling (defaults to UTC if not provided)")}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="UTC" />}
+ </FormField>
+ </FieldGroup>
+ </form>
+ </TooltipProvider>
+ <DialogFooter>
+ <Button variant="outline" onClick={handleCancel} disabled={updateMutation.isPending}>
+ Cancel
+ </Button>
+ <Button
+ onClick={() => void form.handleSubmit(handleSubmit)()}
+ disabled={updateMutation.isPending}
+ aria-busy={updateMutation.isPending}
+ >
+ {updateMutation.isPending ? "Updating..." : "Update"}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/components/SSOModals.tsx b/ui/litellm-dashboard/src/components/SSOModals.tsx
index 2bcc7849449..e20d6ab3093 100644
--- a/ui/litellm-dashboard/src/components/SSOModals.tsx
+++ b/ui/litellm-dashboard/src/components/SSOModals.tsx
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { FormProvider, useWatch, type UseFormReturn } from "react-hook-form";
-import { Modal } from "antd";
import { getSSOSettings, updateSSOSettings } from "./networking";
import { toast } from "@/lib/toast";
import { parseErrorMessage } from "./shared/errorUtils";
@@ -18,6 +17,7 @@ import {
submitMountedSSOValues,
type SSOSettingsFormValues,
} from "./Settings/AdminSettings/SSOSettings/Modals/BaseSSOSettingsForm";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface SSOModalsProps {
isAddSSOModalVisible: boolean;
@@ -247,85 +247,80 @@ const SSOModals: React.FC<SSOModalsProps> = ({
// Helper function to render provider fields
return (
<>
- <Modal
- title={ssoConfigured ? "Edit SSO Settings" : "Add SSO"}
- open={isAddSSOModalVisible}
- width={800}
- footer={null}
- onOk={handleAddSSOOk}
- onCancel={handleAddSSOCancel}
- >
- <FormProvider {...form}>
- <form
- onSubmit={(event) => {
- event.preventDefault();
- submitMountedSSOValues(form, "admin-panel", handleFormSubmit)();
- }}
- >
- <FieldGroup>
- <SSOProviderSelectField />
- {provider ? renderProviderFields(provider) : null}
- <ProxyAdminEmailField />
- <ProxyBaseUrlField />
- {showRoleMappingToggle && <MappingToggleField name="use_role_mappings" label="Use Role Mappings" />}
- {useRoleMappings && (
- <>
- <GroupClaimField />
- <RoleMappingTeamFields />
- </>
- )}
- </FieldGroup>
- <div className="mt-4 flex items-center justify-end gap-2">
- {ssoConfigured && (
- <Button type="button" variant="secondary" onClick={() => setIsClearConfirmModalVisible(true)}>
- Clear
- </Button>
- )}
- <Button type="submit">Save</Button>
- </div>
- </form>
- </FormProvider>
- </Modal>
+ <Dialog open={isAddSSOModalVisible} onOpenChange={(open) => !open && handleAddSSOCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>{ssoConfigured ? "Edit SSO Settings" : "Add SSO"}</DialogTitle>
+ </DialogHeader>
+ <FormProvider {...form}>
+ <form
+ onSubmit={(event) => {
+ event.preventDefault();
+ submitMountedSSOValues(form, "admin-panel", handleFormSubmit)();
+ }}
+ >
+ <FieldGroup>
+ <SSOProviderSelectField />
+ {provider ? renderProviderFields(provider) : null}
+ <ProxyAdminEmailField />
+ <ProxyBaseUrlField />
+ {showRoleMappingToggle && <MappingToggleField name="use_role_mappings" label="Use Role Mappings" />}
+ {useRoleMappings && (
+ <>
+ <GroupClaimField />
+ <RoleMappingTeamFields />
+ </>
+ )}
+ </FieldGroup>
+ <div className="mt-4 flex items-center justify-end gap-2">
+ {ssoConfigured && (
+ <Button type="button" variant="secondary" onClick={() => setIsClearConfirmModalVisible(true)}>
+ Clear
+ </Button>
+ )}
+ <Button type="submit">Save</Button>
+ </div>
+ </form>
+ </FormProvider>
+ </DialogContent>
+ </Dialog>
{/* Clear Confirmation Modal */}
- <Modal
- title="Confirm Clear SSO Settings"
- open={isClearConfirmModalVisible}
- onOk={handleClearSSO}
- onCancel={() => setIsClearConfirmModalVisible(false)}
- okText="Yes, Clear"
- cancelText="Cancel"
- okButtonProps={{
- danger: true,
- style: {
- backgroundColor: "#dc2626",
- borderColor: "#dc2626",
- },
- }}
- >
- <p>Are you sure you want to clear all SSO settings? This action cannot be undone.</p>
- <p>Users will no longer be able to login using SSO after this change.</p>
- </Modal>
+ <Dialog open={isClearConfirmModalVisible} onOpenChange={(open) => !open && setIsClearConfirmModalVisible(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Confirm Clear SSO Settings</DialogTitle>
+ </DialogHeader>
+ <p>Are you sure you want to clear all SSO settings? This action cannot be undone.</p>
+ <p>Users will no longer be able to login using SSO after this change.</p>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setIsClearConfirmModalVisible(false)}>
+ Cancel
+ </Button>
+ <Button onClick={handleClearSSO} variant="destructive">
+ Yes, Clear
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
- <Modal
- title="SSO Setup Instructions"
- open={isInstructionsModalVisible}
- width={800}
- footer={null}
- onOk={handleInstructionsOk}
- onCancel={handleInstructionsCancel}
- >
- <p>Follow these steps to complete the SSO setup:</p>
- <p className="text-sm mt-2">1. DO NOT Exit this TAB</p>
- <p className="text-sm mt-2">2. Open a new tab, visit your proxy base url</p>
- <p className="text-sm mt-2">3. Confirm your SSO is configured correctly and you can login on the new Tab</p>
- <p className="text-sm mt-2">4. If Step 3 is successful, you can close this tab</p>
- <div style={{ textAlign: "right", marginTop: "10px" }}>
- <Button type="button" onClick={handleInstructionsOk}>
- Done
- </Button>
- </div>
- </Modal>
+ <Dialog open={isInstructionsModalVisible} onOpenChange={(open) => !open && handleInstructionsCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>SSO Setup Instructions</DialogTitle>
+ </DialogHeader>
+ <p>Follow these steps to complete the SSO setup:</p>
+ <p className="text-sm mt-2">1. DO NOT Exit this TAB</p>
+ <p className="text-sm mt-2">2. Open a new tab, visit your proxy base url</p>
+ <p className="text-sm mt-2">3. Confirm your SSO is configured correctly and you can login on the new Tab</p>
+ <p className="text-sm mt-2">4. If Step 3 is successful, you can close this tab</p>
+ <div style={{ textAlign: "right", marginTop: "10px" }}>
+ <Button type="button" onClick={handleInstructionsOk}>
+ Done
+ </Button>
+ </div>
+ </DialogContent>
+ </Dialog>
</>
);
};
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/HashicorpVault/EditHashicorpVaultModal.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/HashicorpVault/EditHashicorpVaultModal.tsx
index 0658f28611a..41d41e64da0 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/HashicorpVault/EditHashicorpVaultModal.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/HashicorpVault/EditHashicorpVaultModal.tsx
@@ -4,7 +4,6 @@ import { useHashicorpVaultConfig } from "@/app/(dashboard)/hooks/configOverrides
import { useUpdateHashicorpVaultConfig } from "@/app/(dashboard)/hooks/configOverrides/useUpdateHashicorpVaultConfig";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
import { toast } from "@/lib/toast";
-import { Modal } from "antd";
import React, { useMemo } from "react";
import { z } from "zod/v4";
import { FieldGroup } from "@/components/shared/form/field";
@@ -16,6 +15,7 @@ import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { Separator } from "@/components/ui/separator";
import { useZodForm } from "@/lib/forms/useZodForm";
import { SENSITIVE_FIELDS, FIELD_LABELS } from "./constants";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface VaultFieldGroup {
title: string;
@@ -142,34 +142,34 @@ const EditHashicorpVaultModal: React.FC<EditHashicorpVaultModalProps> = ({ isVis
};
return (
- <Modal
- title="Edit Hashicorp Vault Configuration"
- open={isVisible}
- width={700}
- footer={
- <div className="flex items-center justify-end gap-2">
- <Button type="button" variant="outline" onClick={handleCancel} disabled={isPending}>
- Cancel
- </Button>
- <Button type="button" disabled={isPending} onClick={() => void form.handleSubmit(handleSubmit)()}>
- {isPending && <UiLoadingSpinner className="size-4 mr-1" />}
- {isPending ? "Saving..." : "Save"}
- </Button>
- </div>
- }
- onCancel={handleCancel}
- >
- <form onSubmit={form.handleSubmit(handleSubmit)}>
- {FIELD_GROUPS.map((group, index) => (
- <div key={group.title}>
- {index > 0 && <Separator className="my-6" />}
- <h5 className="mb-1 text-base font-semibold text-foreground">{group.title}</h5>
- {group.subtitle && <p className="mb-4 text-sm text-muted-foreground">{group.subtitle}</p>}
- <FieldGroup>{group.fields.map(renderField)}</FieldGroup>
+ <Dialog open={isVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Edit Hashicorp Vault Configuration</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={form.handleSubmit(handleSubmit)}>
+ {FIELD_GROUPS.map((group, index) => (
+ <div key={group.title}>
+ {index > 0 && <Separator className="my-6" />}
+ <h5 className="mb-1 text-base font-semibold text-foreground">{group.title}</h5>
+ {group.subtitle && <p className="mb-4 text-sm text-muted-foreground">{group.subtitle}</p>}
+ <FieldGroup>{group.fields.map(renderField)}</FieldGroup>
+ </div>
+ ))}
+ </form>
+ <DialogFooter>
+ <div className="flex items-center justify-end gap-2">
+ <Button type="button" variant="outline" onClick={handleCancel} disabled={isPending}>
+ Cancel
+ </Button>
+ <Button type="button" disabled={isPending} onClick={() => void form.handleSubmit(handleSubmit)()}>
+ {isPending && <UiLoadingSpinner className="size-4 mr-1" />}
+ {isPending ? "Saving..." : "Save"}
+ </Button>
</div>
- ))}
- </form>
- </Modal>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.tsx
index fc085ebbd9e..8a567f9dd21 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/PluginSettings/PluginSettings.tsx
@@ -1,7 +1,7 @@
"use client";
import { useState, useEffect } from "react";
-import { Card, Modal, Space, Table, Typography } from "antd";
+import { Card, Space, Table, Typography } from "antd";
import { Button } from "@/components/ui/button";
import { DeleteOutlined, EditOutlined, PlusOutlined } from "@ant-design/icons";
import { Eye, EyeOff } from "lucide-react";
@@ -13,6 +13,7 @@ import { Input } from "@/components/ui/input";
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group";
import { useZodForm } from "@/lib/forms/useZodForm";
import { pluginSchema, type PluginFormValues } from "./schema";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const { Title, Text, Paragraph } = Typography;
@@ -143,60 +144,66 @@ export default function PluginSettings() {
<Table dataSource={plugins} columns={columns} rowKey="name" loading={loading} pagination={false} size="small" />
- <Modal
- title={editingIndex !== null ? "Edit Plugin" : "Add Plugin"}
- open={modalOpen}
- onOk={form.handleSubmit(handleOk)}
- onCancel={() => setModalOpen(false)}
- confirmLoading={saving}
- okText="Save"
- >
- <form onSubmit={(event) => event.preventDefault()} noValidate style={{ marginTop: 16 }}>
- <FieldGroup>
- <FormField
- control={form.control}
- name="name"
- label="Name (identifier)"
- description="Used in URLs and config. No spaces. E.g. litellm-platform-plugin"
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="litellm-platform-plugin" />}
- </FormField>
- <FormField control={form.control} name="display_name" label="Display Name">
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="Agent Control Plane" />}
- </FormField>
- <FormField control={form.control} name="url" label="URL" description="Base URL of the plugin service">
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="https://your-plugin.example.com" />}
- </FormField>
- <FormField
- control={form.control}
- name="plugin_key"
- label="Plugin Key"
- description="Optional. The plugin's own credential, injected as Authorization: Bearer <key> only when litellm reverse-proxies API calls to the plugin's backend (/plugin-proxy/<name>/*). Leave blank for plugins that use the forwarded litellm user token (e.g. iframe plugins) — that path uses the user's token, not this key."
- >
- {({ ref, ...field }) => (
- <InputGroup>
- <InputGroupInput
- {...field}
- ref={ref}
- type={keyVisible ? "text" : "password"}
- value={field.value ?? ""}
- placeholder={editingIndex !== null ? "Leave blank to keep current key" : "sk-... (optional)"}
- />
- <InputGroupAddon align="inline-end">
- <InputGroupButton
- size="icon-xs"
- onClick={() => setKeyVisible(!keyVisible)}
- aria-label={keyVisible ? "Hide plugin key" : "Show plugin key"}
- >
- {keyVisible ? <EyeOff /> : <Eye />}
- </InputGroupButton>
- </InputGroupAddon>
- </InputGroup>
- )}
- </FormField>
- </FieldGroup>
- </form>
- </Modal>
+ <Dialog open={modalOpen} onOpenChange={(open) => !open && setModalOpen(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>{editingIndex !== null ? "Edit Plugin" : "Add Plugin"}</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={(event) => event.preventDefault()} noValidate style={{ marginTop: 16 }}>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="name"
+ label="Name (identifier)"
+ description="Used in URLs and config. No spaces. E.g. litellm-platform-plugin"
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="litellm-platform-plugin" />}
+ </FormField>
+ <FormField control={form.control} name="display_name" label="Display Name">
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="Agent Control Plane" />}
+ </FormField>
+ <FormField control={form.control} name="url" label="URL" description="Base URL of the plugin service">
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="https://your-plugin.example.com" />}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="plugin_key"
+ label="Plugin Key"
+ description="Optional. The plugin's own credential, injected as Authorization: Bearer <key> only when litellm reverse-proxies API calls to the plugin's backend (/plugin-proxy/<name>/*). Leave blank for plugins that use the forwarded litellm user token (e.g. iframe plugins) — that path uses the user's token, not this key."
+ >
+ {({ ref, ...field }) => (
+ <InputGroup>
+ <InputGroupInput
+ {...field}
+ ref={ref}
+ type={keyVisible ? "text" : "password"}
+ value={field.value ?? ""}
+ placeholder={editingIndex !== null ? "Leave blank to keep current key" : "sk-... (optional)"}
+ />
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ size="icon-xs"
+ onClick={() => setKeyVisible(!keyVisible)}
+ aria-label={keyVisible ? "Hide plugin key" : "Show plugin key"}
+ >
+ {keyVisible ? <EyeOff /> : <Eye />}
+ </InputGroupButton>
+ </InputGroupAddon>
+ </InputGroup>
+ )}
+ </FormField>
+ </FieldGroup>
+ </form>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setModalOpen(false)}>
+ Cancel
+ </Button>
+ <Button onClick={form.handleSubmit(handleOk)} disabled={saving} aria-busy={saving}>
+ Save
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</Card>
);
}
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.tsx
index fcbb6300d70..7fa16515bf5 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.tsx
@@ -2,7 +2,6 @@
import { toast } from "@/lib/toast";
import { parseErrorMessage } from "@/components/shared/errorUtils";
-import { Modal } from "antd";
import React from "react";
import BaseSSOSettingsForm, {
emptySSOSettingsFormValues,
@@ -14,6 +13,7 @@ import { Button } from "@/components/ui/button";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { useEditSSOSettings } from "@/app/(dashboard)/hooks/sso/useEditSSOSettings";
import { processSSOSettingsPayload } from "../utils";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AddSSOSettingsModalProps {
isVisible: boolean;
@@ -45,29 +45,29 @@ const AddSSOSettingsModal: React.FC<AddSSOSettingsModalProps> = ({ isVisible, on
};
return (
- <Modal
- title="Add SSO"
- open={isVisible}
- width={800}
- footer={
- <div className="flex items-center justify-end gap-2">
- <Button type="button" variant="outline" onClick={handleCancel} disabled={isPending}>
- Cancel
- </Button>
- <Button
- type="button"
- disabled={isPending}
- onClick={submitMountedSSOValues(form, "sso-settings", handleFormSubmit)}
- >
- {isPending && <UiLoadingSpinner className="size-4 mr-1" />}
- {isPending ? "Adding..." : "Add SSO"}
- </Button>
- </div>
- }
- onCancel={handleCancel}
- >
- <BaseSSOSettingsForm form={form} onFormSubmit={handleFormSubmit} />
- </Modal>
+ <Dialog open={isVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>Add SSO</DialogTitle>
+ </DialogHeader>
+ <BaseSSOSettingsForm form={form} onFormSubmit={handleFormSubmit} />
+ <DialogFooter>
+ <div className="flex items-center justify-end gap-2">
+ <Button type="button" variant="outline" onClick={handleCancel} disabled={isPending}>
+ Cancel
+ </Button>
+ <Button
+ type="button"
+ disabled={isPending}
+ onClick={submitMountedSSOValues(form, "sso-settings", handleFormSubmit)}
+ >
+ {isPending && <UiLoadingSpinner className="size-4 mr-1" />}
+ {isPending ? "Adding..." : "Add SSO"}
+ </Button>
+ </div>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.test.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.test.tsx
index 0e289c12c5b..ef78e3827d8 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.test.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.test.tsx
@@ -20,7 +20,6 @@ const SSO_PROVIDERS = {
const TEST_DATA = {
MODAL_TITLE: "Edit SSO Settings",
- MODAL_WIDTH: "800",
SUCCESS_MESSAGE: "SSO settings updated successfully",
ERROR_MESSAGE_PREFIX: "Failed to save SSO settings:",
BUTTON_TEXT: {
@@ -31,8 +30,6 @@ const TEST_DATA = {
} as const;
const TEST_IDS = {
- MODAL: "modal",
- BUTTON: "button",
BASE_SSO_FORM: "base-sso-form",
TRIGGER_FORM_SUBMIT: "trigger-form-submit",
} as const;
@@ -125,16 +122,6 @@ const createMockHooks = (): {
let lastSeededForm: any;
-vi.mock("antd", () => ({
- Modal: ({ children, open, title, footer, onCancel, width, ...props }: any) => (
- <div data-testid={TEST_IDS.MODAL} data-open={open} data-title={title} data-width={width} {...props}>
- <div data-testid="modal-content">{children}</div>
- <div data-testid="modal-footer">{footer}</div>
- <button data-testid="modal-cancel" onClick={onCancel} />
- </div>
- ),
-}));
-
vi.mock("./BaseSSOSettingsForm", async (importOriginal) => ({
...(await importOriginal<typeof import("./BaseSSOSettingsForm")>()),
default: ({ form, onFormSubmit }: any) => {
@@ -199,9 +186,9 @@ const renderComponent = (props: Partial<React.ComponentProps<typeof EditSSOSetti
};
};
-const getButtons = () => within(screen.getByTestId("modal-footer")).getAllByRole("button");
-const getCancelButton = () => getButtons()[0];
-const getSaveButton = () => getButtons()[1];
+const getDialog = () => screen.getByRole("dialog");
+const getCancelButton = () => within(getDialog()).getByRole("button", { name: TEST_DATA.BUTTON_TEXT.CANCEL });
+const getSaveButton = () => within(getDialog()).getByRole("button", { name: /^(Save|Saving)/ });
const seededValuesFor = (ssoData: SSOData) => toSSOFormValues(ssoData.values as SSOSettingsValues);
@@ -219,17 +206,15 @@ describe("EditSSOSettingsModal", () => {
it("displays modal with correct configuration", () => {
renderComponent();
- const modal = screen.getByTestId(TEST_IDS.MODAL);
- expect(modal).toHaveAttribute("data-open", "true");
- expect(modal).toHaveAttribute("data-title", TEST_DATA.MODAL_TITLE);
- expect(modal).toHaveAttribute("data-width", TEST_DATA.MODAL_WIDTH);
+ expect(within(getDialog()).getByText(TEST_DATA.MODAL_TITLE)).toBeInTheDocument();
+ expect(screen.getByTestId(TEST_IDS.BASE_SSO_FORM)).toBeInTheDocument();
});
it("displays modal as closed when not visible", () => {
renderComponent({ isVisible: false });
- const modal = screen.getByTestId(TEST_IDS.MODAL);
- expect(modal).toHaveAttribute("data-open", "false");
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ expect(screen.queryByText(TEST_DATA.MODAL_TITLE)).not.toBeInTheDocument();
});
});
@@ -237,10 +222,8 @@ describe("EditSSOSettingsModal", () => {
it("renders cancel and save buttons", () => {
renderComponent();
- const buttons = getButtons();
- expect(buttons).toHaveLength(2);
- expect(buttons[0]).toHaveTextContent(TEST_DATA.BUTTON_TEXT.CANCEL);
- expect(buttons[1]).toHaveTextContent(TEST_DATA.BUTTON_TEXT.SAVE);
+ expect(getCancelButton()).toBeInTheDocument();
+ expect(getSaveButton()).toHaveTextContent(TEST_DATA.BUTTON_TEXT.SAVE);
});
it("calls onCancel and resets form when cancel button is clicked", () => {
@@ -481,7 +464,8 @@ describe("EditSSOSettingsModal", () => {
renderComponent({ isVisible: false });
- expect(screen.getByTestId(TEST_IDS.MODAL)).toHaveAttribute("data-open", "false");
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ expect(screen.queryByTestId(TEST_IDS.BASE_SSO_FORM)).not.toBeInTheDocument();
});
it("skips initialization when SSO data is unavailable", () => {
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.tsx
index 364fb68fd91..58c03eda979 100644
--- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/EditSSOSettingsModal.tsx
@@ -1,6 +1,5 @@
"use client";
-import { Modal } from "antd";
import React, { useMemo } from "react";
import BaseSSOSettingsForm, {
emptySSOSettingsFormValues,
@@ -15,6 +14,7 @@ import { parseErrorMessage } from "@/components/shared/errorUtils";
import { detectSSOProvider, processSSOSettingsPayload } from "../utils";
import { useSSOSettings, type SSOSettingsValues } from "@/app/(dashboard)/hooks/sso/useSSOSettings";
import { useEditSSOSettings } from "@/app/(dashboard)/hooks/sso/useEditSSOSettings";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface EditSSOSettingsModalProps {
isVisible: boolean;
@@ -108,29 +108,29 @@ const EditSSOSettingsModal: React.FC<EditSSOSettingsModalProps> = ({ isVisible,
};
return (
- <Modal
- title="Edit SSO Settings"
- open={isVisible}
- width={800}
- footer={
- <div className="flex items-center justify-end gap-2">
- <Button type="button" variant="outline" onClick={handleCancel} disabled={isPending}>
- Cancel
- </Button>
- <Button
- type="button"
- disabled={isPending}
- onClick={submitMountedSSOValues(form, "sso-settings", handleFormSubmit)}
- >
- {isPending && <UiLoadingSpinner className="size-4 mr-1" />}
- {isPending ? "Saving..." : "Save"}
- </Button>
- </div>
- }
- onCancel={handleCancel}
- >
- <BaseSSOSettingsForm form={form} onFormSubmit={handleFormSubmit} />
- </Modal>
+ <Dialog open={isVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>Edit SSO Settings</DialogTitle>
+ </DialogHeader>
+ <BaseSSOSettingsForm form={form} onFormSubmit={handleFormSubmit} />
+ <DialogFooter>
+ <div className="flex items-center justify-end gap-2">
+ <Button type="button" variant="outline" onClick={handleCancel} disabled={isPending}>
+ Cancel
+ </Button>
+ <Button
+ type="button"
+ disabled={isPending}
+ onClick={submitMountedSSOValues(form, "sso-settings", handleFormSubmit)}
+ >
+ {isPending && <UiLoadingSpinner className="size-4 mr-1" />}
+ {isPending ? "Saving..." : "Save"}
+ </Button>
+ </div>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.tsx
index 5af85d6989e..868996fa663 100644
--- a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.tsx
@@ -3,9 +3,9 @@
* Handles modal visibility and layout, but delegates content to children
*/
-import { Modal } from "antd";
import { ArrowRight } from "lucide-react";
import React from "react";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AddFallbacksModalProps {
open: boolean;
@@ -15,34 +15,25 @@ interface AddFallbacksModalProps {
export function AddFallbacksModal({ open, onCancel, children }: AddFallbacksModalProps) {
return (
- <Modal
- title={
- <div className="pb-4 border-b border-gray-100">
- <div className="flex items-center gap-2 text-gray-800">
- <div className="p-2 bg-indigo-50 rounded-lg">
- <ArrowRight className="w-5 h-5 text-indigo-600" />
- </div>
- <div>
- <h2 className="text-lg font-bold m-0">Configure Model Fallbacks</h2>
- <p className="text-sm text-gray-500 font-normal m-0">
- Manage multiple fallback chains for different models (up to 5 groups at a time)
- </p>
+ <Dialog open={open} onOpenChange={(open) => !open && onCancel()} disablePointerDismissal>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[900px]">
+ <DialogHeader>
+ <div className="pb-4 border-b border-gray-100">
+ <div className="flex items-center gap-2 text-gray-800">
+ <div className="p-2 bg-indigo-50 rounded-lg">
+ <ArrowRight className="w-5 h-5 text-indigo-600" />
+ </div>
+ <div>
+ <DialogTitle className="text-lg font-bold m-0">Configure Model Fallbacks</DialogTitle>
+ <p className="text-sm text-gray-500 font-normal m-0">
+ Manage multiple fallback chains for different models (up to 5 groups at a time)
+ </p>
+ </div>
</div>
</div>
- </div>
- }
- open={open}
- width={900}
- footer={null}
- onCancel={onCancel}
- maskClosable={false}
- className="top-8"
- styles={{
- body: { padding: "24px" },
- header: { padding: "24px 24px 0 24px", border: "none" },
- }}
- >
- <div className="mt-6">{children}</div>
- </Modal>
+ </DialogHeader>
+ <div className="mt-6">{children}</div>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/components/Teams.tsx b/ui/litellm-dashboard/src/components/Teams.tsx
index 94e84c6e721..d515b67ad0f 100644
--- a/ui/litellm-dashboard/src/components/Teams.tsx
+++ b/ui/litellm-dashboard/src/components/Teams.tsx
@@ -15,7 +15,7 @@ import { SearchSelect } from "@/components/shared/SearchSelect";
import { labelWithDocsHint, labelWithHint } from "@/components/shared/form/LabelWithHint";
import { useZodForm } from "@/lib/forms/useZodForm";
import { TagsInput } from "@/app/(dashboard)/guardrails/_components/content_filter/TagsInput";
-import { Layout, Modal, Tabs, theme } from "antd";
+import { Layout, Tabs, theme } from "antd";
import { ChevronDown, Plus, Users } from "lucide-react";
import React, { useEffect, useMemo, useState } from "react";
import { z } from "zod/v4";
@@ -50,6 +50,7 @@ import { Organization, getDefaultTeamSettings, getGuardrailsList, getPoliciesLis
import NumericalInput from "./shared/numerical_input";
import VectorStoreSelector from "./vector_store_management/VectorStoreSelector";
import SearchToolSelector from "./search_tools/SearchToolSelector";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface TeamProps {
accessToken: string | null;
@@ -331,11 +332,6 @@ const Teams: React.FC<TeamProps> = ({ accessToken, userID, userRole, premiumUser
setRouterSettingsKey((prev) => prev + 1);
};
- const handleOk = () => {
- setIsTeamModalVisible(false);
- resetCreateForm();
- };
-
const handleCancel = () => {
setIsTeamModalVisible(false);
resetCreateForm();
@@ -663,548 +659,554 @@ const Teams: React.FC<TeamProps> = ({ accessToken, userID, userRole, premiumUser
)}
{canCreateOrManageTeams(userRole, userID, organizations) && (
- <Modal
- title="Create Team"
- open={isTeamModalVisible}
- width={1000}
- footer={null}
- onOk={handleOk}
- onCancel={handleCancel}
- destroyOnHidden
- >
- <TooltipProvider>
- <form onSubmit={form.handleSubmit(onCreateSubmit)}>
- <FieldGroup>
- <FormField control={form.control} name="team_alias" label="Team Name">
- {({ ref, value, ...field }) => (
- <UIInput {...field} ref={ref} value={value ?? ""} data-testid="team-name-input" />
- )}
- </FormField>
- {(() => {
- const adminOrgs = getAdminOrganizations(userRole, userID, organizations);
- const isSingleOrg = adminOrgs.length === 1;
- const hasNoOrgs = adminOrgs.length === 0;
-
- return (
- <>
- <FormField
- control={form.control}
- name="organization_id"
- className="mt-8"
- label={labelWithDocsHint(
- "Organization",
- "Organizations can have multiple teams. Learn more about the user management hierarchy",
- "https://docs.litellm.ai/docs/proxy/user_management_heirarchy",
- )}
- description={
- isOrgAdmin && isSingleOrg
- ? "You can only create teams within this organization"
- : isOrgAdmin
- ? "required"
- : undefined
- }
- >
- {({ id, value, onChange }) => (
- <SearchSelect
- inputId={id}
- value={value ?? ""}
- options={adminOrgs.map((org) => ({
- value: org.organization_id ?? "",
- label: org.organization_alias ?? "",
- sublabel: org.organization_id ?? "",
- }))}
- disabled={isOrgAdmin && isSingleOrg}
- allowClear={!isOrgAdmin}
- placeholder={hasNoOrgs ? "No organizations available" : "Search or select an Organization"}
- emptyText="No organizations available"
- onValueChange={(next) => {
- onChange(next === "" ? null : next);
- setCurrentOrgForCreateTeam(adminOrgs.find((org) => org.organization_id === next) ?? null);
- }}
- />
- )}
- </FormField>
+ <Dialog open={isTeamModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <DialogTitle>Create Team</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={form.handleSubmit(onCreateSubmit)}>
+ <FieldGroup>
+ <FormField control={form.control} name="team_alias" label="Team Name">
+ {({ ref, value, ...field }) => (
+ <UIInput {...field} ref={ref} value={value ?? ""} data-testid="team-name-input" />
+ )}
+ </FormField>
+ {(() => {
+ const adminOrgs = getAdminOrganizations(userRole, userID, organizations);
+ const isSingleOrg = adminOrgs.length === 1;
+ const hasNoOrgs = adminOrgs.length === 0;
+
+ return (
+ <>
+ <FormField
+ control={form.control}
+ name="organization_id"
+ className="mt-8"
+ label={labelWithDocsHint(
+ "Organization",
+ "Organizations can have multiple teams. Learn more about the user management hierarchy",
+ "https://docs.litellm.ai/docs/proxy/user_management_heirarchy",
+ )}
+ description={
+ isOrgAdmin && isSingleOrg
+ ? "You can only create teams within this organization"
+ : isOrgAdmin
+ ? "required"
+ : undefined
+ }
+ >
+ {({ id, value, onChange }) => (
+ <SearchSelect
+ inputId={id}
+ value={value ?? ""}
+ options={adminOrgs.map((org) => ({
+ value: org.organization_id ?? "",
+ label: org.organization_alias ?? "",
+ sublabel: org.organization_id ?? "",
+ }))}
+ disabled={isOrgAdmin && isSingleOrg}
+ allowClear={!isOrgAdmin}
+ placeholder={
+ hasNoOrgs ? "No organizations available" : "Search or select an Organization"
+ }
+ emptyText="No organizations available"
+ onValueChange={(next) => {
+ onChange(next === "" ? null : next);
+ setCurrentOrgForCreateTeam(
+ adminOrgs.find((org) => org.organization_id === next) ?? null,
+ );
+ }}
+ />
+ )}
+ </FormField>
- {isOrgAdmin && !isSingleOrg && adminOrgs.length > 1 && (
- <div className="mb-8 rounded-md border border-blue-200 bg-blue-50 p-4">
- <span className="text-sm text-blue-800">
- Please select an organization to create a team for. You can only create teams within
- organizations where you are an admin.
- </span>
- </div>
- )}
- </>
- );
- })()}
- <FormField
- control={form.control}
- name="models"
- label={labelWithHint(
- "Models",
- "These are the models that your selected team has access to. Leave empty to grant no models directly, e.g. when the team gets its models from access groups",
- )}
- >
- {({ id, value, onChange }) => (
- <ModelSelect
- id={id}
- value={value ?? []}
- onChange={onChange}
- organizationID={watchedOrganizationId ?? undefined}
- options={{
- includeSpecialOptions: true,
- showAllProxyModelsOverride: !watchedOrganizationId,
- }}
- context="team"
- dataTestId="create-team-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} width={200} />
- )}
- </FormField>
- <FormField control={form.control} name="budget_duration" className="mt-8" label="Reset Budget">
- {({ id, value, onChange }) => (
- <BudgetDurationDropdown
- id={id}
- showNeverResets
- placeholder={budgetDurationPlaceholder}
- value={value}
- onChange={onChange}
- />
- )}
- </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} width={400} />
- )}
- </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} width={400} />
- )}
- </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>
-
- <Collapsible
- open={additionalSettingsOpen}
- onOpenChange={setAdditionalSettingsOpen}
- className="mt-20 mb-8 overflow-hidden rounded-lg border"
- >
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>Additional 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">
- <FieldGroup>
- <FormField
- control={form.control}
- name="team_id"
- label="Team ID"
- description="ID of the team you want to create. If not provided, it will be generated automatically."
- >
- {({ ref, value, ...field }) => <UIInput {...field} ref={ref} value={value ?? ""} />}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_budget"
- label={labelWithHint(
- "Team Member Budget (USD)",
- "This is the individual budget for a user in the team.",
- )}
- >
- {({ ref, value, onChange, ...field }) => (
- <NumericalInput
- {...field}
- ref={ref}
- value={value ?? ""}
- onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
- onChange(event.target.value ? Number(event.target.value) : undefined)
- }
- step={0.01}
- precision={2}
- width={200}
- />
+ {isOrgAdmin && !isSingleOrg && adminOrgs.length > 1 && (
+ <div className="mb-8 rounded-md border border-blue-200 bg-blue-50 p-4">
+ <span className="text-sm text-blue-800">
+ Please select an organization to create a team for. You can only create teams within
+ organizations where you are an admin.
+ </span>
+ </div>
)}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_key_duration"
- label={labelWithHint(
- "Team Member 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_rpm_limit"
- label={labelWithHint(
- "Team Member RPM Limit",
- "The RPM (Requests Per Minute) limit for individual team members",
- )}
- >
- {({ ref, value, ...field }) => (
- <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} width={400} />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="team_member_tpm_limit"
- label={labelWithHint(
- "Team Member TPM Limit",
- "The TPM (Tokens Per Minute) limit for individual team members",
- )}
- >
- {({ ref, value, ...field }) => (
- <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} width={400} />
- )}
- </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={4}
- placeholder='{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}'
- disabled={!premiumUser}
- />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="guardrails"
- className="mt-8"
- label={labelWithDocsHint(
- "Guardrails",
- "Setup your first guardrail",
- "https://docs.litellm.ai/docs/proxy/guardrails/quick_start",
- )}
- description="Select existing guardrails or enter new ones"
- >
- {({ id, value, onChange }) => (
- <TagsInput
- id={id}
- value={value ?? []}
- onValueChange={onChange}
- options={guardrailsList.map((name) => ({ value: name, label: name }))}
- placeholder="Select or enter guardrails"
- />
- )}
- </FormField>
- <FormField
- control={form.control}
- name="disable_global_guardrails"
- className="mt-4"
- label={labelWithHint(
- "Disable Global Guardrails",
- "When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",
- )}
- description={
- premiumUser
- ? "Bypass global guardrails for this team"
- : "Premium feature - Upgrade to disable global guardrails by team"
- }
- >
- {({ id, value, onChange }) => (
- <Switch id={id} disabled={!premiumUser} checked={value === true} onCheckedChange={onChange} />
- )}
- </FormField>
- {canViewPolicies && (
+ </>
+ );
+ })()}
+ <FormField
+ control={form.control}
+ name="models"
+ label={labelWithHint(
+ "Models",
+ "These are the models that your selected team has access to. Leave empty to grant no models directly, e.g. when the team gets its models from access groups",
+ )}
+ >
+ {({ id, value, onChange }) => (
+ <ModelSelect
+ id={id}
+ value={value ?? []}
+ onChange={onChange}
+ organizationID={watchedOrganizationId ?? undefined}
+ options={{
+ includeSpecialOptions: true,
+ showAllProxyModelsOverride: !watchedOrganizationId,
+ }}
+ context="team"
+ dataTestId="create-team-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} width={200} />
+ )}
+ </FormField>
+ <FormField control={form.control} name="budget_duration" className="mt-8" label="Reset Budget">
+ {({ id, value, onChange }) => (
+ <BudgetDurationDropdown
+ id={id}
+ showNeverResets
+ placeholder={budgetDurationPlaceholder}
+ value={value}
+ onChange={onChange}
+ />
+ )}
+ </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} width={400} />
+ )}
+ </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} width={400} />
+ )}
+ </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>
+
+ <Collapsible
+ open={additionalSettingsOpen}
+ onOpenChange={setAdditionalSettingsOpen}
+ className="mt-20 mb-8 overflow-hidden rounded-lg border"
+ >
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>Additional 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">
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="team_id"
+ label="Team ID"
+ description="ID of the team you want to create. If not provided, it will be generated automatically."
+ >
+ {({ ref, value, ...field }) => <UIInput {...field} ref={ref} value={value ?? ""} />}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="team_member_budget"
+ label={labelWithHint(
+ "Team Member Budget (USD)",
+ "This is the individual budget for a user in the team.",
+ )}
+ >
+ {({ ref, value, onChange, ...field }) => (
+ <NumericalInput
+ {...field}
+ ref={ref}
+ value={value ?? ""}
+ onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
+ onChange(event.target.value ? Number(event.target.value) : undefined)
+ }
+ step={0.01}
+ precision={2}
+ width={200}
+ />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="team_member_key_duration"
+ label={labelWithHint(
+ "Team Member 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_rpm_limit"
+ label={labelWithHint(
+ "Team Member RPM Limit",
+ "The RPM (Requests Per Minute) limit for individual team members",
+ )}
+ >
+ {({ ref, value, ...field }) => (
+ <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} width={400} />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="team_member_tpm_limit"
+ label={labelWithHint(
+ "Team Member TPM Limit",
+ "The TPM (Tokens Per Minute) limit for individual team members",
+ )}
+ >
+ {({ ref, value, ...field }) => (
+ <NumericalInput {...field} ref={ref} value={value ?? ""} step={1} width={400} />
+ )}
+ </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={4}
+ placeholder='{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}'
+ disabled={!premiumUser}
+ />
+ )}
+ </FormField>
<FormField
control={form.control}
- name="policies"
+ name="guardrails"
className="mt-8"
label={labelWithDocsHint(
- "Policies",
- "Apply policies to this team to control guardrails and other settings",
- "https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",
+ "Guardrails",
+ "Setup your first guardrail",
+ "https://docs.litellm.ai/docs/proxy/guardrails/quick_start",
)}
- description="Select existing policies or enter new ones"
+ description="Select existing guardrails or enter new ones"
>
{({ id, value, onChange }) => (
<TagsInput
id={id}
value={value ?? []}
onValueChange={onChange}
- options={policiesList.map((name) => ({ value: name, label: name }))}
- placeholder="Select or enter policies"
+ options={guardrailsList.map((name) => ({ value: name, label: name }))}
+ placeholder="Select or enter guardrails"
/>
)}
</FormField>
- )}
+ <FormField
+ control={form.control}
+ name="disable_global_guardrails"
+ className="mt-4"
+ label={labelWithHint(
+ "Disable Global Guardrails",
+ "When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",
+ )}
+ description={
+ premiumUser
+ ? "Bypass global guardrails for this team"
+ : "Premium feature - Upgrade to disable global guardrails by team"
+ }
+ >
+ {({ id, value, onChange }) => (
+ <Switch
+ id={id}
+ disabled={!premiumUser}
+ checked={value === true}
+ onCheckedChange={onChange}
+ />
+ )}
+ </FormField>
+ {canViewPolicies && (
+ <FormField
+ control={form.control}
+ name="policies"
+ className="mt-8"
+ label={labelWithDocsHint(
+ "Policies",
+ "Apply policies to this team to control guardrails and other settings",
+ "https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",
+ )}
+ description="Select existing policies or enter new ones"
+ >
+ {({ 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"
+ className="mt-8"
+ label={labelWithHint(
+ "Access Groups",
+ "Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",
+ )}
+ description="Select access groups to assign to this team"
+ >
+ {({ value, onChange }) => (
+ <AccessGroupSelector
+ value={value}
+ onChange={onChange}
+ placeholder="Select access groups (optional)"
+ />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="allowed_vector_store_ids"
+ className="mt-8"
+ label={labelWithHint(
+ "Allowed Vector Stores",
+ "Select which vector stores this team can access by default. Leave empty for access to all vector stores",
+ )}
+ description="Select vector stores this team can access. Leave empty for access to all vector stores"
+ >
+ {({ value, onChange }) => (
+ <VectorStoreSelector
+ onChange={onChange}
+ value={value}
+ accessToken={accessToken || ""}
+ placeholder="Select vector stores (optional)"
+ />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="allowed_passthrough_routes"
+ className="mt-8"
+ label={
+ !premiumUser
+ ? labelWithHint(
+ "Allowed Pass Through Routes",
+ "Premium feature - Upgrade to set allowed pass through routes",
+ )
+ : !isProxyAdminRole(userRole || "")
+ ? 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 (optional)"
+ disabled={!premiumUser || !isProxyAdminRole(userRole || "")}
+ />
+ )}
+ </FormField>
+ </FieldGroup>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible
+ open={mcpSettingsOpen}
+ onOpenChange={setMcpSettingsOpen}
+ className="mt-8 mb-8 overflow-hidden rounded-lg border"
+ >
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>MCP 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="access_group_ids"
- className="mt-8"
+ name="allowed_mcp_servers_and_groups"
+ className="mt-4"
label={labelWithHint(
- "Access Groups",
- "Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",
+ "Allowed MCP Servers",
+ "Select which MCP servers or access groups this team can access",
)}
- description="Select access groups to assign to this team"
+ description="Select MCP servers or access groups this team can access"
>
{({ value, onChange }) => (
- <AccessGroupSelector
- value={value}
+ <MCPServerSelector
onChange={onChange}
- placeholder="Select access groups (optional)"
+ value={value}
+ accessToken={accessToken || ""}
+ placeholder="Select MCP servers or access groups (optional)"
+ allowAllProxyMcpServers={isProxyAdminRole(userRole || "")}
/>
)}
</FormField>
+
+ <div className="mt-6">
+ <MCPToolPermissions
+ accessToken={accessToken || ""}
+ selectedServers={watchedMcpSelection?.servers || []}
+ toolPermissions={watchedToolPermissions || {}}
+ onChange={(toolPerms) => form.setValue("mcp_tool_permissions", toolPerms)}
+ />
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible
+ open={agentSettingsOpen}
+ onOpenChange={setAgentSettingsOpen}
+ className="mt-8 mb-8 overflow-hidden rounded-lg border"
+ >
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>Agent 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="allowed_vector_store_ids"
- className="mt-8"
+ name="allowed_agents_and_groups"
+ className="mt-4"
label={labelWithHint(
- "Allowed Vector Stores",
- "Select which vector stores this team can access by default. Leave empty for access to all vector stores",
+ "Allowed Agents",
+ "Select which agents or access groups this team can access",
)}
- description="Select vector stores this team can access. Leave empty for access to all vector stores"
+ description="Select agents or access groups this team can access"
>
{({ value, onChange }) => (
- <VectorStoreSelector
+ <AgentSelector
onChange={onChange}
value={value}
accessToken={accessToken || ""}
- placeholder="Select vector stores (optional)"
+ placeholder="Select agents or access groups (optional)"
/>
)}
</FormField>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible
+ open={searchToolSettingsOpen}
+ onOpenChange={setSearchToolSettingsOpen}
+ className="mt-8 mb-8 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="allowed_passthrough_routes"
- className="mt-8"
- label={
- !premiumUser
- ? labelWithHint(
- "Allowed Pass Through Routes",
- "Premium feature - Upgrade to set allowed pass through routes",
- )
- : !isProxyAdminRole(userRole || "")
- ? labelWithHint(
- "Allowed Pass Through Routes",
- "Only proxy admins can set allowed pass through routes",
- )
- : "Allowed Pass Through Routes"
- }
+ name="object_permission_search_tools"
+ className="mt-4"
+ label={labelWithHint(
+ "Allowed Search Tools",
+ "Select which search tools this team can access. Leave empty to allow all search tools.",
+ )}
+ description="Restrict which configured search tools keys on this team may call."
>
{({ value, onChange }) => (
- <PassThroughRoutesSelector
- value={value}
+ <SearchToolSelector
onChange={onChange}
+ value={value}
accessToken={accessToken || ""}
- placeholder="Select pass through routes (optional)"
- disabled={!premiumUser || !isProxyAdminRole(userRole || "")}
+ placeholder="Select search tools (optional, empty = all allowed)"
/>
)}
</FormField>
- </FieldGroup>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible
- open={mcpSettingsOpen}
- onOpenChange={setMcpSettingsOpen}
- className="mt-8 mb-8 overflow-hidden rounded-lg border"
- >
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>MCP 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="allowed_mcp_servers_and_groups"
- className="mt-4"
- label={labelWithHint(
- "Allowed MCP Servers",
- "Select which MCP servers or access groups this team can access",
- )}
- description="Select MCP servers or access groups this team can access"
- >
- {({ value, onChange }) => (
- <MCPServerSelector
- onChange={onChange}
- value={value}
- accessToken={accessToken || ""}
- placeholder="Select MCP servers or access groups (optional)"
- allowAllProxyMcpServers={isProxyAdminRole(userRole || "")}
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible className="mt-8 mb-8 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>Logging 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">
+ <div className="mt-4">
+ <PremiumLoggingSettings
+ value={loggingSettings}
+ onChange={setLoggingSettings}
+ premiumUser={premiumUser}
/>
- )}
- </FormField>
-
- <div className="mt-6">
- <MCPToolPermissions
- accessToken={accessToken || ""}
- selectedServers={watchedMcpSelection?.servers || []}
- toolPermissions={watchedToolPermissions || {}}
- onChange={(toolPerms) => form.setValue("mcp_tool_permissions", toolPerms)}
- />
- </div>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible
- open={agentSettingsOpen}
- onOpenChange={setAgentSettingsOpen}
- className="mt-8 mb-8 overflow-hidden rounded-lg border"
- >
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>Agent 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="allowed_agents_and_groups"
- className="mt-4"
- label={labelWithHint(
- "Allowed Agents",
- "Select which agents or access groups this team can access",
- )}
- description="Select agents or access groups this team can access"
- >
- {({ value, onChange }) => (
- <AgentSelector
- onChange={onChange}
- value={value}
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible
+ key={`router-settings-accordion-${routerSettingsKey}`}
+ className="mt-8 mb-8 overflow-hidden rounded-lg border"
+ >
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>Router 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">
+ <div className="mt-4 w-full">
+ <RouterSettingsAccordion
+ key={routerSettingsKey}
accessToken={accessToken || ""}
- placeholder="Select agents or access groups (optional)"
+ value={routerSettings || undefined}
+ onChange={setRouterSettings}
+ modelData={
+ userModels.length > 0
+ ? { data: userModels.map((model) => ({ model_name: model })) }
+ : undefined
+ }
/>
- )}
- </FormField>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible
- open={searchToolSettingsOpen}
- onOpenChange={setSearchToolSettingsOpen}
- className="mt-8 mb-8 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"
- className="mt-4"
- label={labelWithHint(
- "Allowed Search Tools",
- "Select which search tools this team can access. Leave empty to allow all search tools.",
- )}
- description="Restrict which configured search tools keys on this team may call."
- >
- {({ value, onChange }) => (
- <SearchToolSelector
- onChange={onChange}
- value={value}
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible className="mt-8 mb-8 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
+ <b>Model Aliases</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">
+ <div className="mt-4">
+ <p className="mb-4 block text-sm text-muted-foreground">
+ Create custom aliases for models that can be used by team members in API calls. This allows
+ you to create shortcuts for specific models.
+ </p>
+ <ModelAliasManager
accessToken={accessToken || ""}
- placeholder="Select search tools (optional, empty = all allowed)"
+ initialModelAliases={modelAliases}
+ onAliasUpdate={setModelAliases}
+ showExampleConfig={false}
/>
- )}
- </FormField>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible className="mt-8 mb-8 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>Logging 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">
- <div className="mt-4">
- <PremiumLoggingSettings
- value={loggingSettings}
- onChange={setLoggingSettings}
- premiumUser={premiumUser}
- />
- </div>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible
- key={`router-settings-accordion-${routerSettingsKey}`}
- className="mt-8 mb-8 overflow-hidden rounded-lg border"
- >
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>Router 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">
- <div className="mt-4 w-full">
- <RouterSettingsAccordion
- key={routerSettingsKey}
- accessToken={accessToken || ""}
- value={routerSettings || undefined}
- onChange={setRouterSettings}
- modelData={
- userModels.length > 0
- ? { data: userModels.map((model) => ({ model_name: model })) }
- : undefined
- }
- />
- </div>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible className="mt-8 mb-8 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className="group/section flex w-full items-center justify-between px-4 py-3 text-left">
- <b>Model Aliases</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">
- <div className="mt-4">
- <p className="mb-4 block text-sm text-muted-foreground">
- Create custom aliases for models that can be used by team members in API calls. This allows you
- to create shortcuts for specific models.
- </p>
- <ModelAliasManager
- accessToken={accessToken || ""}
- initialModelAliases={modelAliases}
- onAliasUpdate={setModelAliases}
- showExampleConfig={false}
- />
- </div>
- </CollapsibleContent>
- </Collapsible>
- </FieldGroup>
- <div className="mt-[10px] text-right">
- <UIButton type="submit" data-testid="create-team-submit">
- Create Team
- </UIButton>
- </div>
- </form>
- </TooltipProvider>
- </Modal>
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+ </FieldGroup>
+ <div className="mt-[10px] text-right">
+ <UIButton type="submit" data-testid="create-team-submit">
+ Create Team
+ </UIButton>
+ </div>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
)}
</Content>
);
diff --git a/ui/litellm-dashboard/src/components/add_model/AddModelForm.tsx b/ui/litellm-dashboard/src/components/add_model/AddModelForm.tsx
index c0c73fbb762..65efd6aed51 100644
--- a/ui/litellm-dashboard/src/components/add_model/AddModelForm.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/AddModelForm.tsx
@@ -5,7 +5,7 @@ import { all_admin_roles, isUserTeamAdminForAnyTeam } from "@/utils/roles";
import { modelCreationScope } from "@/utils/modelPermissions";
import { Switch } from "@/components/ui/switch";
import { Field, FieldLabel } from "@/components/shared/form/field";
-import { Select as AntdSelect, Card, Col, Modal, Row, Tooltip, Typography } from "antd";
+import { Select as AntdSelect, Card, Col, Row, Tooltip, Typography } from "antd";
import { Info } from "lucide-react";
import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { Button } from "@/components/ui/button";
@@ -32,6 +32,7 @@ import ConnectionErrorDisplay from "./model_connection_test";
import ProviderSpecificFields from "./provider_specific_fields";
import { TEST_MODES } from "./add_model_modes";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AddModelFormProps {
form: UseFormReturn<MountedFormValues>; // For the Add Model tab
@@ -442,44 +443,50 @@ const AddModelForm: React.FC<AddModelFormProps> = ({
</Card>
{/* Test Connection Results Modal */}
- <Modal
- title="Connection Test Results"
+ <Dialog
open={isResultModalVisible}
- onCancel={() => {
- setIsResultModalVisible(false);
- setIsTestingConnection(false);
+ onOpenChange={(open) => {
+ if (!open) {
+ setIsResultModalVisible(false);
+ setIsTestingConnection(false);
+ }
}}
- footer={[
- <Button
- key="close"
- variant="outline"
- onClick={() => {
- setIsResultModalVisible(false);
- setIsTestingConnection(false);
- }}
- >
- Close
- </Button>,
- ]}
- width={700}
>
- {/* Only render the ConnectionErrorDisplay when modal is visible and we have a test ID */}
- {isResultModalVisible && (
- <ConnectionErrorDisplay
- // The key prop tells React to create a fresh component instance when it changes
- key={connectionTestId}
- formValues={mountedValues()}
- accessToken={accessToken}
- testMode={testMode}
- modelName={connectionTestModelName(form.getValues())}
- onClose={() => {
- setIsResultModalVisible(false);
- setIsTestingConnection(false);
- }}
- onTestComplete={() => setIsTestingConnection(false)}
- />
- )}
- </Modal>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Connection Test Results</DialogTitle>
+ </DialogHeader>
+ {/* Only render the ConnectionErrorDisplay when modal is visible and we have a test ID */}
+ {isResultModalVisible && (
+ <ConnectionErrorDisplay
+ // The key prop tells React to create a fresh component instance when it changes
+ key={connectionTestId}
+ formValues={mountedValues()}
+ accessToken={accessToken}
+ testMode={testMode}
+ modelName={connectionTestModelName(form.getValues())}
+ onClose={() => {
+ setIsResultModalVisible(false);
+ setIsTestingConnection(false);
+ }}
+ onTestComplete={() => setIsTestingConnection(false)}
+ />
+ )}
+ <DialogFooter>
+ {" "}
+ <Button
+ variant="outline"
+ onClick={() => {
+ setIsResultModalVisible(false);
+ setIsTestingConnection(false);
+ }}
+ >
+ Close
+ </Button>
+ , ]
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</>
);
};
diff --git a/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx b/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx
index cca40f70833..a071b92fcd5 100644
--- a/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { useWatch } from "react-hook-form";
-import { Card, Select as AntdSelect, Modal } from "antd";
+import { Card, Select as AntdSelect } from "antd";
import { ChevronDown, ChevronRight, CircleHelp } from "lucide-react";
import { z } from "zod/v4";
import { FieldGroup } from "@/components/shared/form/field";
@@ -57,6 +57,7 @@ import {
PresetPrefill,
AutoRouterPreset,
} from "@/lib/autorouter_presets";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface AddAutoRouterTabProps {
handleOk: () => void;
@@ -671,62 +672,69 @@ const AddAutoRouterTab: React.FC<AddAutoRouterTabProps> = ({
</form>
</Card>
- <Modal
- title="Test Routing"
- open={isRoutingTestVisible}
- destroyOnHidden
- onCancel={() => setIsRoutingTestVisible(false)}
- footer={[
- <Button key="close" variant="outline" onClick={() => setIsRoutingTestVisible(false)}>
- Close
- </Button>,
- ]}
- width={760}
- >
- {isRoutingTestVisible && (
- <AutoRouterRoutingTest
- accessToken={accessToken}
- config={buildComplexityRouterConfig(complexityRouterConfigParams)}
- defaultModel={resolveComplexityDefaultModel(
- complexityRouterConfig.tiers,
- complexityRouterConfig.default_model,
- )}
- routerName={watchedName}
- teamId={requiresTeamScope ? watchedTeamId : undefined}
- />
- )}
- </Modal>
-
- <Modal
- title="Connection Test Results"
+ <Dialog open={isRoutingTestVisible} onOpenChange={(open) => !open && setIsRoutingTestVisible(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[760px]">
+ <DialogHeader>
+ <DialogTitle>Test Routing</DialogTitle>
+ </DialogHeader>
+ {isRoutingTestVisible && (
+ <AutoRouterRoutingTest
+ accessToken={accessToken}
+ config={buildComplexityRouterConfig(complexityRouterConfigParams)}
+ defaultModel={resolveComplexityDefaultModel(
+ complexityRouterConfig.tiers,
+ complexityRouterConfig.default_model,
+ )}
+ routerName={watchedName}
+ teamId={requiresTeamScope ? watchedTeamId : undefined}
+ />
+ )}
+ <DialogFooter>
+ {" "}
+ <Button variant="outline" onClick={() => setIsRoutingTestVisible(false)}>
+ Close
+ </Button>
+ , ]
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+
+ <Dialog
open={isTestModalVisible}
- onCancel={() => {
- setIsTestModalVisible(false);
- setIsTestingConnection(false);
+ onOpenChange={(open) => {
+ if (!open) {
+ setIsTestModalVisible(false);
+ setIsTestingConnection(false);
+ }
}}
- footer={[
- <Button
- key="close"
- variant="outline"
- onClick={() => {
- setIsTestModalVisible(false);
- setIsTestingConnection(false);
- }}
- >
- Close
- </Button>,
- ]}
- width={700}
>
- {isTestModalVisible && (
- <AutoRouterConnectionTest
- key={connectionTestId}
- accessToken={accessToken}
- targets={testTargets}
- onTestComplete={() => setIsTestingConnection(false)}
- />
- )}
- </Modal>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Connection Test Results</DialogTitle>
+ </DialogHeader>
+ {isTestModalVisible && (
+ <AutoRouterConnectionTest
+ key={connectionTestId}
+ accessToken={accessToken}
+ targets={testTargets}
+ onTestComplete={() => setIsTestingConnection(false)}
+ />
+ )}
+ <DialogFooter>
+ {" "}
+ <Button
+ variant="outline"
+ onClick={() => {
+ setIsTestModalVisible(false);
+ setIsTestingConnection(false);
+ }}
+ >
+ Close
+ </Button>
+ , ]
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</TooltipProvider>
);
};
diff --git a/ui/litellm-dashboard/src/components/add_pass_through.tsx b/ui/litellm-dashboard/src/components/add_pass_through.tsx
index 09ddac2cf42..8539ba0d532 100644
--- a/ui/litellm-dashboard/src/components/add_pass_through.tsx
+++ b/ui/litellm-dashboard/src/components/add_pass_through.tsx
@@ -1,7 +1,6 @@
"use client";
import React, { useState } from "react";
-import { Modal } from "antd";
import { CircleHelp, Info, Plug } from "lucide-react";
import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";
import { useWatch } from "react-hook-form";
@@ -18,6 +17,7 @@ import PassThroughSecuritySection from "./common_components/PassThroughSecurityS
import PassThroughGuardrailsSection from "./common_components/PassThroughGuardrailsSection";
import { FormField } from "@/components/shared/form/FormField";
import { Button } from "@/components/ui/button";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Card } from "@/components/ui/card";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { Input } from "@/components/ui/input";
@@ -139,255 +139,250 @@ const AddPassThroughEndpoint: React.FC<AddFallbacksProps> = ({
<Button className="mx-auto mb-4 mt-4" onClick={() => setIsModalVisible(true)}>
+ Add Pass-Through Endpoint
</Button>
- <Modal
- title={
- <div className="flex items-center space-x-3 border-b border-border pb-4">
- <Plug className="size-5 text-blue-500" />
- <h2 className="text-xl font-semibold text-foreground">Add Pass-Through Endpoint</h2>
- </div>
- }
- open={isModalVisible}
- width={1000}
- onCancel={handleCancel}
- footer={null}
- className="top-8"
- styles={{
- body: { padding: "24px" },
- header: { padding: "24px 24px 0 24px", border: "none" },
- }}
- >
- <div className="mt-6">
- <Alert variant="info" className="mb-6">
- <Info />
- <AlertTitle>What is a Pass-Through Endpoint?</AlertTitle>
- <AlertDescription>
- Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation
- APIs, or any service you want to proxy through LiteLLM.
- </AlertDescription>
- </Alert>
-
- <form onSubmit={form.handleSubmit(addPassThrough)} className="space-y-6">
- <Card className="block p-5">
- <h3 className="mb-2 text-lg font-semibold text-foreground">Route Configuration</h3>
- <p className="mb-5 text-sm text-muted-foreground">
- Configure how requests to your domain will be forwarded to the target API
- </p>
-
- <div className="space-y-5">
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <div className="flex items-center space-x-3 border-b border-border pb-4">
+ <Plug className="size-5 text-blue-500" />
+ <DialogTitle className="text-xl font-semibold text-foreground">Add Pass-Through Endpoint</DialogTitle>
+ </div>
+ </DialogHeader>
+ <div className="mt-6">
+ <Alert variant="info" className="mb-6">
+ <Info />
+ <AlertTitle>What is a Pass-Through Endpoint?</AlertTitle>
+ <AlertDescription>
+ Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image
+ generation APIs, or any service you want to proxy through LiteLLM.
+ </AlertDescription>
+ </Alert>
+
+ <form onSubmit={form.handleSubmit(addPassThrough)} className="space-y-6">
+ <Card className="block p-5">
+ <h3 className="mb-2 text-lg font-semibold text-foreground">Route Configuration</h3>
+ <p className="mb-5 text-sm text-muted-foreground">
+ Configure how requests to your domain will be forwarded to the target API
+ </p>
+
+ <div className="space-y-5">
+ <FormField
+ control={form.control}
+ name="path"
+ label="Path Prefix"
+ description="Example: /bria, /adobe-photoshop, /elasticsearch"
+ >
+ {({ value, onChange, ...field }) => (
+ <Input
+ {...field}
+ placeholder="bria"
+ value={value ?? ""}
+ onChange={(event) => {
+ const raw = event.target.value;
+ onChange(raw && !raw.startsWith("/") ? "/" + raw : raw);
+ }}
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="target"
+ label="Target URL"
+ description="Example:https://engine.prod.bria-api.com"
+ >
+ {({ value, ...field }) => (
+ <Input {...field} placeholder="https://engine.prod.bria-api.com" value={value ?? ""} />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="methods"
+ label={labelWithHint(
+ "HTTP Methods (Optional)",
+ "Select specific HTTP methods. Leave empty to support all methods (GET, POST, PUT, DELETE, PATCH). Useful when the same path needs different targets for different methods.",
+ )}
+ description={
+ selectedMethods.length === 0
+ ? "All HTTP methods supported (default)"
+ : `Only ${selectedMethods.join(", ")} requests will be routed to this endpoint`
+ }
+ >
+ {({ value, onChange, ref: _ref, ...field }) => (
+ <Select multiple items={HTTP_METHOD_OPTIONS} value={value ?? []} onValueChange={onChange}>
+ <SelectTrigger {...field} className="w-full">
+ <SelectValue placeholder="Select methods (leave empty for all)">
+ {(selected: string[]) =>
+ selected.length === 0 ? "Select methods (leave empty for all)" : selected.join(", ")
+ }
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {HTTP_METHODS.map((method) => (
+ <SelectItem key={method} value={method} title={method}>
+ {method}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+
+ <div className="flex items-center justify-between py-3">
+ <div>
+ <div className="text-sm font-medium text-foreground">Include Subpaths</div>
+ <div className="mt-0.5 text-xs text-muted-foreground">
+ Forward all subpaths to the target API (recommended for REST APIs)
+ </div>
+ </div>
+ <FormField control={form.control} name="include_subpath">
+ {({ value, onChange, ref: _ref, ...field }) => (
+ <Switch {...field} checked={value} onCheckedChange={onChange} />
+ )}
+ </FormField>
+ </div>
+ </div>
+ </Card>
+
+ <RoutePreview pathValue={pathValue} targetValue={targetValue} includeSubpath={includeSubpath} />
+
+ <Card className="block p-6">
+ <h3 className="mb-2 text-lg font-semibold text-foreground">Headers</h3>
+ <p className="mb-6 text-sm text-muted-foreground">
+ Add headers that will be sent with every request to the target API
+ </p>
+
<FormField
control={form.control}
- name="path"
- label="Path Prefix"
- description="Example: /bria, /adobe-photoshop, /elasticsearch"
+ name="headers"
+ label={labelWithHint(
+ "Authentication Headers",
+ "Authentication and other headers to forward with requests",
+ )}
+ description={
+ <>
+ <span className="mb-1 block font-medium">
+ Add authentication tokens and other required headers
+ </span>
+ <span className="block">Common examples: auth_token, Authorization, x-api-key</span>
+ </>
+ }
>
- {({ value, onChange, ...field }) => (
- <Input
- {...field}
- placeholder="bria"
- value={value ?? ""}
- onChange={(event) => {
- const raw = event.target.value;
- onChange(raw && !raw.startsWith("/") ? "/" + raw : raw);
- }}
- />
+ {({ value, onChange }) => <KeyValueInput value={value} onChange={onChange} />}
+ </FormField>
+ </Card>
+
+ <Card className="block p-6">
+ <h3 className="mb-2 text-lg font-semibold text-foreground">Default Query Parameters</h3>
+ <p className="mb-6 text-sm text-muted-foreground">
+ Add query parameters that will be automatically sent with every request to the target API
+ </p>
+
+ <FormField
+ control={form.control}
+ name="default_query_params"
+ label={labelWithHint(
+ "Default Query Parameters (Optional)",
+ "Query parameters that will be added to all requests. Clients can override these by providing their own values.",
)}
+ description={
+ <>
+ <span className="mb-1 block font-medium">
+ Parameters are sent with all GET, POST, PUT, PATCH requests
+ </span>
+ <span className="block">
+ Client parameters override defaults. Examples: version=v1, format=json, key=default
+ </span>
+ </>
+ }
+ >
+ {({ value, onChange }) => <QueryParamInput value={value} onChange={onChange} />}
</FormField>
+ </Card>
+
+ <FormField control={form.control} name="auth">
+ {({ value, onChange }) => (
+ <PassThroughSecuritySection
+ premiumUser={premiumUser}
+ authEnabled={value ?? false}
+ onAuthChange={onChange}
+ />
+ )}
+ </FormField>
+
+ <PassThroughGuardrailsSection accessToken={accessToken} value={guardrails} onChange={setGuardrails} />
+
+ <Card className="block p-6">
+ <h3 className="mb-2 text-lg font-semibold text-foreground">Performance</h3>
+ <p className="mb-6 text-sm text-muted-foreground">
+ Configure upstream request timeout for this endpoint
+ </p>
<FormField
control={form.control}
- name="target"
- label="Target URL"
- description="Example:https://engine.prod.bria-api.com"
+ name="timeout"
+ label={labelWithHint(
+ "Request Timeout (seconds)",
+ "Max time to wait for the upstream API to respond. Leave empty to use general_settings.pass_through_request_timeout (default 600s).",
+ )}
+ description="Use a higher value for slow upstream APIs (e.g. 1200 for long-running LLM calls)"
>
- {({ value, ...field }) => (
- <Input {...field} placeholder="https://engine.prod.bria-api.com" value={value ?? ""} />
+ {({ value, onChange, ref: _ref, ...field }) => (
+ <NumericalInput
+ {...field}
+ min={1}
+ step={1}
+ placeholder="600"
+ value={value ?? ""}
+ onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
+ onChange(optionalText(event.target.value))
+ }
+ />
)}
</FormField>
+ </Card>
+
+ <Card className="block p-6">
+ <h3 className="mb-2 text-lg font-semibold text-foreground">Billing</h3>
+ <p className="mb-6 text-sm text-muted-foreground">Optional cost tracking for this endpoint</p>
<FormField
control={form.control}
- name="methods"
+ name="cost_per_request"
label={labelWithHint(
- "HTTP Methods (Optional)",
- "Select specific HTTP methods. Leave empty to support all methods (GET, POST, PUT, DELETE, PATCH). Useful when the same path needs different targets for different methods.",
+ "Cost Per Request (USD)",
+ "Optional: Track costs for requests to this endpoint",
)}
- description={
- selectedMethods.length === 0
- ? "All HTTP methods supported (default)"
- : `Only ${selectedMethods.join(", ")} requests will be routed to this endpoint`
- }
+ description="The cost charged for each request through this endpoint"
>
{({ value, onChange, ref: _ref, ...field }) => (
- <Select multiple items={HTTP_METHOD_OPTIONS} value={value ?? []} onValueChange={onChange}>
- <SelectTrigger {...field} className="w-full">
- <SelectValue placeholder="Select methods (leave empty for all)">
- {(selected: string[]) =>
- selected.length === 0 ? "Select methods (leave empty for all)" : selected.join(", ")
- }
- </SelectValue>
- </SelectTrigger>
- <SelectContent>
- {HTTP_METHODS.map((method) => (
- <SelectItem key={method} value={method} title={method}>
- {method}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ <NumericalInput
+ {...field}
+ min={0}
+ step={0.001}
+ placeholder="2.0000"
+ value={value ?? ""}
+ onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
+ onChange(optionalText(event.target.value))
+ }
+ />
)}
</FormField>
-
- <div className="flex items-center justify-between py-3">
- <div>
- <div className="text-sm font-medium text-foreground">Include Subpaths</div>
- <div className="mt-0.5 text-xs text-muted-foreground">
- Forward all subpaths to the target API (recommended for REST APIs)
- </div>
- </div>
- <FormField control={form.control} name="include_subpath">
- {({ value, onChange, ref: _ref, ...field }) => (
- <Switch {...field} checked={value} onCheckedChange={onChange} />
- )}
- </FormField>
- </div>
+ </Card>
+
+ <div className="flex items-center justify-end space-x-3 border-t border-border pt-6">
+ <Button type="button" variant="outline" onClick={handleCancel}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={isLoading} aria-busy={isLoading}>
+ {isLoading && <UiLoadingSpinner className="size-4" />}
+ {isLoading ? "Creating..." : "Add Pass-Through Endpoint"}
+ </Button>
</div>
- </Card>
-
- <RoutePreview pathValue={pathValue} targetValue={targetValue} includeSubpath={includeSubpath} />
-
- <Card className="block p-6">
- <h3 className="mb-2 text-lg font-semibold text-foreground">Headers</h3>
- <p className="mb-6 text-sm text-muted-foreground">
- Add headers that will be sent with every request to the target API
- </p>
-
- <FormField
- control={form.control}
- name="headers"
- label={labelWithHint(
- "Authentication Headers",
- "Authentication and other headers to forward with requests",
- )}
- description={
- <>
- <span className="mb-1 block font-medium">
- Add authentication tokens and other required headers
- </span>
- <span className="block">Common examples: auth_token, Authorization, x-api-key</span>
- </>
- }
- >
- {({ value, onChange }) => <KeyValueInput value={value} onChange={onChange} />}
- </FormField>
- </Card>
-
- <Card className="block p-6">
- <h3 className="mb-2 text-lg font-semibold text-foreground">Default Query Parameters</h3>
- <p className="mb-6 text-sm text-muted-foreground">
- Add query parameters that will be automatically sent with every request to the target API
- </p>
-
- <FormField
- control={form.control}
- name="default_query_params"
- label={labelWithHint(
- "Default Query Parameters (Optional)",
- "Query parameters that will be added to all requests. Clients can override these by providing their own values.",
- )}
- description={
- <>
- <span className="mb-1 block font-medium">
- Parameters are sent with all GET, POST, PUT, PATCH requests
- </span>
- <span className="block">
- Client parameters override defaults. Examples: version=v1, format=json, key=default
- </span>
- </>
- }
- >
- {({ value, onChange }) => <QueryParamInput value={value} onChange={onChange} />}
- </FormField>
- </Card>
-
- <FormField control={form.control} name="auth">
- {({ value, onChange }) => (
- <PassThroughSecuritySection
- premiumUser={premiumUser}
- authEnabled={value ?? false}
- onAuthChange={onChange}
- />
- )}
- </FormField>
-
- <PassThroughGuardrailsSection accessToken={accessToken} value={guardrails} onChange={setGuardrails} />
-
- <Card className="block p-6">
- <h3 className="mb-2 text-lg font-semibold text-foreground">Performance</h3>
- <p className="mb-6 text-sm text-muted-foreground">
- Configure upstream request timeout for this endpoint
- </p>
-
- <FormField
- control={form.control}
- name="timeout"
- label={labelWithHint(
- "Request Timeout (seconds)",
- "Max time to wait for the upstream API to respond. Leave empty to use general_settings.pass_through_request_timeout (default 600s).",
- )}
- description="Use a higher value for slow upstream APIs (e.g. 1200 for long-running LLM calls)"
- >
- {({ value, onChange, ref: _ref, ...field }) => (
- <NumericalInput
- {...field}
- min={1}
- step={1}
- placeholder="600"
- value={value ?? ""}
- onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
- onChange(optionalText(event.target.value))
- }
- />
- )}
- </FormField>
- </Card>
-
- <Card className="block p-6">
- <h3 className="mb-2 text-lg font-semibold text-foreground">Billing</h3>
- <p className="mb-6 text-sm text-muted-foreground">Optional cost tracking for this endpoint</p>
-
- <FormField
- control={form.control}
- name="cost_per_request"
- label={labelWithHint("Cost Per Request (USD)", "Optional: Track costs for requests to this endpoint")}
- description="The cost charged for each request through this endpoint"
- >
- {({ value, onChange, ref: _ref, ...field }) => (
- <NumericalInput
- {...field}
- min={0}
- step={0.001}
- placeholder="2.0000"
- value={value ?? ""}
- onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
- onChange(optionalText(event.target.value))
- }
- />
- )}
- </FormField>
- </Card>
-
- <div className="flex items-center justify-end space-x-3 border-t border-border pt-6">
- <Button type="button" variant="outline" onClick={handleCancel}>
- Cancel
- </Button>
- <Button type="submit" disabled={isLoading} aria-busy={isLoading}>
- {isLoading && <UiLoadingSpinner className="size-4" />}
- {isLoading ? "Creating..." : "Add Pass-Through Endpoint"}
- </Button>
- </div>
- </form>
- </div>
- </Modal>
+ </form>
+ </div>
+ </DialogContent>
+ </Dialog>
</div>
</TooltipProvider>
);
diff --git a/ui/litellm-dashboard/src/components/cloudzero_export_modal.tsx b/ui/litellm-dashboard/src/components/cloudzero_export_modal.tsx
index 24aa0d9d1b8..c8ef2218093 100644
--- a/ui/litellm-dashboard/src/components/cloudzero_export_modal.tsx
+++ b/ui/litellm-dashboard/src/components/cloudzero_export_modal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
-import { Modal, Spin, Select } from "antd";
+import { Spin, Select } from "antd";
import { CircleCheck, FileDown } from "lucide-react";
import { z } from "zod/v4";
import { getGlobalLitellmHeaderName } from "@/components/networking";
@@ -12,6 +12,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { useZodForm } from "@/lib/forms/useZodForm";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const cloudZeroSettingsSchema = z.object({
api_key: z.string().min(1, "Please enter your CloudZero API key"),
@@ -241,85 +242,96 @@ const CloudZeroExportModal: React.FC<CloudZeroExportModalProps> = ({ isOpen, onC
];
return (
- <Modal title="Export Data" open={isOpen} onCancel={handleModalClose} footer={null} width={600} destroyOnHidden>
- <div className="space-y-4">
- {/* Export Type Selection */}
- <div>
- <p className="text-sm font-medium mb-2 block">Export Destination</p>
- <Select value={exportType} onChange={setExportType} options={exportOptions} className="w-full" size="large" />
- </div>
-
- {/* CloudZero Configuration */}
- {exportType === "cloudzero" && (
+ <Dialog open={isOpen} onOpenChange={(open) => !open && handleModalClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[600px]">
+ <DialogHeader>
+ <DialogTitle>Export Data</DialogTitle>
+ </DialogHeader>
+ <div className="space-y-4">
+ {/* Export Type Selection */}
<div>
- {settingsLoading ? (
- <div className="flex justify-center py-8">
- <Spin size="large" />
- </div>
- ) : (
- <>
- {existingSettings && (
- <Alert className="mb-4">
- <CircleCheck />
- <AlertTitle>Existing CloudZero Configuration</AlertTitle>
- <AlertDescription>
- API Key: {existingSettings.api_key_masked}
- <br />
- Connection ID: {existingSettings.connection_id}
- </AlertDescription>
- </Alert>
- )}
+ <p className="text-sm font-medium mb-2 block">Export Destination</p>
+ <Select
+ value={exportType}
+ onChange={setExportType}
+ options={exportOptions}
+ className="w-full"
+ size="large"
+ />
+ </div>
- {!existingSettings && (
- <form onSubmit={(event) => event.preventDefault()}>
- <FieldGroup>
- <FormField control={form.control} name="api_key" label="CloudZero API Key">
- {({ ref, ...field }) => (
- <PasswordInput {...field} ref={ref} placeholder="Enter your CloudZero API key" />
- )}
- </FormField>
+ {/* CloudZero Configuration */}
+ {exportType === "cloudzero" && (
+ <div>
+ {settingsLoading ? (
+ <div className="flex justify-center py-8">
+ <Spin size="large" />
+ </div>
+ ) : (
+ <>
+ {existingSettings && (
+ <Alert className="mb-4">
+ <CircleCheck />
+ <AlertTitle>Existing CloudZero Configuration</AlertTitle>
+ <AlertDescription>
+ API Key: {existingSettings.api_key_masked}
+ <br />
+ Connection ID: {existingSettings.connection_id}
+ </AlertDescription>
+ </Alert>
+ )}
- <FormField control={form.control} name="connection_id" label="Connection ID">
- {({ ref, ...field }) => (
- <Input {...field} ref={ref} placeholder="Enter CloudZero connection ID" />
- )}
- </FormField>
- </FieldGroup>
- </form>
- )}
- </>
- )}
- </div>
- )}
+ {!existingSettings && (
+ <form onSubmit={(event) => event.preventDefault()}>
+ <FieldGroup>
+ <FormField control={form.control} name="api_key" label="CloudZero API Key">
+ {({ ref, ...field }) => (
+ <PasswordInput {...field} ref={ref} placeholder="Enter your CloudZero API key" />
+ )}
+ </FormField>
+
+ <FormField control={form.control} name="connection_id" label="Connection ID">
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="Enter CloudZero connection ID" />
+ )}
+ </FormField>
+ </FieldGroup>
+ </form>
+ )}
+ </>
+ )}
+ </div>
+ )}
- {/* CSV Export Info */}
- {exportType === "csv" && (
- <Alert variant="info">
- <FileDown />
- <AlertTitle>CSV Export</AlertTitle>
- <AlertDescription>
- Export your usage data as a CSV file for analysis in spreadsheet applications.
- </AlertDescription>
- </Alert>
- )}
+ {/* CSV Export Info */}
+ {exportType === "csv" && (
+ <Alert variant="info">
+ <FileDown />
+ <AlertTitle>CSV Export</AlertTitle>
+ <AlertDescription>
+ Export your usage data as a CSV file for analysis in spreadsheet applications.
+ </AlertDescription>
+ </Alert>
+ )}
- {/* Action Buttons */}
- <div className="flex justify-end space-x-2 pt-4">
- <Button type="button" variant="secondary" onClick={handleModalClose}>
- Cancel
- </Button>
- <Button
- type="button"
- onClick={handleExport}
- disabled={loading || exportLoading}
- aria-busy={loading || exportLoading}
- >
- {(loading || exportLoading) && <UiLoadingSpinner className="size-4" />}
- {exportType === "cloudzero" ? "Export to CloudZero" : "Export CSV"}
- </Button>
+ {/* Action Buttons */}
+ <div className="flex justify-end space-x-2 pt-4">
+ <Button type="button" variant="secondary" onClick={handleModalClose}>
+ Cancel
+ </Button>
+ <Button
+ type="button"
+ onClick={handleExport}
+ disabled={loading || exportLoading}
+ aria-busy={loading || exportLoading}
+ >
+ {(loading || exportLoading) && <UiLoadingSpinner className="size-4" />}
+ {exportType === "cloudzero" ? "Export to CloudZero" : "Export CSV"}
+ </Button>
+ </div>
</div>
- </div>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx
index 547e19da738..f4c88f09f2c 100644
--- a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx
+++ b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx
@@ -1,5 +1,4 @@
import { useRef, useState } from "react";
-import { Modal } from "antd";
import { Info } from "lucide-react";
import { Alert, AlertTitle } from "@/components/shared/Alert";
import { UserAddOutlined } from "@ant-design/icons";
@@ -18,6 +17,7 @@ import {
ComboboxItem,
ComboboxList,
} from "@/components/ui/combobox";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
@@ -208,67 +208,72 @@ const UserSearchModal: React.FC<UserSearchModalProps> = ({
};
return (
- <Modal title={title} open={isVisible} onCancel={handleClose} footer={null} width={800} maskClosable={!isSubmitting}>
- <TooltipProvider>
- <form onSubmit={form.handleSubmit(handleSubmit)} noValidate>
- <Alert variant="info" className="mb-4" data-testid="member-existing-users-notice">
- <Info />
- <AlertTitle>
- Search selects from users that already exist. To add someone new, ask a proxy admin to create their
- account first.
- </AlertTitle>
- </Alert>
+ <Dialog open={isVisible} onOpenChange={(open) => !open && handleClose()} disablePointerDismissal={isSubmitting}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={form.handleSubmit(handleSubmit)} noValidate>
+ <Alert variant="info" className="mb-4" data-testid="member-existing-users-notice">
+ <Info />
+ <AlertTitle>
+ Search selects from users that already exist. To add someone new, ask a proxy admin to create their
+ account first.
+ </AlertTitle>
+ </Alert>
- <FieldGroup>
- <FormField control={form.control} name="user_email" label="Email">
- {({ id, value, onChange }) =>
- renderUserSearch("user_email", "Search by email", { id, value, onChange }, "member-email-search")
- }
- </FormField>
+ <FieldGroup>
+ <FormField control={form.control} name="user_email" label="Email">
+ {({ id, value, onChange }) =>
+ renderUserSearch("user_email", "Search by email", { id, value, onChange }, "member-email-search")
+ }
+ </FormField>
- <div className="text-center">OR</div>
+ <div className="text-center">OR</div>
- <FormField control={form.control} name="user_id" label="User ID">
- {({ id, value, onChange }) => renderUserSearch("user_id", "Search by user ID", { id, value, onChange })}
- </FormField>
+ <FormField control={form.control} name="user_id" label="User ID">
+ {({ id, value, onChange }) => renderUserSearch("user_id", "Search by user ID", { id, value, onChange })}
+ </FormField>
- <FormField control={form.control} name="role" label="Member Role">
- {({ id, value, onChange }) => (
- <Select items={roles} value={value} onValueChange={(next) => onChange(next as string)}>
- <SelectTrigger id={id}>
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {roles.map((role) => (
- <SelectItem key={role.value} value={role.value}>
- <Tooltip>
- <TooltipTrigger
- render={
- <span>
- <span className="font-medium">{role.label}</span>
- <span className="ml-2 text-sm text-muted-foreground">- {role.description}</span>
- </span>
- }
- />
- <TooltipContent>{role.description}</TooltipContent>
- </Tooltip>
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- )}
- </FormField>
- </FieldGroup>
+ <FormField control={form.control} name="role" label="Member Role">
+ {({ id, value, onChange }) => (
+ <Select items={roles} value={value} onValueChange={(next) => onChange(next as string)}>
+ <SelectTrigger id={id}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {roles.map((role) => (
+ <SelectItem key={role.value} value={role.value}>
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <span>
+ <span className="font-medium">{role.label}</span>
+ <span className="ml-2 text-sm text-muted-foreground">- {role.description}</span>
+ </span>
+ }
+ />
+ <TooltipContent>{role.description}</TooltipContent>
+ </Tooltip>
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+ </FieldGroup>
- <div className="mt-4 text-right">
- <Button type="submit" disabled={isSubmitting}>
- {isSubmitting ? <UiLoadingSpinner className="size-4" /> : <UserAddOutlined />}
- {isSubmitting ? "Adding..." : "Add Member"}
- </Button>
- </div>
- </form>
- </TooltipProvider>
- </Modal>
+ <div className="mt-4 text-right">
+ <Button type="submit" disabled={isSubmitting}>
+ {isSubmitting ? <UiLoadingSpinner className="size-4" /> : <UserAddOutlined />}
+ {isSubmitting ? "Adding..." : "Add Member"}
+ </Button>
+ </div>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/mcp_tools/ByokCredentialModal.tsx b/ui/litellm-dashboard/src/components/mcp_tools/ByokCredentialModal.tsx
index 9fe306de0e8..0e86492731c 100644
--- a/ui/litellm-dashboard/src/components/mcp_tools/ByokCredentialModal.tsx
+++ b/ui/litellm-dashboard/src/components/mcp_tools/ByokCredentialModal.tsx
@@ -1,7 +1,7 @@
"use client";
import React, { useState } from "react";
-import { Modal, Input, Switch } from "antd";
+import { Input, Switch } from "antd";
import { toast } from "@/lib/toast";
import { fetchClient } from "@/lib/http/api";
import { ApiError } from "@/lib/http/client";
@@ -15,6 +15,7 @@ import {
LinkOutlined,
} from "@ant-design/icons";
import { MCPServer } from "./types";
+import { Dialog, DialogContent } from "@/components/ui/dialog";
const byokSaveErrorMessage = (e: unknown): string => {
if (e instanceof ApiError) {
@@ -70,159 +71,166 @@ export const ByokCredentialModal: React.FC<ByokCredentialModalProps> = ({ server
};
return (
- <Modal open={open} onCancel={handleClose} footer={null} width={480} closeIcon={null} className="byok-modal">
- <div className="relative p-2">
- {/* Step dots + close */}
- <div className="flex items-center justify-between mb-6">
- {step === 2 ? (
- <button
- onClick={() => setStep(1)}
- className="flex items-center gap-1 text-gray-500 hover:text-gray-800 text-sm"
- >
- <ArrowLeftOutlined /> Back
+ <Dialog open={open} onOpenChange={(open) => !open && handleClose()}>
+ <DialogContent
+ className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[480px] byok-modal"
+ showCloseButton={false}
+ >
+ <div className="relative p-2">
+ {/* Step dots + close */}
+ <div className="flex items-center justify-between mb-6">
+ {step === 2 ? (
+ <button
+ onClick={() => setStep(1)}
+ className="flex items-center gap-1 text-gray-500 hover:text-gray-800 text-sm"
+ >
+ <ArrowLeftOutlined /> Back
+ </button>
+ ) : (
+ <div />
+ )}
+ <div className="flex items-center gap-1.5">
+ <div className={`w-2 h-2 rounded-full ${step === 1 ? "bg-blue-500" : "bg-gray-300"}`} />
+ <div className={`w-2 h-2 rounded-full ${step === 2 ? "bg-blue-500" : "bg-gray-300"}`} />
+ </div>
+ <button onClick={handleClose} className="text-gray-400 hover:text-gray-600">
+ <CloseOutlined />
</button>
- ) : (
- <div />
- )}
- <div className="flex items-center gap-1.5">
- <div className={`w-2 h-2 rounded-full ${step === 1 ? "bg-blue-500" : "bg-gray-300"}`} />
- <div className={`w-2 h-2 rounded-full ${step === 2 ? "bg-blue-500" : "bg-gray-300"}`} />
</div>
- <button onClick={handleClose} className="text-gray-400 hover:text-gray-600">
- <CloseOutlined />
- </button>
- </div>
- {step === 1 ? (
- <div className="text-center">
- {/* Logos */}
- <div className="flex items-center justify-center gap-3 mb-6">
- <div className="w-14 h-14 rounded-xl bg-linear-to-br from-teal-400 to-cyan-600 flex items-center justify-center text-white font-bold text-xl shadow-sm">
- L
- </div>
- <ArrowRightOutlined className="text-gray-400 text-lg" />
- <div className="w-14 h-14 rounded-xl bg-linear-to-br from-blue-600 to-indigo-800 flex items-center justify-center text-white font-bold text-xl shadow-sm">
- {firstLetter}
+ {step === 1 ? (
+ <div className="text-center">
+ {/* Logos */}
+ <div className="flex items-center justify-center gap-3 mb-6">
+ <div className="w-14 h-14 rounded-xl bg-linear-to-br from-teal-400 to-cyan-600 flex items-center justify-center text-white font-bold text-xl shadow-sm">
+ L
+ </div>
+ <ArrowRightOutlined className="text-gray-400 text-lg" />
+ <div className="w-14 h-14 rounded-xl bg-linear-to-br from-blue-600 to-indigo-800 flex items-center justify-center text-white font-bold text-xl shadow-sm">
+ {firstLetter}
+ </div>
</div>
- </div>
- <h2 className="text-2xl font-bold text-gray-900 mb-2">Connect {serverDisplayName}</h2>
- <p className="text-gray-500 mb-6">LiteLLM needs access to {serverDisplayName} to complete your request.</p>
+ <h2 className="text-2xl font-bold text-gray-900 mb-2">Connect {serverDisplayName}</h2>
+ <p className="text-gray-500 mb-6">
+ LiteLLM needs access to {serverDisplayName} to complete your request.
+ </p>
- {/* How it works */}
- <div className="bg-gray-50 rounded-xl p-4 text-left mb-4">
- <div className="flex items-start gap-3">
- <div className="mt-0.5">
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" className="text-gray-500">
- <rect x="2" y="4" width="20" height="16" rx="2" stroke="currentColor" strokeWidth="2" />
- <path d="M8 4v16M16 4v16" stroke="currentColor" strokeWidth="2" />
- </svg>
+ {/* How it works */}
+ <div className="bg-gray-50 rounded-xl p-4 text-left mb-4">
+ <div className="flex items-start gap-3">
+ <div className="mt-0.5">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" className="text-gray-500">
+ <rect x="2" y="4" width="20" height="16" rx="2" stroke="currentColor" strokeWidth="2" />
+ <path d="M8 4v16M16 4v16" stroke="currentColor" strokeWidth="2" />
+ </svg>
+ </div>
+ <div>
+ <p className="font-semibold text-gray-800 mb-1">How it works</p>
+ <p className="text-gray-500 text-sm">
+ LiteLLM acts as a secure bridge. Your requests are routed through our MCP client directly to{" "}
+ {serverDisplayName}&apos;s API.
+ </p>
+ </div>
</div>
- <div>
- <p className="font-semibold text-gray-800 mb-1">How it works</p>
- <p className="text-gray-500 text-sm">
- LiteLLM acts as a secure bridge. Your requests are routed through our MCP client directly to{" "}
- {serverDisplayName}&apos;s API.
+ </div>
+
+ {/* Requested access */}
+ {server.byok_description && server.byok_description.length > 0 && (
+ <div className="bg-gray-50 rounded-xl p-4 text-left mb-6">
+ <p className="text-xs font-semibold text-gray-500 uppercase tracking-widest mb-3 flex items-center gap-2">
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" className="text-green-500">
+ <path d="M12 2L12 22M2 12L22 12" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
+ <circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2" />
+ </svg>
+ Requested Access
</p>
+ <ul className="space-y-2">
+ {server.byok_description.map((item, i) => (
+ <li key={i} className="flex items-center gap-2 text-sm text-gray-700">
+ <CheckOutlined className="text-green-500 shrink-0" />
+ {item}
+ </li>
+ ))}
+ </ul>
</div>
- </div>
- </div>
+ )}
- {/* Requested access */}
- {server.byok_description && server.byok_description.length > 0 && (
- <div className="bg-gray-50 rounded-xl p-4 text-left mb-6">
- <p className="text-xs font-semibold text-gray-500 uppercase tracking-widest mb-3 flex items-center gap-2">
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" className="text-green-500">
- <path d="M12 2L12 22M2 12L22 12" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
- <circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2" />
- </svg>
- Requested Access
- </p>
- <ul className="space-y-2">
- {server.byok_description.map((item, i) => (
- <li key={i} className="flex items-center gap-2 text-sm text-gray-700">
- <CheckOutlined className="text-green-500 shrink-0" />
- {item}
- </li>
- ))}
- </ul>
+ <button
+ onClick={() => setStep(2)}
+ className="w-full bg-gray-900 hover:bg-gray-700 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors"
+ >
+ Continue to Authentication <ArrowRightOutlined />
+ </button>
+ <button onClick={handleClose} className="mt-3 w-full text-gray-400 hover:text-gray-600 text-sm py-2">
+ Cancel
+ </button>
+ </div>
+ ) : (
+ <div>
+ {/* Key icon */}
+ <div className="w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center mb-4">
+ <KeyOutlined className="text-blue-400 text-xl" />
</div>
- )}
- <button
- onClick={() => setStep(2)}
- className="w-full bg-gray-900 hover:bg-gray-700 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors"
- >
- Continue to Authentication <ArrowRightOutlined />
- </button>
- <button onClick={handleClose} className="mt-3 w-full text-gray-400 hover:text-gray-600 text-sm py-2">
- Cancel
- </button>
- </div>
- ) : (
- <div>
- {/* Key icon */}
- <div className="w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center mb-4">
- <KeyOutlined className="text-blue-400 text-xl" />
- </div>
+ <h2 className="text-2xl font-bold text-gray-900 mb-2">Provide API Key</h2>
+ <p className="text-gray-500 mb-6">Enter your {serverDisplayName} API key to authorize this connection.</p>
+
+ <div className="mb-4">
+ <label className="block text-sm font-semibold text-gray-800 mb-2">{serverDisplayName} API Key</label>
+ <Input.Password
+ placeholder="Enter your API key"
+ value={apiKey}
+ onChange={(e) => setApiKey(e.target.value)}
+ size="large"
+ className="rounded-lg"
+ />
+ {server.byok_api_key_help_url && (
+ <a
+ href={server.byok_api_key_help_url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-blue-500 hover:text-blue-700 text-sm mt-2 flex items-center gap-1"
+ >
+ Where do I find my API key? <LinkOutlined />
+ </a>
+ )}
+ </div>
- <h2 className="text-2xl font-bold text-gray-900 mb-2">Provide API Key</h2>
- <p className="text-gray-500 mb-6">Enter your {serverDisplayName} API key to authorize this connection.</p>
-
- <div className="mb-4">
- <label className="block text-sm font-semibold text-gray-800 mb-2">{serverDisplayName} API Key</label>
- <Input.Password
- placeholder="Enter your API key"
- value={apiKey}
- onChange={(e) => setApiKey(e.target.value)}
- size="large"
- className="rounded-lg"
- />
- {server.byok_api_key_help_url && (
- <a
- href={server.byok_api_key_help_url}
- target="_blank"
- rel="noopener noreferrer"
- className="text-blue-500 hover:text-blue-700 text-sm mt-2 flex items-center gap-1"
- >
- Where do I find my API key? <LinkOutlined />
- </a>
- )}
- </div>
+ {/* Save toggle */}
+ <div className="bg-gray-50 rounded-xl p-4 flex items-center justify-between mb-4">
+ <div className="flex items-center gap-3">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" className="text-gray-500">
+ <path
+ d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"
+ fill="currentColor"
+ />
+ </svg>
+ <span className="text-sm font-medium text-gray-800">Save key for future use</span>
+ </div>
+ <Switch checked={saveKey} onChange={setSaveKey} />
+ </div>
- {/* Save toggle */}
- <div className="bg-gray-50 rounded-xl p-4 flex items-center justify-between mb-4">
- <div className="flex items-center gap-3">
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" className="text-gray-500">
- <path
- d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"
- fill="currentColor"
- />
- </svg>
- <span className="text-sm font-medium text-gray-800">Save key for future use</span>
+ {/* Security note */}
+ <div className="bg-blue-50 rounded-xl p-4 flex items-start gap-3 mb-6">
+ <LockOutlined className="text-blue-400 mt-0.5 shrink-0" />
+ <p className="text-sm text-blue-700">
+ Your key is stored securely and transmitted over HTTPS. It is never shared with third parties.
+ </p>
</div>
- <Switch checked={saveKey} onChange={setSaveKey} />
- </div>
- {/* Security note */}
- <div className="bg-blue-50 rounded-xl p-4 flex items-start gap-3 mb-6">
- <LockOutlined className="text-blue-400 mt-0.5 shrink-0" />
- <p className="text-sm text-blue-700">
- Your key is stored securely and transmitted over HTTPS. It is never shared with third parties.
- </p>
+ <button
+ onClick={handleAuthorize}
+ disabled={loading}
+ className="w-full bg-blue-500 hover:bg-blue-600 disabled:opacity-60 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors"
+ >
+ <LockOutlined /> Connect &amp; Authorize
+ </button>
</div>
-
- <button
- onClick={handleAuthorize}
- disabled={loading}
- className="w-full bg-blue-500 hover:bg-blue-600 disabled:opacity-60 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors"
- >
- <LockOutlined /> Connect &amp; Authorize
- </button>
- </div>
- )}
- </div>
- </Modal>
+ )}
+ </div>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/model_add/CredentialModal.tsx b/ui/litellm-dashboard/src/components/model_add/CredentialModal.tsx
index bf660e65e4e..b0d39de6131 100644
--- a/ui/litellm-dashboard/src/components/model_add/CredentialModal.tsx
+++ b/ui/litellm-dashboard/src/components/model_add/CredentialModal.tsx
@@ -1,5 +1,5 @@
import { Input } from "@/components/ui/input";
-import { Select as AntdSelect, Modal, Tooltip, Typography } from "antd";
+import { Select as AntdSelect, Tooltip, Typography } from "antd";
import { Button } from "@/components/ui/button";
import type { UploadProps } from "antd/es/upload";
import { useState } from "react";
@@ -18,6 +18,7 @@ import { CredentialItem } from "../networking";
import { Providers } from "../provider_info_helpers";
import { Logo } from "@/components/molecules/logo/Logo";
import { resetCredentialFormOnProviderChange } from "./credential_form_helpers";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const { Link } = Typography;
@@ -84,88 +85,86 @@ export default function CredentialModal({
};
return (
- <Modal
- title={isEdit ? "Edit Credential" : "Add New Credential"}
- open={open}
- onCancel={closeAndReset}
- footer={null}
- width={600}
- destroyOnHidden={isEdit}
- >
- <FormProvider {...form}>
- <MountedFormProvider value={{ control: form.control, registry }}>
- <form
- onSubmit={(event) => {
- event.preventDefault();
- void handleSubmit();
- }}
- >
- <MountedFormField
- label="Credential Name:"
- name="credential_name"
- required
- rules={{ validate: { required: antdRequired("Credential name is required") } }}
- className="mb-4"
+ <Dialog open={open} onOpenChange={(open) => !open && closeAndReset()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[600px]">
+ <DialogHeader>
+ <DialogTitle>{isEdit ? "Edit Credential" : "Add New Credential"}</DialogTitle>
+ </DialogHeader>
+ <FormProvider {...form}>
+ <MountedFormProvider value={{ control: form.control, registry }}>
+ <form
+ onSubmit={(event) => {
+ event.preventDefault();
+ void handleSubmit();
+ }}
>
- {(control) => (
- <Input
- id={control.id}
- value={(control.value as string | undefined) ?? ""}
- onChange={control.onChange}
- onBlur={control.onBlur}
- placeholder="Enter a friendly name for these credentials"
- disabled={isEdit}
- />
- )}
- </MountedFormField>
+ <MountedFormField
+ label="Credential Name:"
+ name="credential_name"
+ required
+ rules={{ validate: { required: antdRequired("Credential name is required") } }}
+ className="mb-4"
+ >
+ {(control) => (
+ <Input
+ id={control.id}
+ value={(control.value as string | undefined) ?? ""}
+ onChange={control.onChange}
+ onBlur={control.onBlur}
+ placeholder="Enter a friendly name for these credentials"
+ disabled={isEdit}
+ />
+ )}
+ </MountedFormField>
- <MountedFormField
- label={labelWithHint("Provider:", "Helper to auto-populate provider specific fields")}
- name="custom_llm_provider"
- required
- rules={{ validate: { required: antdRequired("Required") } }}
- className="mb-4"
- >
- {(control) => (
- <AntdSelect
- id={control.id}
- showSearch
- value={control.value as string | undefined}
- onBlur={control.onBlur}
- onChange={(value) => {
- control.onChange(value);
- resetCredentialFormOnProviderChange(formAdapter, value as Providers, setSelectedProvider);
- }}
- >
- {Object.entries(Providers).map(([providerEnum, providerDisplayName]) => (
- <AntdSelect.Option key={providerEnum} value={providerEnum}>
- <div className="flex items-center space-x-2">
- <Logo provider={providerEnum} label={providerDisplayName} className="w-5 h-5" />
- <span>{providerDisplayName}</span>
- </div>
- </AntdSelect.Option>
- ))}
- </AntdSelect>
- )}
- </MountedFormField>
+ <MountedFormField
+ label={labelWithHint("Provider:", "Helper to auto-populate provider specific fields")}
+ name="custom_llm_provider"
+ required
+ rules={{ validate: { required: antdRequired("Required") } }}
+ className="mb-4"
+ >
+ {(control) => (
+ <AntdSelect
+ id={control.id}
+ showSearch
+ value={control.value as string | undefined}
+ onBlur={control.onBlur}
+ onChange={(value) => {
+ control.onChange(value);
+ resetCredentialFormOnProviderChange(formAdapter, value as Providers, setSelectedProvider);
+ }}
+ >
+ {Object.entries(Providers).map(([providerEnum, providerDisplayName]) => (
+ <AntdSelect.Option key={providerEnum} value={providerEnum}>
+ <div className="flex items-center space-x-2">
+ <Logo provider={providerEnum} label={providerDisplayName} className="w-5 h-5" />
+ <span>{providerDisplayName}</span>
+ </div>
+ </AntdSelect.Option>
+ ))}
+ </AntdSelect>
+ )}
+ </MountedFormField>
- <ProviderSpecificFields selectedProvider={selectedProvider} uploadProps={uploadProps} />
+ <ProviderSpecificFields selectedProvider={selectedProvider} uploadProps={uploadProps} />
- <div className="flex justify-between items-center">
- <Tooltip title="Get help on our github">
- <Link href="https://github.com/BerriAI/litellm/issues">Need Help?</Link>
- </Tooltip>
+ <div className="flex justify-between items-center">
+ <Tooltip title="Get help on our github">
+ <Link href="https://github.com/BerriAI/litellm/issues">Need Help?</Link>
+ </Tooltip>
- <div>
- <Button variant="outline" className="mr-2.5" onClick={closeAndReset}>
- Cancel
- </Button>
- <Button type="submit">{isEdit ? "Update Credential" : "Add Credential"}</Button>
+ <div>
+ <Button variant="outline" className="mr-2.5" onClick={closeAndReset}>
+ Cancel
+ </Button>
+ <Button type="submit">{isEdit ? "Update Credential" : "Add Credential"}</Button>
+ </div>
</div>
- </div>
- </form>
- </MountedFormProvider>
- </FormProvider>
- </Modal>
+ </form>
+ </MountedFormProvider>
+ </FormProvider>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx b/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx
index 0e5c8ebca29..f67413ebee7 100644
--- a/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx
+++ b/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx
@@ -1,5 +1,4 @@
import React from "react";
-import { Modal } from "antd";
import { z } from "zod/v4";
import { Field, FieldGroup, FieldLabel } from "@/components/shared/form/field";
import { FormField } from "@/components/shared/form/FormField";
@@ -8,6 +7,7 @@ import { Input } from "@/components/ui/input";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { useZodForm } from "@/lib/forms/useZodForm";
import { CredentialItem } from "../networking";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface ReuseCredentialsModalProps {
isVisible: boolean;
@@ -53,55 +53,60 @@ const ReuseCredentialsModal: React.FC<ReuseCredentialsModalProps> = ({
};
return (
- <Modal title="Reuse Credentials" open={isVisible} onCancel={handleCancel} footer={null} width={600}>
- <TooltipProvider>
- <form onSubmit={form.handleSubmit(handleSubmit)} noValidate>
- <FieldGroup>
- <FormField control={form.control} name="credential_name" label="Credential Name:">
- {({ ref, ...field }) => (
- <Input {...field} ref={ref} placeholder="Enter a friendly name for these credentials" />
- )}
- </FormField>
+ <Dialog open={isVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[600px]">
+ <DialogHeader>
+ <DialogTitle>Reuse Credentials</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={form.handleSubmit(handleSubmit)} noValidate>
+ <FieldGroup>
+ <FormField control={form.control} name="credential_name" label="Credential Name:">
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="Enter a friendly name for these credentials" />
+ )}
+ </FormField>
- {Object.entries(storedValues).map(([key, value]) => (
- <Field key={key}>
- <FieldLabel htmlFor={`${fieldIdPrefix}-${key}`}>{key}</FieldLabel>
- <Input
- id={`${fieldIdPrefix}-${key}`}
- value={String(value)}
- placeholder={`Enter ${key}`}
- disabled
- readOnly
- />
- </Field>
- ))}
+ {Object.entries(storedValues).map(([key, value]) => (
+ <Field key={key}>
+ <FieldLabel htmlFor={`${fieldIdPrefix}-${key}`}>{key}</FieldLabel>
+ <Input
+ id={`${fieldIdPrefix}-${key}`}
+ value={String(value)}
+ placeholder={`Enter ${key}`}
+ disabled
+ readOnly
+ />
+ </Field>
+ ))}
- <div className="flex items-center justify-between">
- <Tooltip>
- <TooltipTrigger
- render={
- <a
- href="https://github.com/BerriAI/litellm/issues"
- className="text-sm text-primary underline-offset-4 hover:underline"
- >
- Need Help?
- </a>
- }
- />
- <TooltipContent>Get help on our github</TooltipContent>
- </Tooltip>
+ <div className="flex items-center justify-between">
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <a
+ href="https://github.com/BerriAI/litellm/issues"
+ className="text-sm text-primary underline-offset-4 hover:underline"
+ >
+ Need Help?
+ </a>
+ }
+ />
+ <TooltipContent>Get help on our github</TooltipContent>
+ </Tooltip>
- <div className="flex gap-2.5">
- <Button type="button" variant="outline" onClick={handleCancel}>
- Cancel
- </Button>
- <Button type="submit">Reuse Credentials</Button>
+ <div className="flex gap-2.5">
+ <Button type="button" variant="outline" onClick={handleCancel}>
+ Cancel
+ </Button>
+ <Button type="submit">Reuse Credentials</Button>
+ </div>
</div>
- </div>
- </FieldGroup>
- </form>
- </TooltipProvider>
- </Modal>
+ </FieldGroup>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/model_dashboard/ModelSettingsModal/ModelSettingsModal.tsx b/ui/litellm-dashboard/src/components/model_dashboard/ModelSettingsModal/ModelSettingsModal.tsx
index 400b1c2859d..5d459bea5ac 100644
--- a/ui/litellm-dashboard/src/components/model_dashboard/ModelSettingsModal/ModelSettingsModal.tsx
+++ b/ui/litellm-dashboard/src/components/model_dashboard/ModelSettingsModal/ModelSettingsModal.tsx
@@ -8,11 +8,12 @@ import { FieldGroup } from "@/components/shared/form/field";
import { FormField } from "@/components/shared/form/FormField";
import { Switch } from "@/components/ui/switch";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
-import { Modal, Skeleton, Space, Typography } from "antd";
+import { Skeleton, Space } from "antd";
import { Button } from "@/components/ui/button";
import { CircleHelp } from "lucide-react";
import React, { useEffect, useMemo } from "react";
import { useForm } from "react-hook-form";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface ModelSettingsModalProps {
isVisible: boolean;
@@ -81,55 +82,56 @@ const ModelSettingsModal: React.FC<ModelSettingsModalProps> = ({ isVisible, onCa
};
return (
- <Modal
- title={<Typography.Title level={5}>Model Settings</Typography.Title>}
- open={isVisible}
- footer={
- <Space>
- <Button variant="outline" onClick={handleCancel} disabled={isPending || isLoadingConfig}>
- Cancel
- </Button>
- <Button
- disabled={isPending || isLoadingConfig}
- aria-busy={isPending}
- onClick={() => void form.handleSubmit(handleFormSubmit)()}
- >
- {isPending ? "Saving..." : "Save Settings"}
- </Button>
- </Space>
- }
- onCancel={handleCancel}
- >
- <TooltipProvider>
- <form onSubmit={(event) => event.preventDefault()}>
- <FieldGroup>
- <FormField
- control={form.control}
- name="store_model_in_db"
- label={labelWithHint(
- "Store Model in DB",
- proxyConfigData?.find((f) => f.field_name === "store_model_in_db")?.field_description ||
- "If enabled, models and config are stored in and loaded from the database.",
- )}
+ <Dialog open={isVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle className="text-base">Model Settings</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={(event) => event.preventDefault()}>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="store_model_in_db"
+ label={labelWithHint(
+ "Store Model in DB",
+ proxyConfigData?.find((f) => f.field_name === "store_model_in_db")?.field_description ||
+ "If enabled, models and config are stored in and loaded from the database.",
+ )}
+ >
+ {({ id, value, onChange, onBlur }) =>
+ isLoadingConfig ? (
+ <Skeleton.Input active block />
+ ) : (
+ <Switch
+ id={id}
+ checked={Boolean(value)}
+ onCheckedChange={onChange}
+ onBlur={onBlur}
+ className="w-fit"
+ />
+ )
+ }
+ </FormField>
+ </FieldGroup>
+ </form>
+ </TooltipProvider>
+ <DialogFooter>
+ <Space>
+ <Button variant="outline" onClick={handleCancel} disabled={isPending || isLoadingConfig}>
+ Cancel
+ </Button>
+ <Button
+ disabled={isPending || isLoadingConfig}
+ aria-busy={isPending}
+ onClick={() => void form.handleSubmit(handleFormSubmit)()}
>
- {({ id, value, onChange, onBlur }) =>
- isLoadingConfig ? (
- <Skeleton.Input active block />
- ) : (
- <Switch
- id={id}
- checked={Boolean(value)}
- onCheckedChange={onChange}
- onBlur={onBlur}
- className="w-fit"
- />
- )
- }
- </FormField>
- </FieldGroup>
- </form>
- </TooltipProvider>
- </Modal>
+ {isPending ? "Saving..." : "Save Settings"}
+ </Button>
+ </Space>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/model_info_view.tsx b/ui/litellm-dashboard/src/components/model_info_view.tsx
index ecc99e4437c..58d7a7bca6e 100644
--- a/ui/litellm-dashboard/src/components/model_info_view.tsx
+++ b/ui/litellm-dashboard/src/components/model_info_view.tsx
@@ -8,7 +8,6 @@ import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { SimpleTooltip } from "@/components/ui/tooltip";
-import { Modal } from "antd";
import { applyPtuModelInfo } from "../utils/ptuModelInfo";
import { usePtuCostAttributionEnabled } from "@/app/(dashboard)/hooks/uiSettings/usePtuCostAttributionEnabled";
import { ArrowLeft, CheckIcon, CopyIcon } from "lucide-react";
@@ -47,6 +46,7 @@ import UpdateModelCredentialsModal from "./update_model_credentials_modal";
import ModelInfoEditForm, { type ModelEditFormValues, type TouchedPricingField } from "./ModelInfoEditForm";
import { Tag } from "./tag_management/types";
import { getDisplayModelName } from "./view_model/model_name_display";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface ModelInfoViewProps {
modelId: string;
@@ -833,13 +833,19 @@ export default function ModelInfoView({
setIsCredentialModalOpen={setIsCredentialModalOpen}
/>
) : (
- <Modal
- open={isCredentialModalOpen}
- onCancel={() => setIsCredentialModalOpen(false)}
- title="Using Existing Credential"
- >
- <p className="text-sm">{modelData.litellm_params.litellm_credential_name}</p>
- </Modal>
+ <Dialog open={isCredentialModalOpen} onOpenChange={(open) => !open && setIsCredentialModalOpen(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Using Existing Credential</DialogTitle>
+ </DialogHeader>
+ <p className="text-sm">{modelData.litellm_params.litellm_credential_name}</p>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setIsCredentialModalOpen(false)}>
+ Cancel
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
)}
{isUpdateCredentialsModalOpen && accessToken && (
@@ -864,21 +870,25 @@ export default function ModelInfoView({
userRole={userRole || ""}
/>
- <Modal
- title="Connection Test Results"
- open={isAutoRouterTestModalOpen}
- onCancel={() => setIsAutoRouterTestModalOpen(false)}
- footer={[
- <Button key="close" variant="outline" onClick={() => setIsAutoRouterTestModalOpen(false)}>
- Close
- </Button>,
- ]}
- width={700}
- >
- {isAutoRouterTestModalOpen && accessToken && (
- <AutoRouterConnectionTest key={autoRouterTestId} accessToken={accessToken} targets={autoRouterTestTargets} />
- )}
- </Modal>
+ <Dialog open={isAutoRouterTestModalOpen} onOpenChange={(open) => !open && setIsAutoRouterTestModalOpen(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Connection Test Results</DialogTitle>
+ </DialogHeader>
+ {isAutoRouterTestModalOpen && accessToken && (
+ <AutoRouterConnectionTest
+ key={autoRouterTestId}
+ accessToken={accessToken}
+ targets={autoRouterTestTargets}
+ />
+ )}
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setIsAutoRouterTestModalOpen(false)}>
+ Close
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</div>
);
}
diff --git a/ui/litellm-dashboard/src/components/onboarding_link.tsx b/ui/litellm-dashboard/src/components/onboarding_link.tsx
index 583a0d25b29..29cb52ce08c 100644
--- a/ui/litellm-dashboard/src/components/onboarding_link.tsx
+++ b/ui/litellm-dashboard/src/components/onboarding_link.tsx
@@ -1,8 +1,9 @@
import React from "react";
-import { Modal, Typography } from "antd";
+import { Typography } from "antd";
import { Button } from "@/components/ui/button";
import { CopyToClipboard } from "react-copy-to-clipboard";
import { toast } from "@/lib/toast";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
export interface InvitationLink {
id: string;
@@ -59,10 +60,6 @@ export default function OnboardingModal({
modalType = "invitation",
}: OnboardingProps) {
const { Paragraph } = Typography;
- const handleInvitationOk = () => {
- setIsInvitationLinkModalVisible(false);
- };
-
const handleInvitationCancel = () => {
setIsInvitationLinkModalVisible(false);
};
@@ -76,32 +73,30 @@ export default function OnboardingModal({
});
return (
- <Modal
- title={modalType === "invitation" ? "Invitation Link" : "Reset Password Link"}
- open={isInvitationLinkModalVisible}
- width={800}
- footer={null}
- onOk={handleInvitationOk}
- onCancel={handleInvitationCancel}
- >
- <Paragraph>
- {modalType === "invitation"
- ? "Copy and send the generated link to onboard this user to the proxy."
- : "Copy and send the generated link to the user to reset their password."}
- </Paragraph>
- <div className="flex justify-between pt-5 pb-2">
- <p className="text-base">User ID</p>
- <p className="text-sm">{invitationLinkData?.user_id}</p>
- </div>
- <div className="flex justify-between pt-5 pb-2">
- <p className="text-sm">{modalType === "invitation" ? "Invitation Link" : "Reset Password Link"}</p>
- <p className="text-sm">{getInvitationUrl()}</p>
- </div>
- <div className="flex justify-end mt-5">
- <CopyToClipboard text={getInvitationUrl()} onCopy={() => toast.success("Copied!")}>
- <Button>{modalType === "invitation" ? "Copy invitation link" : "Copy password reset link"}</Button>
- </CopyToClipboard>
- </div>
- </Modal>
+ <Dialog open={isInvitationLinkModalVisible} onOpenChange={(open) => !open && handleInvitationCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>{modalType === "invitation" ? "Invitation Link" : "Reset Password Link"}</DialogTitle>
+ </DialogHeader>
+ <Paragraph>
+ {modalType === "invitation"
+ ? "Copy and send the generated link to onboard this user to the proxy."
+ : "Copy and send the generated link to the user to reset their password."}
+ </Paragraph>
+ <div className="flex justify-between pt-5 pb-2">
+ <p className="text-base">User ID</p>
+ <p className="text-sm">{invitationLinkData?.user_id}</p>
+ </div>
+ <div className="flex justify-between pt-5 pb-2">
+ <p className="text-sm">{modalType === "invitation" ? "Invitation Link" : "Reset Password Link"}</p>
+ <p className="text-sm">{getInvitationUrl()}</p>
+ </div>
+ <div className="flex justify-end mt-5">
+ <CopyToClipboard text={getInvitationUrl()} onCopy={() => toast.success("Copied!")}>
+ <Button>{modalType === "invitation" ? "Copy invitation link" : "Copy password reset link"}</Button>
+ </CopyToClipboard>
+ </div>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/src/components/organisms/RegenerateKeyModal.tsx b/ui/litellm-dashboard/src/components/organisms/RegenerateKeyModal.tsx
index 88554ddba89..5158d8612ab 100644
--- a/ui/litellm-dashboard/src/components/organisms/RegenerateKeyModal.tsx
+++ b/ui/litellm-dashboard/src/components/organisms/RegenerateKeyModal.tsx
@@ -1,8 +1,8 @@
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
import { CheckOutlined, CopyOutlined, SyncOutlined } from "@ant-design/icons";
import { Alert, AlertTitle } from "@/components/shared/Alert";
-import { Modal, Space } from "antd";
import { Button } from "@/components/ui/button";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { CircleHelp, TriangleAlert } from "lucide-react";
import React, { useEffect, useMemo, useState } from "react";
import { useWatch } from "react-hook-form";
@@ -149,142 +149,139 @@ export function RegenerateKeyModal({ selectedToken, visible, onClose, onKeyUpdat
};
return (
- <Modal
- title="Regenerate Virtual Key"
- open={visible}
- onCancel={handleClose}
- width={520}
- maskClosable={false}
- footer={
- regeneratedKey
- ? [
- <Space key="footer-actions">
- <Button variant="outline" onClick={handleClose}>
- Close
- </Button>
- <CopyToClipboard text={regeneratedKey} onCopy={handleCopyKey}>
- <Button>
- {copied ? <CheckOutlined /> : <CopyOutlined />}
- {copied ? "Copied" : "Copy Key"}
- </Button>
- </CopyToClipboard>
- </Space>,
- ]
- : [
- <Space key="footer-actions">
- <Button variant="outline" onClick={handleClose}>
- Cancel
- </Button>
- <Button onClick={handleRegenerateKey} disabled={isRegenerating} aria-busy={isRegenerating}>
- <SyncOutlined />
- Regenerate
- </Button>
- </Space>,
- ]
- }
- >
- {regeneratedKey ? (
- <div className="flex flex-col gap-4">
- <Alert variant="warning">
- <TriangleAlert />
- <AlertTitle>Save it now, you will not see it again</AlertTitle>
- </Alert>
+ <Dialog open={visible} onOpenChange={(open) => !open && handleClose()} disablePointerDismissal>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[520px]">
+ <DialogHeader>
+ <DialogTitle>Regenerate Virtual Key</DialogTitle>
+ </DialogHeader>
+ {regeneratedKey ? (
+ <div className="flex flex-col gap-4">
+ <Alert variant="warning">
+ <TriangleAlert />
+ <AlertTitle>Save it now, you will not see it again</AlertTitle>
+ </Alert>
- <div className="flex flex-col gap-0.5">
- <span className="text-xs text-muted-foreground">Key Alias</span>
- <span className="text-sm text-foreground">{selectedToken?.key_alias || "No alias set"}</span>
- </div>
+ <div className="flex flex-col gap-0.5">
+ <span className="text-xs text-muted-foreground">Key Alias</span>
+ <span className="text-sm text-foreground">{selectedToken?.key_alias || "No alias set"}</span>
+ </div>
- <div className="flex flex-col gap-1.5">
- <span className="text-xs text-muted-foreground">Virtual Key</span>
- <div className="rounded-md border border-border bg-muted px-4 py-3.5 font-mono text-base break-all text-foreground">
- {regeneratedKey}
+ <div className="flex flex-col gap-1.5">
+ <span className="text-xs text-muted-foreground">Virtual Key</span>
+ <div className="rounded-md border border-border bg-muted px-4 py-3.5 font-mono text-base break-all text-foreground">
+ {regeneratedKey}
+ </div>
</div>
</div>
- </div>
- ) : (
- <TooltipProvider>
- <form onSubmit={(event) => event.preventDefault()} noValidate className="mt-1">
- <FieldGroup>
- <FormField control={form.control} name="key_alias" label="Key Alias">
- {({ ref, value, ...field }) => <Input {...field} ref={ref} value={value ?? ""} disabled />}
- </FormField>
-
- <div className="grid grid-cols-3 gap-3">
- <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- step={0.01}
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
+ ) : (
+ <TooltipProvider>
+ <form onSubmit={(event) => event.preventDefault()} noValidate className="mt-1">
+ <FieldGroup>
+ <FormField control={form.control} name="key_alias" label="Key Alias">
+ {({ ref, value, ...field }) => <Input {...field} ref={ref} value={value ?? ""} disabled />}
</FormField>
- <FormField control={form.control} name="tpm_limit" label="TPM Limit">
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
+ <div className="grid grid-cols-3 gap-3">
+ <FormField control={form.control} name="max_budget" label="Max Budget (USD)">
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ step={0.01}
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
- <FormField control={form.control} name="rpm_limit" label="RPM Limit">
- {({ ref, value, onChange, ...field }) => (
- <Input
- {...field}
- ref={ref}
- type="number"
- value={value ?? ""}
- onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
- />
- )}
- </FormField>
- </div>
+ <FormField control={form.control} name="tpm_limit" label="TPM Limit">
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
+
+ <FormField control={form.control} name="rpm_limit" label="RPM Limit">
+ {({ ref, value, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ type="number"
+ value={value ?? ""}
+ onChange={(event) => onChange(event.target.value === "" ? null : event.target.valueAsNumber)}
+ />
+ )}
+ </FormField>
+ </div>
- <div className="grid grid-cols-2 gap-3">
- <FormField
- control={form.control}
- name="duration"
- label="Expire Key"
- description={
- <span className="flex flex-col gap-0.5 text-xs">
- <span className={keyIsExpired ? "text-destructive" : "text-muted-foreground"}>
- Current expiry: {selectedToken?.expires ? formatExpiresUtc(selectedToken.expires) : "Never"}
- {keyIsExpired && " (expired)"}
+ <div className="grid grid-cols-2 gap-3">
+ <FormField
+ control={form.control}
+ name="duration"
+ label="Expire Key"
+ description={
+ <span className="flex flex-col gap-0.5 text-xs">
+ <span className={keyIsExpired ? "text-destructive" : "text-muted-foreground"}>
+ Current expiry: {selectedToken?.expires ? formatExpiresUtc(selectedToken.expires) : "Never"}
+ {keyIsExpired && " (expired)"}
+ </span>
+ {newExpiryTime && (
+ <span className="text-green-600 dark:text-green-400">New expiry: {newExpiryTime}</span>
+ )}
</span>
- {newExpiryTime && (
- <span className="text-green-600 dark:text-green-400">New expiry: {newExpiryTime}</span>
- )}
- </span>
- }
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="e.g. 30s, 30h, 30d" />}
- </FormField>
+ }
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="e.g. 30s, 30h, 30d" />}
+ </FormField>
- <FormField
- control={form.control}
- name="grace_period"
- label={labelWithHint(
- "Grace Period",
- "Keep the old key valid for this duration after rotation. Both keys work during this period for seamless cutover. Empty = immediate revoke.",
- )}
- description={<span className="text-xs">Recommended: 24h to 72h for production keys</span>}
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="e.g. 24h, 2d" />}
- </FormField>
- </div>
- </FieldGroup>
- </form>
- </TooltipProvider>
- )}
- </Modal>
+ <FormField
+ control={form.control}
+ name="grace_period"
+ label={labelWithHint(
+ "Grace Period",
+ "Keep the old key valid for this duration after rotation. Both keys work during this period for seamless cutover. Empty = immediate revoke.",
+ )}
+ description={<span className="text-xs">Recommended: 24h to 72h for production keys</span>}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="e.g. 24h, 2d" />}
+ </FormField>
+ </div>
+ </FieldGroup>
+ </form>
+ </TooltipProvider>
+ )}
+ <DialogFooter>
+ {regeneratedKey ? (
+ <>
+ <Button variant="outline" onClick={handleClose}>
+ Close
+ </Button>
+ <CopyToClipboard text={regeneratedKey} onCopy={handleCopyKey}>
+ <Button>
+ {copied ? <CheckOutlined /> : <CopyOutlined />}
+ {copied ? "Copied" : "Copy Key"}
+ </Button>
+ </CopyToClipboard>
+ </>
+ ) : (
+ <>
+ <Button variant="outline" onClick={handleClose}>
+ Cancel
+ </Button>
+ <Button onClick={handleRegenerateKey} disabled={isRegenerating} aria-busy={isRegenerating}>
+ <SyncOutlined />
+ Regenerate
+ </Button>
+ </>
+ )}
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
}
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 9117cf41910..1dbc7440e3d 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
@@ -667,7 +667,7 @@ describe("CreateKey", () => {
it("prefills models once the available model list arrives", async () => {
renderCreateKey({ autoOpenCreate: true, prefillData: { models: ["gpt-4"] } });
- expect(await screen.findByTitle("gpt-4")).toBeInTheDocument();
+ expect(await screen.findByTitle("gpt-4", {}, { timeout: 5000 })).toBeInTheDocument();
});
it("ignores a team the user has no access to", async () => {
@@ -977,6 +977,23 @@ describe("CreateKey", () => {
});
});
+ describe("dialog accessible names", () => {
+ it("names the create form dialog", async () => {
+ await openModal();
+
+ expect(screen.getByRole("dialog", { name: "Create New Key" })).toBeInTheDocument();
+ });
+
+ it("names the created key dialog", async () => {
+ await openModal();
+ await nameTheKey();
+ await submit();
+ await createdPayload();
+
+ expect(await screen.findByRole("dialog", { name: "Save your Key" })).toBeInTheDocument();
+ });
+ });
+
describe("key type gating", () => {
it("labels the llm_api option AI APIs", async () => {
await openModal();
diff --git a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx
index ea11a210470..eab5abb9936 100644
--- a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx
+++ b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx
@@ -13,7 +13,7 @@ import { Button } from "@/components/ui/button";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { Input } from "@/components/ui/input";
import { Field, FieldLabel } from "@/components/shared/form/field";
-import { Input as AntdInput, Modal, Radio, Select, Switch, Tag, Tooltip, Typography } from "antd";
+import { Input as AntdInput, Radio, Select, Switch, Tag, Tooltip, Typography } from "antd";
import { ChevronDown } from "lucide-react";
import { useDebouncedCallback } from "@tanstack/react-pacer/debouncer";
import { DEBOUNCE_WAIT_MS } from "@/utils/debounceConstants";
@@ -71,6 +71,7 @@ import NumericalInput from "../shared/numerical_input";
import VectorStoreSelector from "../vector_store_management/VectorStoreSelector";
import { buildKeyCreatePayload, type KeyCreateInput } from "./createKeyPayload";
import { simplifyKeyGenerateError } from "./utils";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const { Option } = Select;
@@ -261,26 +262,6 @@ const CreateKey: React.FC<CreateKeyProps> = ({ team, teams, data, addKey, autoOp
const [agentsList, setAgentsList] = useState<{ agent_id: string; agent_name: string }[]>([]);
const [selectedAgentId, setSelectedAgentId] = useState<string | null>(null);
const selectedModels: string[] = (useWatch({ control: form.control, name: "models" }) as string[] | undefined) ?? [];
- const handleOk = () => {
- setIsModalVisible(false);
- form.reset(formDefaults);
- setLoggingSettings([]);
- setDisabledCallbacks([]);
- setKeyType("llm_api");
- setModelAliases({});
- setAutoRotationEnabled(false);
- setRotationInterval("30d");
- setRouterSettings(null);
- setRouterSettingsKey((prev) => prev + 1);
- setSelectedAgentId(null);
- setSelectedOrganizationId(null);
- setSelectedProjectId(null);
- setBudgetLimits([]);
- setTagRateLimits([]);
- setBudgetFallbacks({});
- setBudgetFallbacksKey((k) => k + 1);
- };
-
const handleCancel = () => {
setIsModalVisible(false);
setApiKey(null);
@@ -651,1126 +632,1135 @@ const CreateKey: React.FC<CreateKeyProps> = ({ team, teams, data, addKey, autoOp
+ Create New Key
</Button>
)}
- <Modal open={isModalVisible} width={1000} footer={null} onOk={handleOk} onCancel={handleCancel}>
- <MountedFormProvider value={mountedForm}>
- <form onSubmit={handleSubmit}>
- {/* Section 1: Key Ownership */}
- <div className="mb-8">
- <h3 className="text-lg font-medium text-foreground mb-4">Key Ownership</h3>
- <Field className="mb-4">
- <FieldLabel>
- <span>
- Owned By{" "}
- <Tooltip title="Select who will own this Virtual Key">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- </FieldLabel>
- <Radio.Group onChange={(e) => setKeyOwner(e.target.value)} value={keyOwner}>
- <Radio value="you">You</Radio>
- <Radio value="service_account">Service Account</Radio>
- {userRole === "Admin" && <Radio value="another_user">Another User</Radio>}
- <Radio value="agent">
- Agent <Tag color="purple">New</Tag>
- </Radio>
- </Radio.Group>
- </Field>
-
- {keyOwner === "another_user" && (
- <MountedFormField
- label={
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <DialogTitle className="text-xl font-semibold text-foreground">Create New Key</DialogTitle>
+ </DialogHeader>
+ <MountedFormProvider value={mountedForm}>
+ <form onSubmit={handleSubmit}>
+ {/* Section 1: Key Ownership */}
+ <div className="mb-8">
+ <h3 className="text-lg font-medium text-foreground mb-4">Key Ownership</h3>
+ <Field className="mb-4">
+ <FieldLabel>
<span>
- User ID{" "}
- <Tooltip title="The user who will own this key and be responsible for its usage">
+ Owned By{" "}
+ <Tooltip title="Select who will own this Virtual Key">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
</Tooltip>
</span>
- }
- name="user_id"
- className="mt-4"
- required
- rules={requiredRule(
- keyOwner === "another_user",
- `Please input the user ID of the user you are assigning the key to`,
- )}
- >
- {(control) => (
- <div
- id={control.id}
- aria-required={control["aria-required"]}
- aria-invalid={control["aria-invalid"]}
- aria-describedby={control["aria-describedby"]}
- onChange={control.onChange}
- >
- <div style={{ display: "flex", marginBottom: "8px" }}>
- <Select
- showSearch
- placeholder="Type email to search for users"
- filterOption={false}
- onSearch={handleUserSearch}
- onSelect={(value, option) => handleUserSelect(value, option as UserOption)}
- options={userOptions}
- loading={userSearchLoading}
- allowClear
- style={{ width: "100%" }}
- notFoundContent={userSearchLoading ? "Searching..." : "No users found"}
- />
- <Button variant="outline" className="ml-2" onClick={() => setIsCreateUserModalVisible(true)}>
- Create User
- </Button>
+ </FieldLabel>
+ <Radio.Group onChange={(e) => setKeyOwner(e.target.value)} value={keyOwner}>
+ <Radio value="you">You</Radio>
+ <Radio value="service_account">Service Account</Radio>
+ {userRole === "Admin" && <Radio value="another_user">Another User</Radio>}
+ <Radio value="agent">
+ Agent <Tag color="purple">New</Tag>
+ </Radio>
+ </Radio.Group>
+ </Field>
+
+ {keyOwner === "another_user" && (
+ <MountedFormField
+ label={
+ <span>
+ User ID{" "}
+ <Tooltip title="The user who will own this key and be responsible for its usage">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="user_id"
+ className="mt-4"
+ required
+ rules={requiredRule(
+ keyOwner === "another_user",
+ `Please input the user ID of the user you are assigning the key to`,
+ )}
+ >
+ {(control) => (
+ <div
+ id={control.id}
+ aria-required={control["aria-required"]}
+ aria-invalid={control["aria-invalid"]}
+ aria-describedby={control["aria-describedby"]}
+ onChange={control.onChange}
+ >
+ <div style={{ display: "flex", marginBottom: "8px" }}>
+ <Select
+ showSearch
+ placeholder="Type email to search for users"
+ filterOption={false}
+ onSearch={handleUserSearch}
+ onSelect={(value, option) => handleUserSelect(value, option as UserOption)}
+ options={userOptions}
+ loading={userSearchLoading}
+ allowClear
+ style={{ width: "100%" }}
+ notFoundContent={userSearchLoading ? "Searching..." : "No users found"}
+ />
+ <Button variant="outline" className="ml-2" onClick={() => setIsCreateUserModalVisible(true)}>
+ Create User
+ </Button>
+ </div>
+ <div className="text-xs text-muted-foreground">Search by email to find users</div>
</div>
- <div className="text-xs text-muted-foreground">Search by email to find users</div>
+ )}
+ </MountedFormField>
+ )}
+ {keyOwner === "agent" && (
+ <div className="mt-4 p-4 bg-purple-50 border border-purple-200 rounded-md">
+ <div className="mb-3">
+ <span className="text-sm font-medium text-foreground">
+ Select Agent <span className="text-destructive">*</span>
+ </span>
+ </div>
+ <Select
+ showSearch
+ placeholder="Select an agent"
+ style={{ width: "100%" }}
+ value={selectedAgentId}
+ onChange={(value) => setSelectedAgentId(value)}
+ filterOption={(input, option) =>
+ (option?.label as string)?.toLowerCase().includes(input.toLowerCase())
+ }
+ options={agentsList.map((a) => ({
+ label: a.agent_name || a.agent_id,
+ value: a.agent_id,
+ }))}
+ />
+ <div className="text-xs text-muted-foreground mt-2">
+ This key will be used by the selected agent to make requests to LiteLLM
</div>
- )}
- </MountedFormField>
- )}
- {keyOwner === "agent" && (
- <div className="mt-4 p-4 bg-purple-50 border border-purple-200 rounded-md">
- <div className="mb-3">
- <span className="text-sm font-medium text-foreground">
- Select Agent <span className="text-destructive">*</span>
- </span>
- </div>
- <Select
- showSearch
- placeholder="Select an agent"
- style={{ width: "100%" }}
- value={selectedAgentId}
- onChange={(value) => setSelectedAgentId(value)}
- filterOption={(input, option) =>
- (option?.label as string)?.toLowerCase().includes(input.toLowerCase())
- }
- options={agentsList.map((a) => ({
- label: a.agent_name || a.agent_id,
- value: a.agent_id,
- }))}
- />
- <div className="text-xs text-muted-foreground mt-2">
- This key will be used by the selected agent to make requests to LiteLLM
</div>
- </div>
- )}
- <MountedFormField
- label={
- <span>
- Organization{" "}
- <Tooltip title="The organization this key belongs to. Selecting an organization filters the available teams.">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="organization_id"
- className="mt-4"
- >
- {(control) => (
- <OrganizationDropdown
- id={control.id}
- value={control.value as string | undefined}
- organizations={organizations}
- loading={isOrganizationsLoading}
- disabled={userRole !== "Admin"}
- onChange={changeOrganization(control.onChange)}
- />
)}
- </MountedFormField>
- <MountedFormField
- label={
- <span>
- Team{" "}
- <Tooltip title="The team this key belongs to, which determines available models and budget limits">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="team_id"
- className="mt-4"
- required={keyOwner === "service_account"}
- rules={requiredRule(keyOwner === "service_account", "Please select a team for the service account")}
- help={keyOwner === "service_account" ? "required" : ""}
- >
- {(control) => (
- <TeamDropdown
- id={control.id}
- value={control.value as string | undefined}
- onChange={control.onChange}
- disabled={selectedProjectId !== null}
- organizationId={selectedOrganizationId}
- onTeamSelect={selectTeam}
- />
- )}
- </MountedFormField>
- {enableProjectsUI && (
<MountedFormField
label={
<span>
- Project{" "}
- <Tooltip title="Assign this key to a project. Selecting a project will lock the team to the project's team.">
+ Organization{" "}
+ <Tooltip title="The organization this key belongs to. Selecting an organization filters the available teams.">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
</Tooltip>
</span>
}
- name="project_id"
+ name="organization_id"
className="mt-4"
>
{(control) => (
- <ProjectDropdown
+ <OrganizationDropdown
id={control.id}
value={control.value as string | undefined}
- projects={projects}
- teamId={selectedCreateKeyTeam?.team_id}
- loading={isProjectsLoading || !teams}
- onChange={changeProject(control.onChange)}
+ organizations={organizations}
+ loading={isOrganizationsLoading}
+ disabled={userRole !== "Admin"}
+ onChange={changeOrganization(control.onChange)}
/>
)}
</MountedFormField>
- )}
- </div>
-
- {/* Show message when team selection is required */}
- {isFormDisabled && (
- <div className="mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md">
- <p className="text-blue-800 text-sm">
- Please select a team to continue configuring your Virtual Key. If you do not see any teams, please
- contact your Proxy Admin to either provide you with access to models or to add you to a team.
- </p>
- </div>
- )}
-
- {/* Section 2: Key Details */}
- {!isFormDisabled && (
- <div className="mb-8">
- <h3 className="text-lg font-medium text-foreground mb-4">Key Details</h3>
- <MountedFormField
- label={
- <span>
- {keyOwner === "you" || keyOwner === "another_user" ? "Key Name" : "Service Account ID"}{" "}
- <Tooltip
- title={
- keyOwner === "you" || keyOwner === "another_user"
- ? "A descriptive name to identify this key"
- : "Unique identifier for this service account"
- }
- >
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="key_alias"
- required
- rules={requiredRule(true, `Please input a ${keyOwner === "you" ? "key name" : "service account ID"}`)}
- help="required"
- >
- {(control) => <Input {...control} value={(control.value as string | undefined) ?? ""} />}
- </MountedFormField>
-
- <MountedFormField
- label={
- <span>
- Models{" "}
- <Tooltip title="Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team. Leave empty to allow access to all models.">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="models"
- help={
- keyType === "management" || keyType === "read_only"
- ? "Models field is disabled for this key type"
- : "optional - leave empty to allow access to all models"
- }
- className="mt-4"
- >
- {(control) => (
- <Select
- {...control}
- value={control.value as string[] | undefined}
- mode="multiple"
- placeholder="Select models"
- style={{ width: "100%" }}
- disabled={keyType === "management" || keyType === "read_only"}
- onChange={(values: string[]) => {
- control.onChange(values);
- if (values.includes("all-team-models")) {
- form.setValue("models", ["all-team-models"]);
- } else if (values.includes("all-proxy-models")) {
- form.setValue("models", ["all-proxy-models"]);
- }
- }}
- >
- {!selectedProjectId && selectedCreateKeyTeam && (
- <Option key="all-team-models" value="all-team-models">
- All Team Models
- </Option>
- )}
- {!selectedProjectId && !selectedCreateKeyTeam && (
- <Option key="all-proxy-models" value="all-proxy-models">
- All Proxy Models
- </Option>
- )}
- {modelsToPick.map((model: string) => (
- <Option key={model} value={model} disabled={hasAllModelsSentinel(selectedModels)}>
- {getModelDisplayName(model)}
- </Option>
- ))}
- </Select>
- )}
- </MountedFormField>
-
<MountedFormField
label={
<span>
- Key Type{" "}
- <Tooltip title="Select the type of key to determine what routes and operations this key can access">
+ Team{" "}
+ <Tooltip title="The team this key belongs to, which determines available models and budget limits">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
</Tooltip>
</span>
}
- name="key_type"
+ name="team_id"
className="mt-4"
+ required={keyOwner === "service_account"}
+ rules={requiredRule(keyOwner === "service_account", "Please select a team for the service account")}
+ help={keyOwner === "service_account" ? "required" : ""}
>
{(control) => (
- <Select
- {...control}
+ <TeamDropdown
+ id={control.id}
value={control.value as string | undefined}
- placeholder="Select key type"
- style={{ width: "100%" }}
- optionLabelProp="label"
- onChange={changeKeyType(control.onChange)}
- >
- <Option value="llm_api" label="AI APIs">
- <div style={{ padding: "4px 0" }}>
- <Typography.Text strong>AI APIs</Typography.Text>
- <Typography.Paragraph type="secondary" style={{ fontSize: 11, margin: "2px 0 0" }}>
- Can call only AI API routes (chat/completions, embeddings, etc.)
- </Typography.Paragraph>
- </div>
- </Option>
- <Option value="management" label="Management">
- <div style={{ padding: "4px 0" }}>
- <Typography.Text strong>Management</Typography.Text>
- <Typography.Paragraph type="secondary" style={{ fontSize: 11, margin: "2px 0 0" }}>
- Can call only management routes (user/team/key management)
- </Typography.Paragraph>
- </div>
- </Option>
- <Option value="default" label="Full Access">
- <div style={{ padding: "4px 0" }}>
- <Typography.Text strong>Full Access</Typography.Text>
- <Typography.Paragraph type="secondary" style={{ fontSize: 11, margin: "2px 0 0" }}>
- Can call all routes (AI APIs, Management, and read-only)
- </Typography.Paragraph>
- </div>
- </Option>
- </Select>
+ onChange={control.onChange}
+ disabled={selectedProjectId !== null}
+ organizationId={selectedOrganizationId}
+ onTeamSelect={selectTeam}
+ />
)}
</MountedFormField>
+ {enableProjectsUI && (
+ <MountedFormField
+ label={
+ <span>
+ Project{" "}
+ <Tooltip title="Assign this key to a project. Selecting a project will lock the team to the project's team.">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="project_id"
+ className="mt-4"
+ >
+ {(control) => (
+ <ProjectDropdown
+ id={control.id}
+ value={control.value as string | undefined}
+ projects={projects}
+ teamId={selectedCreateKeyTeam?.team_id}
+ loading={isProjectsLoading || !teams}
+ onChange={changeProject(control.onChange)}
+ />
+ )}
+ </MountedFormField>
+ )}
</div>
- )}
- {/* Section 3: Optional Settings */}
- {!isFormDisabled && (
- <div className="mb-8">
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <h3 className="m-0 text-lg font-medium text-foreground">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- Optional Settings
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- </h3>
- <CollapsibleContent className="px-4 pb-3">
- <MountedFormField
- className="mt-4"
- label={
- <span>
- Max Budget (USD){" "}
- <Tooltip title="Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="max_budget"
- help={`Budget cannot exceed team max budget: $${team?.max_budget !== null && team?.max_budget !== undefined ? team?.max_budget : "unlimited"}`}
- rules={ceilingRule(
- team?.max_budget,
- (limit) => `Budget cannot exceed team max budget: $${formatNumberWithCommas(limit, 4)}`,
- )}
- >
- {(control) => (
- <NumericalInput
- {...control}
- value={control.value as number | string | undefined}
- step={0.01}
- precision={2}
- width={200}
- />
- )}
- </MountedFormField>
- <MountedFormField
- className="mt-4"
- label={
- <span>
- Reset Budget{" "}
- <Tooltip title="How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="budget_duration"
- help={`Team Reset Budget: ${team?.budget_duration !== null && team?.budget_duration !== undefined ? team?.budget_duration : "None"}`}
- >
- {(control) => (
- <BudgetDurationDropdown
- id={control.id}
- value={control.value as string | null | undefined}
- showNeverResets
- placeholder="Not set"
- onChange={control.onChange}
- />
- )}
- </MountedFormField>
- <Field className="mt-4">
- <FieldLabel>
- <span>
- Budget Windows{" "}
- <Tooltip title="Set multiple independent budget windows (e.g., hourly $10 AND monthly $200). Each window tracks spend separately and resets on its own schedule.">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- </FieldLabel>
- <BudgetWindowsEditor value={budgetLimits} onChange={setBudgetLimits} />
- </Field>
- <Field className="mt-4">
- <FieldLabel>
- <span>
- Budget Fallbacks{" "}
- <Tooltip title="When a model exceeds its per-model budget (model_max_budget), requests automatically reroute to fallback models instead of failing. Configure per-model budgets in Advanced Settings.">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- </FieldLabel>
- <BudgetFallbacksEditor
- key={budgetFallbacksKey}
- value={budgetFallbacks}
- onChange={setBudgetFallbacks}
- availableModels={modelsToPick}
- />
- </Field>
- <MountedFormField
- className="mt-4"
- label={
- <span>
- Tokens per minute Limit (TPM){" "}
- <Tooltip title="Maximum number of tokens this key can process per minute. Helps control usage and costs">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="tpm_limit"
- help={`TPM cannot exceed team TPM limit: ${team?.tpm_limit !== null && team?.tpm_limit !== undefined ? team?.tpm_limit : "unlimited"}`}
- rules={ceilingRule(
- team?.tpm_limit,
- (limit) => `TPM limit cannot exceed team TPM limit: ${limit}`,
- )}
- >
- {(control) => (
- <NumericalInput
- {...control}
- value={control.value as number | string | undefined}
- step={1}
- width={400}
- />
- )}
- </MountedFormField>
- <MountedFormField name="tpm_limit_type" bare>
- {(control) => (
- <RateLimitTypeFormItem
- type="tpm"
- name="tpm_limit_type"
- className="mt-4"
- showDetailedDescriptions
- id={control.id}
- value={control.value as string | null | undefined}
- onChange={control.onChange}
- aria-invalid={control["aria-invalid"] ? true : undefined}
- aria-describedby={control["aria-describedby"]}
- />
- )}
- </MountedFormField>
- <MountedFormField
- className="mt-4"
- label={
- <span>
- Requests per minute Limit (RPM){" "}
- <Tooltip title="Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="rpm_limit"
- help={`RPM cannot exceed team RPM limit: ${team?.rpm_limit !== null && team?.rpm_limit !== undefined ? team?.rpm_limit : "unlimited"}`}
- rules={ceilingRule(
- team?.rpm_limit,
- (limit) => `RPM limit cannot exceed team RPM limit: ${limit}`,
- )}
- >
- {(control) => (
- <NumericalInput
- {...control}
- value={control.value as number | string | undefined}
- step={1}
- width={400}
- />
- )}
- </MountedFormField>
- <MountedFormField name="rpm_limit_type" bare>
- {(control) => (
- <RateLimitTypeFormItem
- type="rpm"
- name="rpm_limit_type"
- className="mt-4"
- showDetailedDescriptions
- id={control.id}
- value={control.value as string | null | undefined}
- onChange={control.onChange}
- aria-invalid={control["aria-invalid"] ? true : undefined}
- aria-describedby={control["aria-describedby"]}
- />
- )}
- </MountedFormField>
- <Field className="mt-4">
- <FieldLabel>
- <span>
- Per-Tag Rate Limits{" "}
- <Tooltip title="Scope rate limits to a request tag so each tag (e.g. a cell or group) gets its own RPM counter. Requests without a matching tag fall back to the key-level limit.">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- </FieldLabel>
- <TagRateLimitEditor value={tagRateLimits} onChange={setTagRateLimits} />
- </Field>
- <MountedFormField
- className="mt-4"
- label={
- <span>
- Throttle on budget exceeded{" "}
- <Tooltip title="When this key exceeds its max budget, throttle its TPM/RPM to the globally configured percentage instead of blocking access entirely. Requires budget_exceeded_throttle_percentage in litellm_settings and a TPM/RPM limit on the key.">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="throttle_on_budget_exceeded"
- >
- {(control) => (
- <Switch
- id={control.id}
- checked={control.value as boolean | undefined}
- onChange={control.onChange}
- checkedChildren="Yes"
- unCheckedChildren="No"
- />
- )}
- </MountedFormField>
- <MountedFormField
- className="mt-4"
- label={
- <span>
- Enable Prompt Caching{" "}
- <Tooltip title="Automatically add prompt caching breakpoints (cache_control markers) to requests made with this key, cutting input cost on repeated prompts. Applies to Anthropic and Bedrock Claude models; requests that already set their own cache_control markers are left untouched.">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="enable_prompt_caching"
- >
- {(control) => (
- <Switch
- id={control.id}
- checked={control.value as boolean | undefined}
- onChange={control.onChange}
- checkedChildren="Yes"
- unCheckedChildren="No"
- />
- )}
- </MountedFormField>
- <MountedFormField
- label={
- <span>
- Guardrails{" "}
- <Tooltip title="Apply safety guardrails to this key to filter content or enforce policies">
- <a
- href="https://docs.litellm.ai/docs/proxy/guardrails/quick_start"
- target="_blank"
- rel="noopener noreferrer"
- onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
- >
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </a>
- </Tooltip>
- </span>
- }
- name="guardrails"
- className="mt-4"
- help={
- canEditGuardrails
- ? "Select existing guardrails or enter new ones"
- : "Premium feature - Upgrade to set guardrails by key"
- }
- >
- {(control) => (
- <Select
- {...control}
- value={control.value as string[] | undefined}
- mode="tags"
- style={{ width: "100%" }}
- disabled={!canEditGuardrails}
- placeholder={
- !canEditGuardrails
- ? "Premium feature - Upgrade to set guardrails by key"
- : "Select or enter guardrails"
+ {/* Show message when team selection is required */}
+ {isFormDisabled && (
+ <div className="mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md">
+ <p className="text-blue-800 text-sm">
+ Please select a team to continue configuring your Virtual Key. If you do not see any teams, please
+ contact your Proxy Admin to either provide you with access to models or to add you to a team.
+ </p>
+ </div>
+ )}
+
+ {/* Section 2: Key Details */}
+ {!isFormDisabled && (
+ <div className="mb-8">
+ <h3 className="text-lg font-medium text-foreground mb-4">Key Details</h3>
+ <MountedFormField
+ label={
+ <span>
+ {keyOwner === "you" || keyOwner === "another_user" ? "Key Name" : "Service Account ID"}{" "}
+ <Tooltip
+ title={
+ keyOwner === "you" || keyOwner === "another_user"
+ ? "A descriptive name to identify this key"
+ : "Unique identifier for this service account"
}
- options={guardrailsList.map((name) => ({ value: name, label: name }))}
- />
- )}
- </MountedFormField>
- <MountedFormField
- label={
- <span>
- Disable Global Guardrails{" "}
- <Tooltip title="When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)">
- <a
- href="https://docs.litellm.ai/docs/proxy/guardrails/quick_start"
- target="_blank"
- rel="noopener noreferrer"
- onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
- >
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </a>
- </Tooltip>
- </span>
- }
- name="disable_global_guardrails"
- className="mt-4"
- help={
- canEditGuardrails
- ? "Bypass global guardrails for this key"
- : "Premium feature - Upgrade to disable global guardrails by key"
- }
- >
- {(control) => (
- <Switch
- id={control.id}
- checked={control.value as boolean | undefined}
- onChange={control.onChange}
- disabled={!canEditGuardrails}
- checkedChildren="Yes"
- unCheckedChildren="No"
- />
- )}
- </MountedFormField>
- {canViewPolicies && (
+ >
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="key_alias"
+ required
+ rules={requiredRule(
+ true,
+ `Please input a ${keyOwner === "you" ? "key name" : "service account ID"}`,
+ )}
+ help="required"
+ >
+ {(control) => <Input {...control} value={(control.value as string | undefined) ?? ""} />}
+ </MountedFormField>
+
+ <MountedFormField
+ label={
+ <span>
+ Models{" "}
+ <Tooltip title="Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team. Leave empty to allow access to all models.">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="models"
+ help={
+ keyType === "management" || keyType === "read_only"
+ ? "Models field is disabled for this key type"
+ : "optional - leave empty to allow access to all models"
+ }
+ className="mt-4"
+ >
+ {(control) => (
+ <Select
+ {...control}
+ value={control.value as string[] | undefined}
+ mode="multiple"
+ placeholder="Select models"
+ style={{ width: "100%" }}
+ disabled={keyType === "management" || keyType === "read_only"}
+ onChange={(values: string[]) => {
+ control.onChange(values);
+ if (values.includes("all-team-models")) {
+ form.setValue("models", ["all-team-models"]);
+ } else if (values.includes("all-proxy-models")) {
+ form.setValue("models", ["all-proxy-models"]);
+ }
+ }}
+ >
+ {!selectedProjectId && selectedCreateKeyTeam && (
+ <Option key="all-team-models" value="all-team-models">
+ All Team Models
+ </Option>
+ )}
+ {!selectedProjectId && !selectedCreateKeyTeam && (
+ <Option key="all-proxy-models" value="all-proxy-models">
+ All Proxy Models
+ </Option>
+ )}
+ {modelsToPick.map((model: string) => (
+ <Option key={model} value={model} disabled={hasAllModelsSentinel(selectedModels)}>
+ {getModelDisplayName(model)}
+ </Option>
+ ))}
+ </Select>
+ )}
+ </MountedFormField>
+
+ <MountedFormField
+ label={
+ <span>
+ Key Type{" "}
+ <Tooltip title="Select the type of key to determine what routes and operations this key can access">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="key_type"
+ className="mt-4"
+ >
+ {(control) => (
+ <Select
+ {...control}
+ value={control.value as string | undefined}
+ placeholder="Select key type"
+ style={{ width: "100%" }}
+ optionLabelProp="label"
+ onChange={changeKeyType(control.onChange)}
+ >
+ <Option value="llm_api" label="AI APIs">
+ <div style={{ padding: "4px 0" }}>
+ <Typography.Text strong>AI APIs</Typography.Text>
+ <Typography.Paragraph type="secondary" style={{ fontSize: 11, margin: "2px 0 0" }}>
+ Can call only AI API routes (chat/completions, embeddings, etc.)
+ </Typography.Paragraph>
+ </div>
+ </Option>
+ <Option value="management" label="Management">
+ <div style={{ padding: "4px 0" }}>
+ <Typography.Text strong>Management</Typography.Text>
+ <Typography.Paragraph type="secondary" style={{ fontSize: 11, margin: "2px 0 0" }}>
+ Can call only management routes (user/team/key management)
+ </Typography.Paragraph>
+ </div>
+ </Option>
+ <Option value="default" label="Full Access">
+ <div style={{ padding: "4px 0" }}>
+ <Typography.Text strong>Full Access</Typography.Text>
+ <Typography.Paragraph type="secondary" style={{ fontSize: 11, margin: "2px 0 0" }}>
+ Can call all routes (AI APIs, Management, and read-only)
+ </Typography.Paragraph>
+ </div>
+ </Option>
+ </Select>
+ )}
+ </MountedFormField>
+ </div>
+ )}
+
+ {/* Section 3: Optional Settings */}
+ {!isFormDisabled && (
+ <div className="mb-8">
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <h3 className="m-0 text-lg font-medium text-foreground">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ Optional Settings
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ </h3>
+ <CollapsibleContent className="px-4 pb-3">
<MountedFormField
+ className="mt-4"
label={
<span>
- Policies{" "}
- <Tooltip title="Apply policies to this key to control guardrails and other settings">
- <a
- href="https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies"
- target="_blank"
- rel="noopener noreferrer"
- onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
- >
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </a>
+ Max Budget (USD){" "}
+ <Tooltip title="Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
</Tooltip>
</span>
}
- name="policies"
- className="mt-4"
- help={
- premiumUser
- ? "Select existing policies or enter new ones"
- : "Premium feature - Upgrade to set policies by key"
- }
+ name="max_budget"
+ help={`Budget cannot exceed team max budget: $${team?.max_budget !== null && team?.max_budget !== undefined ? team?.max_budget : "unlimited"}`}
+ rules={ceilingRule(
+ team?.max_budget,
+ (limit) => `Budget cannot exceed team max budget: $${formatNumberWithCommas(limit, 4)}`,
+ )}
>
{(control) => (
- <Select
+ <NumericalInput
{...control}
- value={control.value as string[] | undefined}
- mode="tags"
- style={{ width: "100%" }}
- disabled={!premiumUser}
- placeholder={
- !premiumUser
- ? "Premium feature - Upgrade to set policies by key"
- : "Select or enter policies"
- }
- options={policiesList.map((name) => ({ value: name, label: name }))}
+ value={control.value as number | string | undefined}
+ step={0.01}
+ precision={2}
+ width={200}
/>
)}
</MountedFormField>
- )}
- {canViewPrompts && (
<MountedFormField
+ className="mt-4"
label={
<span>
- Prompts{" "}
- <Tooltip title="Allow this key to use specific prompt templates">
- <a
- href="https://docs.litellm.ai/docs/proxy/prompt_management"
- target="_blank"
- rel="noopener noreferrer"
- onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
- >
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </a>
+ Reset Budget{" "}
+ <Tooltip title="How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
</Tooltip>
</span>
}
- name="prompts"
+ name="budget_duration"
+ help={`Team Reset Budget: ${team?.budget_duration !== null && team?.budget_duration !== undefined ? team?.budget_duration : "None"}`}
+ >
+ {(control) => (
+ <BudgetDurationDropdown
+ id={control.id}
+ value={control.value as string | null | undefined}
+ showNeverResets
+ placeholder="Not set"
+ onChange={control.onChange}
+ />
+ )}
+ </MountedFormField>
+ <Field className="mt-4">
+ <FieldLabel>
+ <span>
+ Budget Windows{" "}
+ <Tooltip title="Set multiple independent budget windows (e.g., hourly $10 AND monthly $200). Each window tracks spend separately and resets on its own schedule.">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ </FieldLabel>
+ <BudgetWindowsEditor value={budgetLimits} onChange={setBudgetLimits} />
+ </Field>
+ <Field className="mt-4">
+ <FieldLabel>
+ <span>
+ Budget Fallbacks{" "}
+ <Tooltip title="When a model exceeds its per-model budget (model_max_budget), requests automatically reroute to fallback models instead of failing. Configure per-model budgets in Advanced Settings.">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ </FieldLabel>
+ <BudgetFallbacksEditor
+ key={budgetFallbacksKey}
+ value={budgetFallbacks}
+ onChange={setBudgetFallbacks}
+ availableModels={modelsToPick}
+ />
+ </Field>
+ <MountedFormField
className="mt-4"
- help={
- premiumUser
- ? "Select existing prompts or enter new ones"
- : "Premium feature - Upgrade to set prompts by key"
+ label={
+ <span>
+ Tokens per minute Limit (TPM){" "}
+ <Tooltip title="Maximum number of tokens this key can process per minute. Helps control usage and costs">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
}
+ name="tpm_limit"
+ help={`TPM cannot exceed team TPM limit: ${team?.tpm_limit !== null && team?.tpm_limit !== undefined ? team?.tpm_limit : "unlimited"}`}
+ rules={ceilingRule(
+ team?.tpm_limit,
+ (limit) => `TPM limit cannot exceed team TPM limit: ${limit}`,
+ )}
>
{(control) => (
- <Select
+ <NumericalInput
{...control}
- value={control.value as string[] | undefined}
- mode="tags"
- style={{ width: "100%" }}
- disabled={!premiumUser}
- placeholder={
- !premiumUser
- ? "Premium feature - Upgrade to set prompts by key"
- : "Select or enter prompts"
- }
- options={promptsList.map((name) => ({ value: name, label: name }))}
+ value={control.value as number | string | undefined}
+ step={1}
+ width={400}
/>
)}
</MountedFormField>
- )}
- <MountedFormField
- label={
- <span>
- Access Groups{" "}
- <Tooltip title="Assign access groups to this key. Access groups control which models, MCP servers, and agents this key can use">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="access_group_ids"
- className="mt-4"
- help="Select access groups to assign to this key"
- >
- {(control) => (
- <AccessGroupSelector
- value={control.value as string[] | undefined}
- onChange={control.onChange}
- placeholder="Select access groups (optional)"
- />
- )}
- </MountedFormField>
- <MountedFormField
- label={
- <span>
- Allowed Pass Through Routes{" "}
- <Tooltip title="Allow this key to use specific pass through routes">
- <a
- href="https://docs.litellm.ai/docs/proxy/pass_through"
- target="_blank"
- rel="noopener noreferrer"
- onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
- >
+ <MountedFormField name="tpm_limit_type" bare>
+ {(control) => (
+ <RateLimitTypeFormItem
+ type="tpm"
+ name="tpm_limit_type"
+ className="mt-4"
+ showDetailedDescriptions
+ id={control.id}
+ value={control.value as string | null | undefined}
+ onChange={control.onChange}
+ aria-invalid={control["aria-invalid"] ? true : undefined}
+ aria-describedby={control["aria-describedby"]}
+ />
+ )}
+ </MountedFormField>
+ <MountedFormField
+ className="mt-4"
+ label={
+ <span>
+ Requests per minute Limit (RPM){" "}
+ <Tooltip title="Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load">
<InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </a>
- </Tooltip>
- </span>
- }
- name="allowed_passthrough_routes"
- className="mt-4"
- help={
- premiumUser
- ? "Select existing pass through routes or enter new ones"
- : "Premium feature - Upgrade to set pass through routes by key"
- }
- >
- {(control) => (
- <PassThroughRoutesSelector
- value={control.value as string[] | undefined}
- onChange={control.onChange}
- accessToken={accessToken}
- placeholder={
- !premiumUser
- ? "Premium feature - Upgrade to set pass through routes by key"
- : "Select or enter pass through routes"
- }
- disabled={!premiumUser}
- teamId={selectedCreateKeyTeam ? selectedCreateKeyTeam.team_id : null}
- />
- )}
- </MountedFormField>
- <MountedFormField
- label={
- <span>
- Allowed Vector Stores{" "}
- <Tooltip title="Select which vector stores this key can access. If none selected, the key will have access to all available vector stores">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="allowed_vector_store_ids"
- className="mt-4"
- help="Select vector stores this key can access. Leave empty for access to all vector stores"
- >
- {(control) => (
- <VectorStoreSelector
- onChange={control.onChange}
- value={control.value as string[] | undefined}
- accessToken={accessToken}
- placeholder="Select vector stores (optional)"
- />
- )}
- </MountedFormField>
- <MountedFormField
- label={
- <span>
- Metadata{" "}
- <Tooltip title="JSON object with additional information about this key. Used for tracking or custom logic">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="metadata"
- className="mt-4"
- >
- {(control) => (
- <AntdInput.TextArea
- {...control}
- value={control.value as string | undefined}
- rows={4}
- placeholder="Enter metadata as JSON"
- />
- )}
- </MountedFormField>
- <MountedFormField
- label={
- <span>
- Tags{" "}
- <Tooltip title="Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
- </Tooltip>
- </span>
- }
- name="tags"
- className="mt-4"
- help={`Tags for tracking spend and/or doing tag-based routing.`}
- >
- {(control) => (
- <Select
- {...control}
- value={control.value as string[] | undefined}
- mode="tags"
- style={{ width: "100%" }}
- placeholder="Select or enter tags"
- tokenSeparators={[","]}
- options={tagOptions}
- />
- )}
- </MountedFormField>
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <b>MCP Settings</b>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
+ </Tooltip>
+ </span>
+ }
+ name="rpm_limit"
+ help={`RPM cannot exceed team RPM limit: ${team?.rpm_limit !== null && team?.rpm_limit !== undefined ? team?.rpm_limit : "unlimited"}`}
+ rules={ceilingRule(
+ team?.rpm_limit,
+ (limit) => `RPM limit cannot exceed team RPM limit: ${limit}`,
+ )}
+ >
+ {(control) => (
+ <NumericalInput
+ {...control}
+ value={control.value as number | string | undefined}
+ step={1}
+ width={400}
+ />
+ )}
+ </MountedFormField>
+ <MountedFormField name="rpm_limit_type" bare>
+ {(control) => (
+ <RateLimitTypeFormItem
+ type="rpm"
+ name="rpm_limit_type"
+ className="mt-4"
+ showDetailedDescriptions
+ id={control.id}
+ value={control.value as string | null | undefined}
+ onChange={control.onChange}
+ aria-invalid={control["aria-invalid"] ? true : undefined}
+ aria-describedby={control["aria-describedby"]}
+ />
+ )}
+ </MountedFormField>
+ <Field className="mt-4">
+ <FieldLabel>
+ <span>
+ Per-Tag Rate Limits{" "}
+ <Tooltip title="Scope rate limits to a request tag so each tag (e.g. a cell or group) gets its own RPM counter. Requests without a matching tag fall back to the key-level limit.">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ </FieldLabel>
+ <TagRateLimitEditor value={tagRateLimits} onChange={setTagRateLimits} />
+ </Field>
+ <MountedFormField
+ className="mt-4"
+ label={
+ <span>
+ Throttle on budget exceeded{" "}
+ <Tooltip title="When this key exceeds its max budget, throttle its TPM/RPM to the globally configured percentage instead of blocking access entirely. Requires budget_exceeded_throttle_percentage in litellm_settings and a TPM/RPM limit on the key.">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="throttle_on_budget_exceeded"
+ >
+ {(control) => (
+ <Switch
+ id={control.id}
+ checked={control.value as boolean | undefined}
+ onChange={control.onChange}
+ checkedChildren="Yes"
+ unCheckedChildren="No"
+ />
+ )}
+ </MountedFormField>
+ <MountedFormField
+ className="mt-4"
+ label={
+ <span>
+ Enable Prompt Caching{" "}
+ <Tooltip title="Automatically add prompt caching breakpoints (cache_control markers) to requests made with this key, cutting input cost on repeated prompts. Applies to Anthropic and Bedrock Claude models; requests that already set their own cache_control markers are left untouched.">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="enable_prompt_caching"
+ >
+ {(control) => (
+ <Switch
+ id={control.id}
+ checked={control.value as boolean | undefined}
+ onChange={control.onChange}
+ checkedChildren="Yes"
+ unCheckedChildren="No"
+ />
+ )}
+ </MountedFormField>
+ <MountedFormField
+ label={
+ <span>
+ Guardrails{" "}
+ <Tooltip title="Apply safety guardrails to this key to filter content or enforce policies">
+ <a
+ href="https://docs.litellm.ai/docs/proxy/guardrails/quick_start"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
+ >
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </a>
+ </Tooltip>
+ </span>
+ }
+ name="guardrails"
+ className="mt-4"
+ help={
+ canEditGuardrails
+ ? "Select existing guardrails or enter new ones"
+ : "Premium feature - Upgrade to set guardrails by key"
+ }
+ >
+ {(control) => (
+ <Select
+ {...control}
+ value={control.value as string[] | undefined}
+ mode="tags"
+ style={{ width: "100%" }}
+ disabled={!canEditGuardrails}
+ placeholder={
+ !canEditGuardrails
+ ? "Premium feature - Upgrade to set guardrails by key"
+ : "Select or enter guardrails"
+ }
+ options={guardrailsList.map((name) => ({ value: name, label: name }))}
+ />
+ )}
+ </MountedFormField>
+ <MountedFormField
+ label={
+ <span>
+ Disable Global Guardrails{" "}
+ <Tooltip title="When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)">
+ <a
+ href="https://docs.litellm.ai/docs/proxy/guardrails/quick_start"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
+ >
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </a>
+ </Tooltip>
+ </span>
+ }
+ name="disable_global_guardrails"
+ className="mt-4"
+ help={
+ canEditGuardrails
+ ? "Bypass global guardrails for this key"
+ : "Premium feature - Upgrade to disable global guardrails by key"
+ }
+ >
+ {(control) => (
+ <Switch
+ id={control.id}
+ checked={control.value as boolean | undefined}
+ onChange={control.onChange}
+ disabled={!canEditGuardrails}
+ checkedChildren="Yes"
+ unCheckedChildren="No"
+ />
+ )}
+ </MountedFormField>
+ {canViewPolicies && (
<MountedFormField
label={
<span>
- Allowed MCP Servers{" "}
- <Tooltip title="Select which MCP servers or access groups this key can access">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ Policies{" "}
+ <Tooltip title="Apply policies to this key to control guardrails and other settings">
+ <a
+ href="https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
+ >
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </a>
</Tooltip>
</span>
}
- name="allowed_mcp_servers_and_groups"
- help="Select MCP servers or access groups this key can access"
+ name="policies"
+ className="mt-4"
+ help={
+ premiumUser
+ ? "Select existing policies or enter new ones"
+ : "Premium feature - Upgrade to set policies by key"
+ }
>
{(control) => (
- <MCPServerSelector
- onChange={control.onChange}
- value={control.value as McpSelectorValue | undefined}
- accessToken={accessToken}
- teamId={selectedCreateKeyTeam?.team_id ?? null}
- placeholder="Select MCP servers or access groups (optional)"
- allowNoMcpServers
+ <Select
+ {...control}
+ value={control.value as string[] | undefined}
+ mode="tags"
+ style={{ width: "100%" }}
+ disabled={!premiumUser}
+ placeholder={
+ !premiumUser
+ ? "Premium feature - Upgrade to set policies by key"
+ : "Select or enter policies"
+ }
+ options={policiesList.map((name) => ({ value: name, label: name }))}
/>
)}
</MountedFormField>
-
- {/* Hidden field to register mcp_tool_permissions with the form */}
- <MountedFormField name="mcp_tool_permissions" bare>
- {(control) => <input type="hidden" id={control.id} name={control.name} />}
- </MountedFormField>
-
- <McpToolPermissionsField
- accessToken={accessToken}
- control={form.control}
- setValue={form.setValue}
- />
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <b>Agent Settings</b>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
+ )}
+ {canViewPrompts && (
<MountedFormField
label={
<span>
- Allowed Agents{" "}
- <Tooltip title="Select which agents or access groups this key can access">
- <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ Prompts{" "}
+ <Tooltip title="Allow this key to use specific prompt templates">
+ <a
+ href="https://docs.litellm.ai/docs/proxy/prompt_management"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
+ >
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </a>
</Tooltip>
</span>
}
- name="allowed_agents_and_groups"
- help="Select agents or access groups this key can access"
+ name="prompts"
+ className="mt-4"
+ help={
+ premiumUser
+ ? "Select existing prompts or enter new ones"
+ : "Premium feature - Upgrade to set prompts by key"
+ }
>
{(control) => (
- <AgentSelector
- onChange={control.onChange}
- value={control.value as AgentSelectorValue | undefined}
- accessToken={accessToken}
- placeholder="Select agents or access groups (optional)"
+ <Select
+ {...control}
+ value={control.value as string[] | undefined}
+ mode="tags"
+ style={{ width: "100%" }}
+ disabled={!premiumUser}
+ placeholder={
+ !premiumUser
+ ? "Premium feature - Upgrade to set prompts by key"
+ : "Select or enter prompts"
+ }
+ options={promptsList.map((name) => ({ value: name, label: name }))}
/>
)}
</MountedFormField>
- </CollapsibleContent>
- </Collapsible>
-
- {premiumUser ? (
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <b>Logging Settings</b>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <div className="mt-4">
- <PremiumLoggingSettings
- value={loggingSettings}
- onChange={setLoggingSettings}
- premiumUser={true}
- disabledCallbacks={disabledCallbacks}
- onDisabledCallbacksChange={setDisabledCallbacks}
- />
- </div>
- </CollapsibleContent>
- </Collapsible>
- ) : (
- <Tooltip
- title={
+ )}
+ <MountedFormField
+ label={
<span>
- Key-level logging settings is an enterprise feature, get in touch -
- <a href="https://www.litellm.ai/enterprise" target="_blank">
- https://www.litellm.ai/enterprise
- </a>
+ Access Groups{" "}
+ <Tooltip title="Assign access groups to this key. Access groups control which models, MCP servers, and agents this key can use">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
</span>
}
- placement="top"
+ name="access_group_ids"
+ className="mt-4"
+ help="Select access groups to assign to this key"
>
- <div style={{ position: "relative" }}>
- <div style={{ opacity: 0.5 }}>
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <b>Logging Settings</b>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <div className="mt-4">
- <PremiumLoggingSettings
- value={loggingSettings}
- onChange={setLoggingSettings}
- premiumUser={false}
- disabledCallbacks={disabledCallbacks}
- onDisabledCallbacksChange={setDisabledCallbacks}
- />
- </div>
- </CollapsibleContent>
- </Collapsible>
- </div>
- <div style={{ position: "absolute", inset: 0, cursor: "not-allowed" }} />
- </div>
- </Tooltip>
- )}
-
- <Collapsible
- key={`router-settings-accordion-${routerSettingsKey}`}
- className="mt-4 mb-4 overflow-hidden rounded-lg border"
- >
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <b>Router Settings</b>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <div className="mt-4 w-full">
- <RouterSettingsAccordion
- key={routerSettingsKey}
- accessToken={accessToken || ""}
- value={routerSettings || undefined}
- onChange={setRouterSettings}
- modelData={
- userModels.length > 0
- ? { data: userModels.map((model) => ({ model_name: model })) }
- : undefined
+ {(control) => (
+ <AccessGroupSelector
+ value={control.value as string[] | undefined}
+ onChange={control.onChange}
+ placeholder="Select access groups (optional)"
+ />
+ )}
+ </MountedFormField>
+ <MountedFormField
+ label={
+ <span>
+ Allowed Pass Through Routes{" "}
+ <Tooltip title="Allow this key to use specific pass through routes">
+ <a
+ href="https://docs.litellm.ai/docs/proxy/pass_through"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e) => e.stopPropagation()} // Prevent accordion from collapsing when clicking link
+ >
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </a>
+ </Tooltip>
+ </span>
+ }
+ name="allowed_passthrough_routes"
+ className="mt-4"
+ help={
+ premiumUser
+ ? "Select existing pass through routes or enter new ones"
+ : "Premium feature - Upgrade to set pass through routes by key"
+ }
+ >
+ {(control) => (
+ <PassThroughRoutesSelector
+ value={control.value as string[] | undefined}
+ onChange={control.onChange}
+ accessToken={accessToken}
+ placeholder={
+ !premiumUser
+ ? "Premium feature - Upgrade to set pass through routes by key"
+ : "Select or enter pass through routes"
}
+ disabled={!premiumUser}
+ teamId={selectedCreateKeyTeam ? selectedCreateKeyTeam.team_id : null}
/>
- </div>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <b>Model Aliases</b>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <div className="mt-4">
- <p className="text-sm text-muted-foreground mb-4">
- Create custom aliases for models that can be used in API calls. This allows you to create
- shortcuts for specific models.
- </p>
- <ModelAliasManager
+ )}
+ </MountedFormField>
+ <MountedFormField
+ label={
+ <span>
+ Allowed Vector Stores{" "}
+ <Tooltip title="Select which vector stores this key can access. If none selected, the key will have access to all available vector stores">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="allowed_vector_store_ids"
+ className="mt-4"
+ help="Select vector stores this key can access. Leave empty for access to all vector stores"
+ >
+ {(control) => (
+ <VectorStoreSelector
+ onChange={control.onChange}
+ value={control.value as string[] | undefined}
accessToken={accessToken}
- initialModelAliases={modelAliases}
- onAliasUpdate={setModelAliases}
- showExampleConfig={false}
+ placeholder="Select vector stores (optional)"
/>
- </div>
- </CollapsibleContent>
- </Collapsible>
-
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <b>Key Lifecycle</b>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <div className="mt-4">
- <MountedFormField name="duration" bare>
+ )}
+ </MountedFormField>
+ <MountedFormField
+ label={
+ <span>
+ Metadata{" "}
+ <Tooltip title="JSON object with additional information about this key. Used for tracking or custom logic">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="metadata"
+ className="mt-4"
+ >
+ {(control) => (
+ <AntdInput.TextArea
+ {...control}
+ value={control.value as string | undefined}
+ rows={4}
+ placeholder="Enter metadata as JSON"
+ />
+ )}
+ </MountedFormField>
+ <MountedFormField
+ label={
+ <span>
+ Tags{" "}
+ <Tooltip title="Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="tags"
+ className="mt-4"
+ help={`Tags for tracking spend and/or doing tag-based routing.`}
+ >
+ {(control) => (
+ <Select
+ {...control}
+ value={control.value as string[] | undefined}
+ mode="tags"
+ style={{ width: "100%" }}
+ placeholder="Select or enter tags"
+ tokenSeparators={[","]}
+ options={tagOptions}
+ />
+ )}
+ </MountedFormField>
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <b>MCP Settings</b>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <MountedFormField
+ label={
+ <span>
+ Allowed MCP Servers{" "}
+ <Tooltip title="Select which MCP servers or access groups this key can access">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
+ </span>
+ }
+ name="allowed_mcp_servers_and_groups"
+ help="Select MCP servers or access groups this key can access"
+ >
{(control) => (
- <KeyLifecycleSettings
- id={control.id}
- value={control.value as string | undefined}
+ <MCPServerSelector
onChange={control.onChange}
- autoRotationEnabled={autoRotationEnabled}
- onAutoRotationChange={setAutoRotationEnabled}
- rotationInterval={rotationInterval}
- onRotationIntervalChange={setRotationInterval}
- isCreateMode={true}
+ value={control.value as McpSelectorValue | undefined}
+ accessToken={accessToken}
+ teamId={selectedCreateKeyTeam?.team_id ?? null}
+ placeholder="Select MCP servers or access groups (optional)"
+ allowNoMcpServers
/>
)}
</MountedFormField>
- </div>
- </CollapsibleContent>
- </Collapsible>
- <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
- <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
- <div className="flex items-center gap-2">
- <b>Advanced Settings</b>
- <Tooltip
- title={
+
+ {/* Hidden field to register mcp_tool_permissions with the form */}
+ <MountedFormField name="mcp_tool_permissions" bare>
+ {(control) => <input type="hidden" id={control.id} name={control.name} />}
+ </MountedFormField>
+
+ <McpToolPermissionsField
+ accessToken={accessToken}
+ control={form.control}
+ setValue={form.setValue}
+ />
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <b>Agent Settings</b>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <MountedFormField
+ label={
<span>
- Learn more about advanced settings in our{" "}
- <a
- href={
- proxyBaseUrl
- ? `${proxyBaseUrl}/#/key%20management/generate_key_fn_key_generate_post`
- : `/#/key%20management/generate_key_fn_key_generate_post`
- }
- target="_blank"
- rel="noopener noreferrer"
- className="text-blue-400 hover:text-blue-300"
- >
- documentation
- </a>
+ Allowed Agents{" "}
+ <Tooltip title="Select which agents or access groups this key can access">
+ <InfoCircleOutlined style={{ marginLeft: "4px" }} />
+ </Tooltip>
</span>
}
+ name="allowed_agents_and_groups"
+ help="Select agents or access groups this key can access"
>
- <InfoCircleOutlined className="text-muted-foreground hover:text-foreground cursor-help" />
- </Tooltip>
- </div>
- <ChevronDown className={SECTION_CHEVRON_CLASS} />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-4 pb-3">
- <SchemaFormFields
- schemaComponent="GenerateKeyRequest"
- setValue={form.setValue}
- excludedFields={[
- "key_alias",
- "team_id",
- "organization_id",
- "models",
- "duration",
- "metadata",
- "tags",
- "guardrails",
- "max_budget",
- "budget_duration",
- "tpm_limit",
- "rpm_limit",
- ...(disableCustomApiKeys ? ["key"] : []),
- ]}
- />
- </CollapsibleContent>
- </Collapsible>
- </CollapsibleContent>
- </Collapsible>
- </div>
- )}
+ {(control) => (
+ <AgentSelector
+ onChange={control.onChange}
+ value={control.value as AgentSelectorValue | undefined}
+ accessToken={accessToken}
+ placeholder="Select agents or access groups (optional)"
+ />
+ )}
+ </MountedFormField>
+ </CollapsibleContent>
+ </Collapsible>
- <div style={{ textAlign: "right", marginTop: "10px" }}>
- <Button type="submit" disabled={isFormDisabled}>
- Create Key
- </Button>
- </div>
- </form>
- </MountedFormProvider>
- </Modal>
+ {premiumUser ? (
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <b>Logging Settings</b>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <div className="mt-4">
+ <PremiumLoggingSettings
+ value={loggingSettings}
+ onChange={setLoggingSettings}
+ premiumUser={true}
+ disabledCallbacks={disabledCallbacks}
+ onDisabledCallbacksChange={setDisabledCallbacks}
+ />
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+ ) : (
+ <Tooltip
+ title={
+ <span>
+ Key-level logging settings is an enterprise feature, get in touch -
+ <a href="https://www.litellm.ai/enterprise" target="_blank">
+ https://www.litellm.ai/enterprise
+ </a>
+ </span>
+ }
+ placement="top"
+ >
+ <div style={{ position: "relative" }}>
+ <div style={{ opacity: 0.5 }}>
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <b>Logging Settings</b>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <div className="mt-4">
+ <PremiumLoggingSettings
+ value={loggingSettings}
+ onChange={setLoggingSettings}
+ premiumUser={false}
+ disabledCallbacks={disabledCallbacks}
+ onDisabledCallbacksChange={setDisabledCallbacks}
+ />
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+ </div>
+ <div style={{ position: "absolute", inset: 0, cursor: "not-allowed" }} />
+ </div>
+ </Tooltip>
+ )}
+
+ <Collapsible
+ key={`router-settings-accordion-${routerSettingsKey}`}
+ className="mt-4 mb-4 overflow-hidden rounded-lg border"
+ >
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <b>Router Settings</b>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <div className="mt-4 w-full">
+ <RouterSettingsAccordion
+ key={routerSettingsKey}
+ accessToken={accessToken || ""}
+ value={routerSettings || undefined}
+ onChange={setRouterSettings}
+ modelData={
+ userModels.length > 0
+ ? { data: userModels.map((model) => ({ model_name: model })) }
+ : undefined
+ }
+ />
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <b>Model Aliases</b>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <div className="mt-4">
+ <p className="text-sm text-muted-foreground mb-4">
+ Create custom aliases for models that can be used in API calls. This allows you to create
+ shortcuts for specific models.
+ </p>
+ <ModelAliasManager
+ accessToken={accessToken}
+ initialModelAliases={modelAliases}
+ onAliasUpdate={setModelAliases}
+ showExampleConfig={false}
+ />
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <b>Key Lifecycle</b>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <div className="mt-4">
+ <MountedFormField name="duration" bare>
+ {(control) => (
+ <KeyLifecycleSettings
+ id={control.id}
+ value={control.value as string | undefined}
+ onChange={control.onChange}
+ autoRotationEnabled={autoRotationEnabled}
+ onAutoRotationChange={setAutoRotationEnabled}
+ rotationInterval={rotationInterval}
+ onRotationIntervalChange={setRotationInterval}
+ isCreateMode={true}
+ />
+ )}
+ </MountedFormField>
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+ <Collapsible className="mt-4 mb-4 overflow-hidden rounded-lg border">
+ <CollapsibleTrigger className={SECTION_HEADER_CLASS}>
+ <div className="flex items-center gap-2">
+ <b>Advanced Settings</b>
+ <Tooltip
+ title={
+ <span>
+ Learn more about advanced settings in our{" "}
+ <a
+ href={
+ proxyBaseUrl
+ ? `${proxyBaseUrl}/#/key%20management/generate_key_fn_key_generate_post`
+ : `/#/key%20management/generate_key_fn_key_generate_post`
+ }
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-blue-400 hover:text-blue-300"
+ >
+ documentation
+ </a>
+ </span>
+ }
+ >
+ <InfoCircleOutlined className="text-muted-foreground hover:text-foreground cursor-help" />
+ </Tooltip>
+ </div>
+ <ChevronDown className={SECTION_CHEVRON_CLASS} />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-4 pb-3">
+ <SchemaFormFields
+ schemaComponent="GenerateKeyRequest"
+ setValue={form.setValue}
+ excludedFields={[
+ "key_alias",
+ "team_id",
+ "organization_id",
+ "models",
+ "duration",
+ "metadata",
+ "tags",
+ "guardrails",
+ "max_budget",
+ "budget_duration",
+ "tpm_limit",
+ "rpm_limit",
+ ...(disableCustomApiKeys ? ["key"] : []),
+ ]}
+ />
+ </CollapsibleContent>
+ </Collapsible>
+ </CollapsibleContent>
+ </Collapsible>
+ </div>
+ )}
+
+ <div style={{ textAlign: "right", marginTop: "10px" }}>
+ <Button type="submit" disabled={isFormDisabled}>
+ Create Key
+ </Button>
+ </div>
+ </form>
+ </MountedFormProvider>
+ </DialogContent>
+ </Dialog>
{/* Add the Create User Modal */}
{isCreateUserModalVisible && (
- <Modal
- title="Create New User"
- open={isCreateUserModalVisible}
- onCancel={() => setIsCreateUserModalVisible(false)}
- footer={null}
- width={800}
- >
- <CreateUserButton
- userID={userID}
- accessToken={accessToken}
- possibleUIRoles={possibleUIRoles}
- onUserCreated={handleUserCreated}
- isEmbedded={true}
- />
- </Modal>
+ <Dialog open={isCreateUserModalVisible} onOpenChange={(open) => !open && setIsCreateUserModalVisible(false)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">
+ <DialogHeader>
+ <DialogTitle>Create New User</DialogTitle>
+ </DialogHeader>
+ <CreateUserButton
+ userID={userID}
+ accessToken={accessToken}
+ possibleUIRoles={possibleUIRoles}
+ onUserCreated={handleUserCreated}
+ isEmbedded={true}
+ />
+ </DialogContent>
+ </Dialog>
)}
{apiKey && (
- <Modal open={isModalVisible} onOk={handleOk} onCancel={handleCancel} footer={null}>
- <div className="grid grid-cols-1 gap-2 w-full">
- <h3 className="text-lg font-medium text-foreground">Save your Key</h3>
- {apiKey != null ? (
- <CreatedKeyDisplay apiKey={apiKey} />
- ) : (
- <p className="text-sm">Key being created, this might take 30s</p>
- )}
- </div>
- </Modal>
+ <Dialog open={isModalVisible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <div className="grid grid-cols-1 gap-2 w-full">
+ <DialogTitle className="text-lg font-medium text-foreground">Save your Key</DialogTitle>
+ {apiKey != null ? (
+ <CreatedKeyDisplay apiKey={apiKey} />
+ ) : (
+ <p className="text-sm">Key being created, this might take 30s</p>
+ )}
+ </div>
+ </DialogContent>
+ </Dialog>
)}
</div>
);
diff --git a/ui/litellm-dashboard/src/components/routing_groups/RoutingGroupModal.tsx b/ui/litellm-dashboard/src/components/routing_groups/RoutingGroupModal.tsx
index 48d707e833e..8b7361fb572 100644
--- a/ui/litellm-dashboard/src/components/routing_groups/RoutingGroupModal.tsx
+++ b/ui/litellm-dashboard/src/components/routing_groups/RoutingGroupModal.tsx
@@ -1,7 +1,6 @@
"use client";
import React, { useEffect, useMemo } from "react";
-import { Modal } from "antd";
import { useWatch } from "react-hook-form";
import { z } from "zod/v4";
import { FieldGroup } from "@/components/shared/form/field";
@@ -31,6 +30,8 @@ import {
toRoutingGroupFormValues,
} from "./routingGroupPayload";
import type { RoutingGroup } from "./types";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
interface RoutingGroupModalProps {
open: boolean;
@@ -102,120 +103,125 @@ const RoutingGroupModal: React.FC<RoutingGroupModalProps> = ({
};
return (
- <Modal
- title={mode === "create" ? "Create Routing Group" : `Edit ${initialValue?.group_name ?? ""}`}
- open={open}
- onCancel={onClose}
- onOk={() => void form.handleSubmit(handleSubmit)()}
- okText={mode === "create" ? "Create Group" : "Save Changes"}
- cancelText="Cancel"
- confirmLoading={saving}
- destroyOnClose
- width={560}
- >
- <form onSubmit={(event) => event.preventDefault()} noValidate>
- <FieldGroup>
- <FormField
- control={form.control}
- name="group_name"
- label="Group Name"
- description="Use this name as the model in API calls — LiteLLM routes the request to one of the group's models."
- >
- {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="fast-chat" disabled={mode === "edit"} />}
- </FormField>
-
- <FormField
- control={form.control}
- name="models"
- label="Models"
- description="Models from your model list that this group routes between."
- >
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Combobox multiple items={modelOptions} value={value} onValueChange={onChange}>
- <ComboboxChips render={<div ref={modelsAnchor} />}>
- <ComboboxValue>
- {(selected: string[]) => (
- <>
- {selected.map((model) => (
- <ComboboxChip key={model} aria-label={model}>
- {model}
- </ComboboxChip>
- ))}
- <ComboboxChipsInput
- id={id}
- aria-invalid={ariaInvalid}
- aria-describedby={ariaDescribedBy}
- placeholder="Select models"
- />
- </>
- )}
- </ComboboxValue>
- </ComboboxChips>
- <ComboboxContent anchor={modelsAnchor}>
- <ComboboxEmpty>No models found</ComboboxEmpty>
- <ComboboxList>
- {(model: string) => (
- <ComboboxItem key={model} value={model}>
- {model}
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
- )}
- </FormField>
-
- <FormField
- control={form.control}
- name="routing_strategy"
- label="Routing Strategy"
- description={strategyDescriptions[selectedStrategy]}
- >
- {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
- <Select
- items={strategyItems}
- value={value}
- onValueChange={(next: string | null) => {
- onChange(next ?? "");
- form.setValue(
- "routing_strategy_args",
- argsForStrategy(next ?? "", form.getValues("routing_strategy_args")),
- );
- }}
- >
- <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
- <SelectValue placeholder="Select strategy" />
- </SelectTrigger>
- <SelectContent>
- {availableStrategies.map((strategy) => (
- <SelectItem key={strategy} value={strategy}>
- {strategy}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- )}
- </FormField>
+ <Dialog open={open} onOpenChange={(open) => !open && onClose()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[560px]">
+ <DialogHeader>
+ <DialogTitle>
+ {mode === "create" ? "Create Routing Group" : `Edit ${initialValue?.group_name ?? ""}`}
+ </DialogTitle>
+ </DialogHeader>
+ <form onSubmit={(event) => event.preventDefault()} noValidate>
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="group_name"
+ label="Group Name"
+ description="Use this name as the model in API calls — LiteLLM routes the request to one of the group's models."
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="fast-chat" disabled={mode === "edit"} />}
+ </FormField>
- {STRATEGIES_WITH_ARGS.has(selectedStrategy) && (
<FormField
control={form.control}
- name="routing_strategy_args"
- label="Strategy Arguments (JSON)"
- description={ARGS_EXAMPLES[selectedStrategy] ?? 'Example: { "ttl": 60 }'}
+ name="models"
+ label="Models"
+ description="Models from your model list that this group routes between."
>
- {({ ref, ...field }) => (
- <Textarea {...field} ref={ref} rows={4} placeholder='{ "ttl": 3600 }' className="font-mono text-xs" />
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Combobox multiple items={modelOptions} value={value} onValueChange={onChange}>
+ <ComboboxChips render={<div ref={modelsAnchor} />}>
+ <ComboboxValue>
+ {(selected: string[]) => (
+ <>
+ {selected.map((model) => (
+ <ComboboxChip key={model} aria-label={model}>
+ {model}
+ </ComboboxChip>
+ ))}
+ <ComboboxChipsInput
+ id={id}
+ aria-invalid={ariaInvalid}
+ aria-describedby={ariaDescribedBy}
+ placeholder="Select models"
+ />
+ </>
+ )}
+ </ComboboxValue>
+ </ComboboxChips>
+ <ComboboxContent anchor={modelsAnchor}>
+ <ComboboxEmpty>No models found</ComboboxEmpty>
+ <ComboboxList>
+ {(model: string) => (
+ <ComboboxItem key={model} value={model}>
+ {model}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
)}
</FormField>
- )}
-
- <p className="text-xs text-muted-foreground">
- Models not claimed by an explicit group fall through to the proxy&apos;s top-level routing strategy.
- </p>
- </FieldGroup>
- </form>
- </Modal>
+
+ <FormField
+ control={form.control}
+ name="routing_strategy"
+ label="Routing Strategy"
+ description={strategyDescriptions[selectedStrategy]}
+ >
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Select
+ items={strategyItems}
+ value={value}
+ onValueChange={(next: string | null) => {
+ onChange(next ?? "");
+ form.setValue(
+ "routing_strategy_args",
+ argsForStrategy(next ?? "", form.getValues("routing_strategy_args")),
+ );
+ }}
+ >
+ <SelectTrigger id={id} aria-invalid={ariaInvalid} aria-describedby={ariaDescribedBy}>
+ <SelectValue placeholder="Select strategy" />
+ </SelectTrigger>
+ <SelectContent>
+ {availableStrategies.map((strategy) => (
+ <SelectItem key={strategy} value={strategy}>
+ {strategy}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+
+ {STRATEGIES_WITH_ARGS.has(selectedStrategy) && (
+ <FormField
+ control={form.control}
+ name="routing_strategy_args"
+ label="Strategy Arguments (JSON)"
+ description={ARGS_EXAMPLES[selectedStrategy] ?? 'Example: { "ttl": 60 }'}
+ >
+ {({ ref, ...field }) => (
+ <Textarea {...field} ref={ref} rows={4} placeholder='{ "ttl": 3600 }' className="font-mono text-xs" />
+ )}
+ </FormField>
+ )}
+
+ <p className="text-xs text-muted-foreground">
+ Models not claimed by an explicit group fall through to the proxy&apos;s top-level routing strategy.
+ </p>
+ </FieldGroup>
+ </form>
+ <DialogFooter>
+ <Button variant="outline" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button onClick={() => void form.handleSubmit(handleSubmit)()} disabled={saving} aria-busy={saving}>
+ {mode === "create" ? "Create Group" : "Save Changes"}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/routing_groups/index.integration.test.tsx b/ui/litellm-dashboard/src/components/routing_groups/index.integration.test.tsx
new file mode 100644
index 00000000000..ebe45d5c117
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/routing_groups/index.integration.test.tsx
@@ -0,0 +1,130 @@
+import { render, screen, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+import RoutingGroups from "./index";
+import type { RoutingGroup } from "./types";
+import { useRoutingGroups, useSaveRoutingGroups } from "@/app/(dashboard)/hooks/routingGroups/useRoutingGroups";
+import { toast } from "@/lib/toast";
+
+vi.mock("@/app/(dashboard)/hooks/routingGroups/useRoutingGroups", () => ({
+ useRoutingGroups: vi.fn(),
+ useSaveRoutingGroups: vi.fn(),
+}));
+
+vi.mock("@/app/(dashboard)/hooks/router/useRouterFields", () => ({
+ useRouterFields: () => ({ data: undefined }),
+}));
+
+vi.mock("@/app/(dashboard)/hooks/models/useModels", () => ({
+ useModelHub: () => ({ data: undefined }),
+}));
+
+vi.mock("@/app/(dashboard)/hooks/useAuthorized", () => ({
+ __esModule: true,
+ default: () => ({ accessToken: "test-token" }),
+}));
+
+vi.mock("@/app/(dashboard)/hooks/proxySettings/useProxySettings", () => ({
+ __esModule: true,
+ default: () => ({ PROXY_BASE_URL: "https://proxy.example.com" }),
+}));
+
+vi.mock("@/lib/toast", () => ({
+ toast: { success: vi.fn(), error: vi.fn(), fromError: vi.fn() },
+}));
+
+const prodGroup: RoutingGroup = {
+ group_name: "prod-group",
+ models: ["gpt-4o"],
+ routing_strategy: "usage-based-routing",
+};
+
+const devGroup: RoutingGroup = {
+ group_name: "dev-group",
+ models: ["gpt-4o-mini"],
+ routing_strategy: "simple-shuffle",
+};
+
+const setup = (overrides: { mutateAsync?: ReturnType<typeof vi.fn>; isPending?: boolean } = {}) => {
+ const mutateAsync = overrides.mutateAsync ?? vi.fn().mockResolvedValue(undefined);
+ vi.mocked(useRoutingGroups).mockReturnValue({
+ data: { routingGroups: [prodGroup, devGroup], availableStrategies: [] },
+ isLoading: false,
+ refetch: vi.fn(),
+ isFetching: false,
+ } as unknown as ReturnType<typeof useRoutingGroups>);
+ vi.mocked(useSaveRoutingGroups).mockReturnValue({
+ mutateAsync,
+ isPending: overrides.isPending ?? false,
+ } as unknown as ReturnType<typeof useSaveRoutingGroups>);
+ return { mutateAsync };
+};
+
+const openDeleteConfirm = async (user: ReturnType<typeof userEvent.setup>) => {
+ await user.click(screen.getByTestId("routing-group-actions-prod-group"));
+ await user.click(await screen.findByTestId("routing-group-action-delete"));
+ return screen.getByRole("dialog");
+};
+
+describe("RoutingGroups delete confirmation", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("should not show the confirmation until a group is chosen for deletion", () => {
+ setup();
+ render(<RoutingGroups />);
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ expect(screen.queryByText("Delete routing group?")).not.toBeInTheDocument();
+ });
+
+ it("should name the group being deleted in the confirmation", async () => {
+ const user = userEvent.setup();
+ setup();
+ render(<RoutingGroups />);
+
+ const dialog = await openDeleteConfirm(user);
+
+ expect(within(dialog).getByText("Delete routing group?")).toBeInTheDocument();
+ expect(within(dialog).getByText("prod-group")).toBeInTheDocument();
+ expect(within(dialog).getByText(/This cannot be undone/)).toBeInTheDocument();
+ });
+
+ it("should save the remaining groups and report success when confirmed", async () => {
+ const user = userEvent.setup();
+ const { mutateAsync } = setup();
+ render(<RoutingGroups />);
+
+ const dialog = await openDeleteConfirm(user);
+ await user.click(within(dialog).getByRole("button", { name: "Delete" }));
+
+ expect(mutateAsync).toHaveBeenCalledWith([devGroup]);
+ expect(toast.success).toHaveBeenCalledWith('Deleted routing group "prod-group"');
+ });
+
+ it("should report the failure and keep the confirmation open when the save rejects", async () => {
+ const user = userEvent.setup();
+ const mutateAsync = vi.fn().mockRejectedValue(new Error("boom"));
+ setup({ mutateAsync });
+ render(<RoutingGroups />);
+
+ const dialog = await openDeleteConfirm(user);
+ await user.click(within(dialog).getByRole("button", { name: "Delete" }));
+
+ expect(toast.error).toHaveBeenCalledWith("boom");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ });
+
+ it("should dismiss without saving when cancelled", async () => {
+ const user = userEvent.setup();
+ const { mutateAsync } = setup();
+ render(<RoutingGroups />);
+
+ const dialog = await openDeleteConfirm(user);
+ await user.click(within(dialog).getByRole("button", { name: "Cancel" }));
+
+ expect(mutateAsync).not.toHaveBeenCalled();
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/routing_groups/index.tsx b/ui/litellm-dashboard/src/components/routing_groups/index.tsx
index 1ecea5b10da..560523972ca 100644
--- a/ui/litellm-dashboard/src/components/routing_groups/index.tsx
+++ b/ui/litellm-dashboard/src/components/routing_groups/index.tsx
@@ -1,7 +1,7 @@
"use client";
import React, { useMemo, useState } from "react";
-import { Card, Flex, Input, Modal, Space, Typography } from "antd";
+import { Card, Flex, Input, Space, Typography } from "antd";
import { Button } from "@/components/ui/button";
import { PlusOutlined, ReloadOutlined, SearchOutlined } from "@ant-design/icons";
import { useRoutingGroups, useSaveRoutingGroups } from "@/app/(dashboard)/hooks/routingGroups/useRoutingGroups";
@@ -13,6 +13,7 @@ import RoutingGroupsTable from "./RoutingGroupsTable";
import RoutingGroupModal from "./RoutingGroupModal";
import { toast } from "@/lib/toast";
import type { RoutingGroup } from "./types";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
const { Text } = Typography;
@@ -154,20 +155,30 @@ const RoutingGroups: React.FC = () => {
saving={saveMutation.isPending}
/>
- <Modal
- open={Boolean(deletingGroup)}
- title="Delete routing group?"
- okText="Delete"
- okButtonProps={{ danger: true, loading: saveMutation.isPending }}
- cancelText="Cancel"
- onOk={confirmDelete}
- onCancel={() => setDeletingGroup(null)}
- >
- <Text>
- Models in <Text strong>{deletingGroup?.group_name}</Text> will fall back to the proxy&apos;s top-level routing
- strategy. This cannot be undone.
- </Text>
- </Modal>
+ <Dialog open={Boolean(deletingGroup)} onOpenChange={(open) => !open && setDeletingGroup(null)}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Delete routing group?</DialogTitle>
+ </DialogHeader>
+ <Text>
+ Models in <Text strong>{deletingGroup?.group_name}</Text> will fall back to the proxy&apos;s top-level
+ routing strategy. This cannot be undone.
+ </Text>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setDeletingGroup(null)}>
+ Cancel
+ </Button>
+ <Button
+ onClick={confirmDelete}
+ variant="destructive"
+ disabled={saveMutation.isPending}
+ aria-busy={saveMutation.isPending}
+ >
+ Delete
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
</Space>
);
};
diff --git a/ui/litellm-dashboard/src/components/team/EditMembership.tsx b/ui/litellm-dashboard/src/components/team/EditMembership.tsx
index e89a62778d8..96ebb5fe0fd 100644
--- a/ui/litellm-dashboard/src/components/team/EditMembership.tsx
+++ b/ui/litellm-dashboard/src/components/team/EditMembership.tsx
@@ -1,4 +1,3 @@
-import { Modal } from "antd";
import React, { useEffect, useMemo, useState } from "react";
import { z } from "zod/v4";
import NumericalInput from "../shared/numerical_input";
@@ -19,6 +18,7 @@ import {
type MemberFieldsConfig,
type MemberFormValues,
} from "./memberFormValues";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
interface BaseMember {
user_email?: string;
@@ -168,91 +168,98 @@ const MemberModal = <T extends BaseMember>({
);
return (
- <Modal
- title={config.title || (mode === "add" ? "Add Member" : "Edit Member")}
- open={visible}
- width={1000}
- footer={null}
- onCancel={onCancel}
- >
- <form onSubmit={form.handleSubmit(handleSubmit)}>
- <FieldGroup>
- {config.showEmail && (
- <FormField control={form.control} name="user_email" label="Email">
- {({ ref, value, onChange, ...rest }) => (
- <Input
- {...rest}
- ref={ref}
- placeholder="[email protected]"
- value={typeof value === "string" ? value : ""}
- onChange={(event) => onChange(event.target.value)}
- />
- )}
- </FormField>
- )}
-
- {config.showEmail && config.showUserId && <div className="text-center text-sm text-muted-foreground">OR</div>}
+ <Dialog open={visible} onOpenChange={(open) => !open && onCancel()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[1000px]">
+ <DialogHeader>
+ <DialogTitle>{config.title || (mode === "add" ? "Add Member" : "Edit Member")}</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={form.handleSubmit(handleSubmit)}>
+ <FieldGroup>
+ {config.showEmail && (
+ <FormField control={form.control} name="user_email" label="Email">
+ {({ ref, value, onChange, ...rest }) => (
+ <Input
+ {...rest}
+ ref={ref}
+ placeholder="[email protected]"
+ value={typeof value === "string" ? value : ""}
+ onChange={(event) => onChange(event.target.value)}
+ />
+ )}
+ </FormField>
+ )}
- {config.showUserId && (
- <FormField control={form.control} name="user_id" label="User ID">
- {({ ref, value, onChange, ...rest }) => (
- <Input
- {...rest}
- ref={ref}
- placeholder="user_123"
- value={typeof value === "string" ? value : ""}
- onChange={(event) => onChange(event.target.value)}
- />
- )}
- </FormField>
- )}
+ {config.showEmail && config.showUserId && (
+ <div className="text-center text-sm text-muted-foreground">OR</div>
+ )}
- <FormField
- control={form.control}
- name="role"
- label={
- <span className="flex items-center gap-2">
- <span>Role</span>
- {mode === "edit" && initialData && (
- <span className="text-sm text-muted-foreground">(Current: {getRoleLabel(initialData.role)})</span>
+ {config.showUserId && (
+ <FormField control={form.control} name="user_id" label="User ID">
+ {({ ref, value, onChange, ...rest }) => (
+ <Input
+ {...rest}
+ ref={ref}
+ placeholder="user_123"
+ value={typeof value === "string" ? value : ""}
+ onChange={(event) => onChange(event.target.value)}
+ />
)}
- </span>
- }
- >
- {({ id, value, onChange }) => (
- <Select
- items={Object.fromEntries(orderedRoleOptions.map((option) => [option.value, option.label]))}
- value={typeof value === "string" && value !== "" ? value : null}
- onValueChange={(selected: string | null) => onChange(selected ?? undefined)}
- >
- <SelectTrigger id={id} className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {orderedRoleOptions.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ </FormField>
)}
- </FormField>
- {config.additionalFields?.map((field) => renderField(field, field.name))}
- </FieldGroup>
+ <FormField
+ control={form.control}
+ name="role"
+ label={
+ <span className="flex items-center gap-2">
+ <span>Role</span>
+ {mode === "edit" && initialData && (
+ <span className="text-sm text-muted-foreground">(Current: {getRoleLabel(initialData.role)})</span>
+ )}
+ </span>
+ }
+ >
+ {({ id, value, onChange }) => (
+ <Select
+ items={Object.fromEntries(orderedRoleOptions.map((option) => [option.value, option.label]))}
+ value={typeof value === "string" && value !== "" ? value : null}
+ onValueChange={(selected: string | null) => onChange(selected ?? undefined)}
+ >
+ <SelectTrigger id={id} className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {orderedRoleOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ )}
+ </FormField>
+
+ {config.additionalFields?.map((field) => renderField(field, field.name))}
+ </FieldGroup>
- <div className="mt-6 text-right">
- <Button type="button" variant="outline" onClick={onCancel} disabled={isSubmitting} className="mr-2">
- Cancel
- </Button>
- <Button type="submit" variant="outline" disabled={isSubmitting}>
- {isSubmitting && <UiLoadingSpinner className="size-4" />}
- {mode === "add" ? (isSubmitting ? "Adding..." : "Add Member") : isSubmitting ? "Saving..." : "Save Changes"}
- </Button>
- </div>
- </form>
- </Modal>
+ <div className="mt-6 text-right">
+ <Button type="button" variant="outline" onClick={onCancel} disabled={isSubmitting} className="mr-2">
+ Cancel
+ </Button>
+ <Button type="submit" variant="outline" disabled={isSubmitting}>
+ {isSubmitting && <UiLoadingSpinner className="size-4" />}
+ {mode === "add"
+ ? isSubmitting
+ ? "Adding..."
+ : "Add Member"
+ : isSubmitting
+ ? "Saving..."
+ : "Save Changes"}
+ </Button>
+ </div>
+ </form>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/ui/litellm-dashboard/src/components/team/memberFormValues.test.ts b/ui/litellm-dashboard/src/components/team/memberFormValues.test.ts
index b03f0f6e09e..398719c6197 100644
--- a/ui/litellm-dashboard/src/components/team/memberFormValues.test.ts
+++ b/ui/litellm-dashboard/src/components/team/memberFormValues.test.ts
@@ -133,11 +133,31 @@ describe("buildMemberFormValues", () => {
});
describe("emptyMemberFormValues", () => {
- it("unsets every rendered field so a reset clears the form", () => {
+ it("clears every rendered field to the empty value its control understands", () => {
expect(emptyMemberFormValues(orgConfig)).toStrictEqual({
- user_email: undefined,
- user_id: undefined,
- role: undefined,
+ user_email: "",
+ user_id: "",
+ role: "",
+ });
+ });
+
+ it("clears numeric, duration and multi-select fields to values their controls accept", () => {
+ expect(
+ emptyMemberFormValues({
+ ...orgConfig,
+ additionalFields: [
+ { name: "max_budget_in_team", label: "Budget", type: "numerical" },
+ { name: "budget_duration", label: "Reset", type: "budget-duration" },
+ { name: "allowed_models", label: "Models", type: "multi-select" },
+ ],
+ }),
+ ).toStrictEqual({
+ user_email: "",
+ user_id: "",
+ role: "",
+ max_budget_in_team: null,
+ budget_duration: null,
+ allowed_models: [],
});
});
});
diff --git a/ui/litellm-dashboard/src/components/team/memberFormValues.ts b/ui/litellm-dashboard/src/components/team/memberFormValues.ts
index b39e2a07401..942b9b665fe 100644
--- a/ui/litellm-dashboard/src/components/team/memberFormValues.ts
+++ b/ui/litellm-dashboard/src/components/team/memberFormValues.ts
@@ -56,7 +56,22 @@ export const buildMemberFormValues = (
return pickFieldNames(config, { role: config.defaultRole || config.roleOptions[0]?.value });
};
-export const emptyMemberFormValues = (config: MemberFieldsConfig): MemberFormValues => pickFieldNames(config, {});
+const emptyValueForType = (type: MemberFieldType | undefined): MemberFieldValue => {
+ switch (type) {
+ case "multi-select":
+ return [];
+ case "numerical":
+ case "budget-duration":
+ return null;
+ default:
+ return "";
+ }
+};
+
+export const emptyMemberFormValues = (config: MemberFieldsConfig): MemberFormValues => {
+ const typeByName = new Map((config.additionalFields ?? []).map((field) => [field.name, field.type]));
+ return Object.fromEntries(memberFieldNames(config).map((name) => [name, emptyValueForType(typeByName.get(name))]));
+};
export const buildMemberFormData = (values: MemberFormValues): MemberFormValues =>
Object.fromEntries(
diff --git a/ui/litellm-dashboard/src/components/update_model_credentials_modal.tsx b/ui/litellm-dashboard/src/components/update_model_credentials_modal.tsx
index a436ba55c01..4db8c83ba9d 100644
--- a/ui/litellm-dashboard/src/components/update_model_credentials_modal.tsx
+++ b/ui/litellm-dashboard/src/components/update_model_credentials_modal.tsx
@@ -1,4 +1,4 @@
-import { Modal, Typography } from "antd";
+import { Typography } from "antd";
import { TriangleAlert } from "lucide-react";
import { useState } from "react";
import { z } from "zod/v4";
@@ -9,6 +9,7 @@ import { FormField } from "@/components/shared/form/FormField";
import { Alert, AlertTitle } from "@/components/shared/Alert";
import { PasswordInput } from "@/components/shared/PasswordInput";
import { Button } from "@/components/ui/button";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";
import { useZodForm } from "@/lib/forms/useZodForm";
@@ -71,37 +72,42 @@ export default function UpdateModelCredentialsModal({
};
return (
- <Modal title="Update API Key" open={open} onCancel={close} footer={null} width={520} destroyOnHidden={true}>
- <Text className="block mb-4 text-muted-foreground">
- Update this model&apos;s API key. Only the new key is sent; the rest of the deployment configuration is left
- untouched.
- </Text>
- <Alert variant="warning" className="mb-4">
- <TriangleAlert />
- <AlertTitle>
- Only the API key is rotated here. Models that authenticate with an Azure AD token, AWS credentials, or a
- Vertex service-account JSON aren&apos;t supported yet; update those from the model&apos;s LiteLLM Params for
- now.
- </AlertTitle>
- </Alert>
- <form onSubmit={form.handleSubmit(handleSubmit)}>
- <FieldGroup>
- <FormField control={form.control} name="api_key" label="New API Key">
- {({ ref, ...field }) => (
- <PasswordInput {...field} ref={ref} placeholder="Enter the new API key" autoComplete="new-password" />
- )}
- </FormField>
- </FieldGroup>
- <div className="flex justify-end items-center mt-4 gap-2.5">
- <Button type="button" variant="outline" onClick={close}>
- Cancel
- </Button>
- <Button type="submit" disabled={isSaving}>
- {isSaving && <UiLoadingSpinner className="size-4" />}
- Update API Key
- </Button>
- </div>
- </form>
- </Modal>
+ <Dialog open={open} onOpenChange={(nextOpen) => !nextOpen && close()}>
+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[520px]">
+ <DialogHeader>
+ <DialogTitle>Update API Key</DialogTitle>
+ </DialogHeader>
+ <Text className="block mb-4 text-muted-foreground">
+ Update this model&apos;s API key. Only the new key is sent; the rest of the deployment configuration is left
+ untouched.
+ </Text>
+ <Alert variant="warning" className="mb-4">
+ <TriangleAlert />
+ <AlertTitle>
+ Only the API key is rotated here. Models that authenticate with an Azure AD token, AWS credentials, or a
+ Vertex service-account JSON aren&apos;t supported yet; update those from the model&apos;s LiteLLM Params for
+ now.
+ </AlertTitle>
+ </Alert>
+ <form onSubmit={form.handleSubmit(handleSubmit)}>
+ <FieldGroup>
+ <FormField control={form.control} name="api_key" label="New API Key">
+ {({ ref, ...field }) => (
+ <PasswordInput {...field} ref={ref} placeholder="Enter the new API key" autoComplete="new-password" />
+ )}
+ </FormField>
+ </FieldGroup>
+ <div className="flex justify-end items-center mt-4 gap-2.5">
+ <Button type="button" variant="outline" onClick={close}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={isSaving}>
+ {isSaving && <UiLoadingSpinner className="size-4" />}
+ Update API Key
+ </Button>
+ </div>
+ </form>
+ </DialogContent>
+ </Dialog>
);
}
diff --git a/ui/litellm-dashboard/tests/setupTests.ts b/ui/litellm-dashboard/tests/setupTests.ts
index d007206e681..16a500a4518 100644
--- a/ui/litellm-dashboard/tests/setupTests.ts
+++ b/ui/litellm-dashboard/tests/setupTests.ts
@@ -113,7 +113,26 @@ vi.mock("@/app/(dashboard)/hooks/useAuthorized", () => ({
}),
}));
-afterEach(cleanup);
+// Unmounting a Base UI dialog that is still open leaves its scroll lock behind: the <html>
+// and <body> inline styles and the marker attribute survive cleanup() and make every later
+// test in the file see a locked page, where popups compute pointer-events: none and clicks
+// silently do nothing. Real users never unmount an open dialog, so undo it here.
+const releaseBaseUiScrollLock = () => {
+ const root = document.documentElement;
+ if (!root.hasAttribute("data-base-ui-scroll-locked")) return;
+ root.removeAttribute("data-base-ui-scroll-locked");
+ for (const property of ["scrollbar-gutter", "overflow-y", "overflow-x", "scroll-behavior"]) {
+ root.style.removeProperty(property);
+ }
+ for (const property of ["position", "height", "width", "box-sizing", "overflow", "scroll-behavior"]) {
+ document.body.style.removeProperty(property);
+ }
+};
+
+afterEach(() => {
+ cleanup();
+ releaseBaseUiScrollLock();
+});
// Make toLocaleString deterministic in tests; individual tests can override
// This returns ISO-like strings to keep assertions stable.