diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx index 15ae9da377..7d3c87927a 100644 --- a/ui/litellm-dashboard/src/components/teams.tsx +++ b/ui/litellm-dashboard/src/components/teams.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useMemo } from "react"; import Link from "next/link"; import { Typography } from "antd"; import { teamDeleteCall, teamUpdateCall, teamInfoCall, Organization, DEFAULT_ORGANIZATION } from "./networking"; @@ -118,7 +118,6 @@ const Teams: React.FC = ({ }) => { const [lastRefreshed, setLastRefreshed] = useState(""); const [currentOrg, setCurrentOrg] = useState(null); - const [currentOrgForCreateTeam, setCurrentOrgForCreateTeam] = useState(null); useEffect(() => { console.log(`inside useeffect - ${lastRefreshed}`) @@ -149,7 +148,11 @@ const Teams: React.FC = ({ const [teamToDelete, setTeamToDelete] = useState(null); const [modelsToPick, setModelsToPick] = useState([]); + const selectedOrganizationId = Form.useWatch('organization_id', form) + const currentOrgForCreateTeam = useMemo(() => { + return organizations?.find((org) => org.organization_id === selectedOrganizationId) || null + }, [selectedOrganizationId]) const [perTeamInfo, setPerTeamInfo] = useState>({}); @@ -665,7 +668,12 @@ const Teams: React.FC = ({ placeholder="Search or select an Organization" onChange={(value) => { form.setFieldValue('organization_id', value); - setCurrentOrgForCreateTeam(organizations?.find((org) => org.organization_id === value) || null); + if (value) { + const selectedModels = form.getFieldValue('models') as (string[] | undefined) + if (selectedModels) { + form.setFieldValue('models', selectedModels.filter(m => m !== 'all-proxy-models')) + } + } }} filterOption={(input, option) => { if (!option) return false; @@ -695,12 +703,14 @@ const Teams: React.FC = ({ placeholder="Select models" style={{ width: "100%" }} > - - All Proxy Models - + {selectedOrganizationId ? null : ( + + All Proxy Models + + )} {modelsToPick.map((model) => ( {getModelDisplayName(model)}