diff --git a/ui/litellm-dashboard/src/app/page.tsx b/ui/litellm-dashboard/src/app/page.tsx index 363a18d42..7bd065623 100644 --- a/ui/litellm-dashboard/src/app/page.tsx +++ b/ui/litellm-dashboard/src/app/page.tsx @@ -8,6 +8,7 @@ import ViewUserDashboard from "@/components/view_users"; import Teams from "@/components/teams"; import AdminPanel from "@/components/admins"; import Settings from "@/components/settings"; +import GeneralSettings from "@/components/general_settings"; import ChatUI from "@/components/chat_ui"; import Sidebar from "../components/leftnav"; import Usage from "../components/usage"; @@ -169,6 +170,12 @@ const CreateKeyPage = () => { userRole={userRole} accessToken={accessToken} /> + ) : page == "general-settings" ? ( + ) : ( = ({ + accessToken, + userRole, + userID, +}) => { + const [routerSettings, setRouterSettings] = useState<{ [key: string]: any }>({}); + const [isModalVisible, setIsModalVisible] = useState(false); + const [form] = Form.useForm(); + const [selectedCallback, setSelectedCallback] = useState(null); + + useEffect(() => { + if (!accessToken || !userRole || !userID) { + return; + } + getCallbacksCall(accessToken, userID, userRole).then((data) => { + console.log("callbacks", data); + let router_settings = data.router_settings; + setRouterSettings(router_settings); + }); + }, [accessToken, userRole, userID]); + + const handleAddCallback = () => { + console.log("Add callback clicked"); + setIsModalVisible(true); + }; + + const handleCancel = () => { + setIsModalVisible(false); + form.resetFields(); + setSelectedCallback(null); + }; + + const handleSaveChanges = (callback: any) => { + if (!accessToken) { + return; + } + + const updatedVariables = Object.fromEntries( + Object.entries(callback.variables).map(([key, value]) => [key, (document.querySelector(`input[name="${key}"]`) as HTMLInputElement)?.value || value]) + ); + + const payload = { + environment_variables: updatedVariables, + }; + + try { + setCallbacksCall(accessToken, payload); + } catch (error) { + message.error("Failed to update callback: " + error, 20); + } + + message.success("Callback updated successfully"); + }; + + + + if (!accessToken) { + return null; + } + + return ( +
+ + Router Settings + + + + + Setting + Value + + + + {Object.entries(routerSettings).map(([param, value]) => ( + + + {param} + + + + + +))} + +
+ + +
+ +
+ +
+ ); +}; + +export default GeneralSettings; \ No newline at end of file diff --git a/ui/litellm-dashboard/src/components/leftnav.tsx b/ui/litellm-dashboard/src/components/leftnav.tsx index 99da05002..04a99c41f 100644 --- a/ui/litellm-dashboard/src/components/leftnav.tsx +++ b/ui/litellm-dashboard/src/components/leftnav.tsx @@ -92,6 +92,11 @@ const Sidebar: React.FC = ({ Integrations + setPage("general-settings")}> + + Settings + + {userRole == "Admin" ? ( setPage("admin-panel")}>