mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
fix: preserve custom route display state
This commit is contained in:
parent
fe74cefba4
commit
485ceda428
2 changed files with 9 additions and 4 deletions
|
|
@ -22,9 +22,8 @@ export const exactKeyTypePresetFromRoutes = (allowedRoutes: string[] | null | un
|
|||
return KEY_TYPE_BY_PRESET_ROUTE[allowedRoutes[0]];
|
||||
};
|
||||
|
||||
// Determine the key_type display value from allowed_routes
|
||||
export const keyTypeFromRoutes = (allowedRoutes: string[] | null | undefined): string =>
|
||||
exactKeyTypePresetFromRoutes(allowedRoutes) ?? "default";
|
||||
export const keyTypeFromRoutes = (allowedRoutes: string[] | null | undefined): string | undefined =>
|
||||
exactKeyTypePresetFromRoutes(allowedRoutes);
|
||||
|
||||
export const parseAllowedRoutes = (value: unknown): string[] =>
|
||||
typeof value === "string" && value.trim() !== ""
|
||||
|
|
@ -51,4 +50,3 @@ export const currentValuePlaceholder = (
|
|||
if (!premiumUser) return premiumHint;
|
||||
return Array.isArray(current) && current.length > 0 ? `Current: ${current.join(", ")}` : emptyHint;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
modelAvailableCall,
|
||||
vectorStoreListCall,
|
||||
} from "../networking";
|
||||
import { keyTypeFromRoutes } from "./keyEditFieldNormalizers";
|
||||
import { KeyEditView } from "./key_edit_view";
|
||||
|
||||
const can = vi.fn();
|
||||
|
|
@ -135,6 +136,12 @@ vi.mock("../agent_management/AgentSelector", () => ({
|
|||
),
|
||||
}));
|
||||
|
||||
describe("keyTypeFromRoutes", () => {
|
||||
it("does not label a mixed allowlist as Full Access", () => {
|
||||
expect(keyTypeFromRoutes(["llm_api_routes", "/custom"])).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
vi.mock("../common_components/AccessGroupSelector", () => ({
|
||||
default: ({ value = [], onChange }: { value?: string[]; onChange?: (v: string[]) => void }) => (
|
||||
<input
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue