diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx index 8eefa6dcf81..5c34eca9804 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.integration.test.tsx @@ -145,6 +145,19 @@ describe("TeamGuardrailsTab submit payload", () => { expect(registeredPayload().litellm_params.mode).toBe("during_call"); }); + it("shows the mode by its human label on the trigger", async () => { + const user = userEvent.setup(); + await openSubmitModal(user); + + const mode = screen.getAllByRole("combobox")[1]; + expect(mode).toHaveTextContent("Pre Call"); + + await user.click(mode); + await user.click(await screen.findByRole("option", { name: "During Call" })); + + expect(screen.getAllByRole("combobox")[1]).toHaveTextContent("During Call"); + }); + it("blocks an empty submit and reports every required field", async () => { const user = userEvent.setup(); await openSubmitModal(user); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx index 3909857cc8d..fc77562e932 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx @@ -1090,7 +1090,7 @@ export function TeamGuardrailsTab({ accessToken }: TeamGuardrailsTabProps) { {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => ( - onChange.mock.calls[onChange.mo const chooseOption = async (user: ReturnType, index: number, optionText: string) => { await user.click(screen.getAllByRole("combobox")[index]); - const options = await screen.findAllByText(optionText); - await user.click(options[options.length - 1]); + await user.click(await screen.findByRole("option", { name: optionText })); }; describe("CompetitorIntentConfiguration reported config", () => { @@ -175,4 +174,24 @@ describe("CompetitorIntentConfiguration reported config", () => { expect(screen.queryAllByRole("combobox")).toHaveLength(0); expect(screen.queryAllByRole("spinbutton")).toHaveLength(0); }); + + it.each([ + ["Type", "Airline (auto-load competitors from IATA)"], + ["Policy: Competitor comparison", "Refuse (block request)"], + ["Policy: Possible competitor comparison", "Reframe (suggest alternative to backend LLM)"], + ])("shows the human label on the %s trigger", (name, label) => { + render(); + + expect(screen.getByRole("combobox", { name })).toHaveTextContent(label); + }); + + it("shows the human label on the Type trigger after switching to generic", async () => { + const user = userEvent.setup(); + render(); + + await user.click(screen.getByRole("combobox", { name: "Type" })); + await user.click(await screen.findByRole("option", { name: "Generic (specify competitors manually)" })); + + expect(screen.getByRole("combobox", { name: "Type" })).toHaveTextContent("Generic (specify competitors manually)"); + }); }); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx index 48ef20cd35b..d77dd216c2a 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx @@ -187,6 +187,7 @@ const CompetitorIntentConfiguration: React.FC Type v !== null && handlePolicyChange("competitor_comparison", v)} > @@ -281,6 +283,7 @@ const CompetitorIntentConfiguration: React.FC setSelectedModelGroup(value)} > @@ -89,10 +94,9 @@ const ModelRetrySettingsTab = ({ - Global Default - {availableModelGroups.map((group) => ( - - {group} + {scopeItems.map((item) => ( + + {item.label} ))} diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx index 9d9c5dc86ab..5d61714ee97 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx @@ -96,6 +96,55 @@ describe("ChatUI", () => { }); }); + it("should show the SDK type by its human label rather than its wire value", async () => { + const user = userEvent.setup(); + render( + , + ); + + await waitFor(() => { + expect(screen.getByText("Test Key")).toBeInTheDocument(); + }); + + await user.click(screen.getByRole("button", { name: /get code/i })); + + const sdkTrigger = await screen.findByLabelText("SDK Type"); + expect(sdkTrigger).toHaveTextContent("OpenAI SDK"); + + await user.click(sdkTrigger); + await user.click(await screen.findByRole("option", { name: "Azure SDK" })); + + expect(await screen.findByLabelText("SDK Type")).toHaveTextContent("Azure SDK"); + }); + + it("should show the voice by its human label rather than its wire value", async () => { + render( + , + ); + + await waitFor(() => { + expect(screen.getByText("Test Key")).toBeInTheDocument(); + }); + + await selectComboboxOption("Select an endpoint", "/v1/audio/speech"); + + await waitFor(() => { + expect(screen.getByLabelText("Voice")).toHaveTextContent("Alloy - Professional and confident"); + }); + }); + it("should allow the user to select a model", async () => { render( = ({