From 6388bdf73eb4ded04873211a21efe7cd31103db4 Mon Sep 17 00:00:00 2001 From: yucheng Date: Tue, 29 Sep 2026 10:33:48 +0000 Subject: [PATCH] fix(ui): format guardrail files for frontend lint Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../guardrails/_components/GuardrailModeDisplay.tsx | 6 +----- .../add_guardrail_form.characterization.test.tsx | 6 +----- .../(dashboard)/guardrails/_components/guardrail_info.tsx | 3 ++- .../guardrails/_components/guardrail_info_helpers.tsx | 8 ++++---- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailModeDisplay.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailModeDisplay.tsx index fe45e183e82..e5fa1669a44 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailModeDisplay.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailModeDisplay.tsx @@ -1,11 +1,7 @@ import React from "react"; import { Badge } from "@/components/ui/badge"; import { Card } from "@/components/ui/card"; -import { - formatGuardrailMode, - formatLoggingOnlyScope, - modeIncludesLoggingOnly, -} from "./guardrail_info_helpers"; +import { formatGuardrailMode, formatLoggingOnlyScope, modeIncludesLoggingOnly } from "./guardrail_info_helpers"; type GuardrailModeParams = { mode?: unknown; diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx index 2b6b67ab440..230be13ef33 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.characterization.test.tsx @@ -118,11 +118,7 @@ describe("AddGuardrailForm create payload characterization", () => { await pickProvider(user, "Bedrock Guardrail"); await user.click(screen.getByLabelText("Mode")); await user.click((await screen.findAllByText("logging_only")).at(-1) as HTMLElement); - await chooseSelectOption( - user, - await screen.findByLabelText("Logging only scope"), - "Output only (response)", - ); + await chooseSelectOption(user, await screen.findByLabelText("Logging only scope"), "Output only (response)"); await user.type(await screen.findByPlaceholderText("The guardrail id on Bedrock"), "gr-123"); await user.click(screen.getByRole("button", { name: "Next" })); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx index ca19abcc687..73d9fb8123e 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx @@ -226,7 +226,8 @@ const GuardrailInfoView: React.FC = ({ guardrailId, onClose, if (!guardrailData) return; form.setValue("guardrail_name", guardrailData.guardrail_name); form.setValue("default_on", guardrailData.litellm_params?.default_on); - form.setValue("logging_only_scope_choice", loggingOnlyScopeToChoice(guardrailData.litellm_params?.logging_only_scope)); + const storedLoggingOnlyScope = guardrailData.litellm_params?.logging_only_scope; + form.setValue("logging_only_scope_choice", loggingOnlyScopeToChoice(storedLoggingOnlyScope)); form.setValue( "skip_system_message_choice", skipSystemMessageToChoice(guardrailData.litellm_params?.skip_system_message_in_guardrail), diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx index 8bf9a26a16b..da28e0962a8 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx @@ -168,10 +168,10 @@ export const supportsDirectionalLoggingOnlyScope = ( selectedProvider: string | null, ): boolean => { const providerKey = selectedProvider - ? (guardrail_provider_map[selectedProvider] ?? - Object.values(guardrail_provider_map).find( - (value) => value.toLowerCase() === selectedProvider.toLowerCase(), - ))?.toLowerCase() + ? ( + guardrail_provider_map[selectedProvider] ?? + Object.values(guardrail_provider_map).find((value) => value.toLowerCase() === selectedProvider.toLowerCase()) + )?.toLowerCase() : null; return !providerKey || !settings?.providers_without_directional_logging_only_scope?.includes(providerKey); };