From c2db7fb28b9cccf72baa58b3ffd1355f36e4a919 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 17 Mar 2025 17:31:31 -0700 Subject: [PATCH] fix internal user sso settings --- .../src/components/SSOSettings.tsx | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/ui/litellm-dashboard/src/components/SSOSettings.tsx b/ui/litellm-dashboard/src/components/SSOSettings.tsx index 7b8470538a..c39cd46142 100644 --- a/ui/litellm-dashboard/src/components/SSOSettings.tsx +++ b/ui/litellm-dashboard/src/components/SSOSettings.tsx @@ -1,8 +1,9 @@ import React, { useState, useEffect } from "react"; import { Card, Title, Text, Divider, Button, TextInput } from "@tremor/react"; import { Typography, Spin, message, Switch, Select, Form } from "antd"; -import { getInternalUserSettings, updateInternalUserSettings } from "./networking"; +import { getInternalUserSettings, updateInternalUserSettings, modelAvailableCall } from "./networking"; import BudgetDurationDropdown, { getBudgetDurationLabel } from "./common_components/budget_duration_dropdown"; +import { getModelDisplayName } from "./key_team_helpers/fetch_available_models_team_key"; interface SSOSettingsProps { accessToken: string | null; @@ -15,6 +16,7 @@ const SSOSettings: React.FC = ({ accessToken, possibleUIRoles const [isEditing, setIsEditing] = useState(false); const [editedValues, setEditedValues] = useState({}); const [saving, setSaving] = useState(false); + const [availableModels, setAvailableModels] = useState([]); const { Paragraph } = Typography; const { Option } = Select; @@ -29,6 +31,19 @@ const SSOSettings: React.FC = ({ accessToken, possibleUIRoles const data = await getInternalUserSettings(accessToken); setSettings(data); setEditedValues(data.values || {}); + + // Fetch available models + if (accessToken) { + try { + const modelResponse = await modelAvailableCall(accessToken); + if (modelResponse && modelResponse.data) { + const modelNames = modelResponse.data.map((model: { id: string }) => model.id); + setAvailableModels(modelNames); + } + } catch (error) { + console.error("Error fetching available models:", error); + } + } } catch (error) { console.error("Error fetching SSO settings:", error); message.error("Failed to fetch SSO settings"); @@ -117,6 +132,22 @@ const SSOSettings: React.FC = ({ accessToken, possibleUIRoles ))} ); + } else if (key === "models") { + return ( + + ); } else if (type === "string" && property.enum) { return (