mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
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:
parent
6cbb57a797
commit
6388bdf73e
4 changed files with 8 additions and 15 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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" }));
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue