mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
fix(ui): let team admins pick All Proxy Models for teams outside an organization
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
cbeaf86c8d
commit
e27b700345
4 changed files with 33 additions and 5 deletions
|
|
@ -423,6 +423,36 @@ describe("ModelSelect", () => {
|
|||
},
|
||||
shouldShow: false,
|
||||
},
|
||||
{
|
||||
name: "when a team has no organization and the caller is not a proxy admin",
|
||||
context: "team" as const,
|
||||
options: { includeSpecialOptions: true },
|
||||
props: { teamID: "team-1" },
|
||||
setup: () => {
|
||||
mockUseTeam.mockReturnValue({
|
||||
data: { team_id: "team-1", team_alias: "Test Team", models: ["gpt-4"] },
|
||||
isLoading: false,
|
||||
} as any);
|
||||
},
|
||||
shouldShow: true,
|
||||
},
|
||||
{
|
||||
name: "when a team belongs to an organization scoped to specific models",
|
||||
context: "team" as const,
|
||||
options: { includeSpecialOptions: true },
|
||||
props: { teamID: "team-1", organizationID: "org-1" },
|
||||
setup: () => {
|
||||
mockUseTeam.mockReturnValue({
|
||||
data: { team_id: "team-1", team_alias: "Test Team", models: ["gpt-4"] },
|
||||
isLoading: false,
|
||||
} as any);
|
||||
mockUseOrganization.mockReturnValue({
|
||||
data: createMockOrganization(["gpt-4"]),
|
||||
isLoading: false,
|
||||
} as any);
|
||||
},
|
||||
shouldShow: false,
|
||||
},
|
||||
];
|
||||
|
||||
for (const testCase of testCases) {
|
||||
|
|
|
|||
|
|
@ -106,8 +106,10 @@ export const ModelSelect = (props: ModelSelectProps) => {
|
|||
const organizationHasAllProxyModels =
|
||||
organization?.models.includes(MODEL_SELECT_ALL_PROXY_MODELS_SPECIAL_VALUE.value) ||
|
||||
organization?.models.length === 0;
|
||||
const teamIsUnscopedByOrganization = context === "team" && !organizationID;
|
||||
const scopeAllowsAllProxyModels = organizationHasAllProxyModels || teamIsUnscopedByOrganization;
|
||||
const shouldShowAllProxyModels =
|
||||
showAllProxyModelsOverride || (organizationHasAllProxyModels && includeSpecialOptions) || context === "global";
|
||||
showAllProxyModelsOverride || (scopeAllowsAllProxyModels && includeSpecialOptions) || context === "global";
|
||||
|
||||
if (isLoading) {
|
||||
return <Skeleton.Input active block />;
|
||||
|
|
|
|||
|
|
@ -715,7 +715,6 @@ const Teams: React.FC<TeamProps> = ({ accessToken, userID, userRole, premiumUser
|
|||
organizationID={form.getFieldValue("organization_id")}
|
||||
options={{
|
||||
includeSpecialOptions: true,
|
||||
showAllProxyModelsOverride: !form.getFieldValue("organization_id"),
|
||||
}}
|
||||
context="team"
|
||||
dataTestId="create-team-models-select"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import { useGuardrails, GuardrailListItem } from "@/app/(dashboard)/hooks/guardr
|
|||
import { formatNumberWithCommas } from "@/utils/dataUtils";
|
||||
import { mapEmptyStringToNull } from "@/utils/keyUpdateUtils";
|
||||
import type { ObjectPermission } from "@/components/object_permission_types";
|
||||
import { isProxyAdminRole } from "@/utils/roles";
|
||||
import {
|
||||
EditOutlined,
|
||||
GlobalOutlined,
|
||||
|
|
@ -1035,8 +1034,6 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
|||
options={{
|
||||
includeSpecialOptions: true,
|
||||
includeUserModels: !teamData?.team_info?.organization_id,
|
||||
showAllProxyModelsOverride:
|
||||
isProxyAdminRole(userRole) && !teamData?.team_info?.organization_id,
|
||||
}}
|
||||
context="team"
|
||||
dataTestId="models-select"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue