mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
Remove limit from admin UI numerical input fix (#15991)
This commit is contained in:
parent
4ed9c7d7f2
commit
64167b7e34
2 changed files with 26 additions and 4 deletions
|
|
@ -332,3 +332,25 @@ describe("KeyInfoView handleKeyUpdate premium guard", () => {
|
|||
expect(sentPayload.key).toBe("tok_123");
|
||||
});
|
||||
});
|
||||
|
||||
describe("KeyInfoView handleKeyUpdate empty strings", () => {
|
||||
["tpm_limit", "rpm_limit", "max_parallel_requests", "max_budget"].forEach((limit) => {
|
||||
it(`maps empty strings to null for ${limit}`, async () => {
|
||||
renderView(true); // premiumUser = true
|
||||
|
||||
fireEvent.click(screen.getByText("Edit Settings"));
|
||||
(globalThis as any).__TEST_FORM_VALUES = {
|
||||
token: "tok_123",
|
||||
[limit]: "",
|
||||
};
|
||||
|
||||
fireEvent.click(screen.getByText("Mock Submit"));
|
||||
|
||||
await waitFor(() => expect(keyUpdateCallMock).toHaveBeenCalled());
|
||||
|
||||
const [sentAccessToken, sentPayload] = keyUpdateCallMock.mock.calls[0];
|
||||
expect(sentAccessToken).toBe("access_abc");
|
||||
expect(sentPayload[limit]).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -144,10 +144,10 @@ export default function KeyInfoView({
|
|||
delete formValues.mcp_tool_permissions;
|
||||
}
|
||||
|
||||
// Handle max_budget empty string
|
||||
if (formValues.max_budget === "") {
|
||||
formValues.max_budget = null;
|
||||
}
|
||||
formValues.max_budget = mapEmptyStringToNull(formValues.max_budget);
|
||||
formValues.tpm_limit = mapEmptyStringToNull(formValues.tpm_limit);
|
||||
formValues.rpm_limit = mapEmptyStringToNull(formValues.rpm_limit);
|
||||
formValues.max_parallel_requests = mapEmptyStringToNull(formValues.max_parallel_requests);
|
||||
|
||||
// Convert metadata back to an object if it exists and is a string
|
||||
if (formValues.metadata && typeof formValues.metadata === "string") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue