fix(ui): format guardrail files for frontend lint

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yucheng 2026-09-29 10:33:48 +00:00
parent 6cbb57a797
commit 6388bdf73e
4 changed files with 8 additions and 15 deletions

View file

@ -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;

View file

@ -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" }));

View file

@ -226,7 +226,8 @@ const GuardrailInfoView: React.FC<GuardrailInfoProps> = ({ 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),

View file

@ -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);
};