diff --git a/ui/litellm-dashboard/src/components/team/team_info.tsx b/ui/litellm-dashboard/src/components/team/team_info.tsx index d18842102c5..2aec5a3b767 100644 --- a/ui/litellm-dashboard/src/components/team/team_info.tsx +++ b/ui/litellm-dashboard/src/components/team/team_info.tsx @@ -43,6 +43,7 @@ import { CheckIcon, CopyIcon } from "lucide-react"; import { copyToClipboard as utilCopyToClipboard } from "../../utils/dataUtils"; import NotificationsManager from "../molecules/notifications_manager"; import PassThroughRoutesSelector from "../common_components/PassThroughRoutesSelector"; +import { mapEmptyStringToNull } from "@/utils/keyUpdateUtils"; export interface TeamMembership { user_id: string; @@ -324,6 +325,8 @@ const TeamInfoView: React.FC = ({ organization_id: values.organization_id, }; + updateData.max_budget = mapEmptyStringToNull(updateData.max_budget); + if (values.team_member_budget !== undefined) { updateData.team_member_budget = Number(values.team_member_budget); } diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx index be7acf3c2fb..658c1829039 100644 --- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx +++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx @@ -16,6 +16,7 @@ import { CopyIcon, CheckIcon } from "lucide-react"; import { mapInternalToDisplayNames, mapDisplayToInternalNames } from "../callback_info_helpers"; import { parseErrorMessage } from "../shared/errorUtils"; import AutoRotationView from "../common_components/AutoRotationView"; +import { mapEmptyStringToNull } from "@/utils/keyUpdateUtils"; interface KeyInfoViewProps { keyId: string; @@ -107,6 +108,9 @@ export default function KeyInfoView({ delete formValues.prompts; } + // Handle max budget empty string + formValues.max_budget = mapEmptyStringToNull(formValues.max_budget); + // Handle object_permission updates if (formValues.vector_stores !== undefined) { formValues.object_permission = { @@ -630,7 +634,8 @@ export default function KeyInfoView({
Allowed Pass Through Routes - {Array.isArray(currentKeyData.metadata?.allowed_passthrough_routes) && currentKeyData.metadata.allowed_passthrough_routes.length > 0 + {Array.isArray(currentKeyData.metadata?.allowed_passthrough_routes) && + currentKeyData.metadata.allowed_passthrough_routes.length > 0 ? currentKeyData.metadata.allowed_passthrough_routes.map((route, index) => ( {route} diff --git a/ui/litellm-dashboard/src/utils/keyUpdateUtils.test.ts b/ui/litellm-dashboard/src/utils/keyUpdateUtils.test.ts new file mode 100644 index 00000000000..d1ccd33309d --- /dev/null +++ b/ui/litellm-dashboard/src/utils/keyUpdateUtils.test.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from "vitest"; +import { mapEmptyStringToNull } from "./keyUpdateUtils"; + +describe("keyUpdateUtils", () => { + it("should map empty string to null", () => { + expect(mapEmptyStringToNull("")).toBeNull(); + }); + + it("should return the original string otherwise", () => { + expect(mapEmptyStringToNull("500")).toBe("500"); + }); +}); diff --git a/ui/litellm-dashboard/src/utils/keyUpdateUtils.ts b/ui/litellm-dashboard/src/utils/keyUpdateUtils.ts new file mode 100644 index 00000000000..066735fb1a5 --- /dev/null +++ b/ui/litellm-dashboard/src/utils/keyUpdateUtils.ts @@ -0,0 +1,7 @@ +export function mapEmptyStringToNull(input: string): string | null { + if (input === "") { + return null; + } + + return input; +}