Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

address greptile review feedback (greploop iteration 3)

yuneng-jiang7714d1be0b23
diff --git a/ui/litellm-dashboard/src/components/view_logs/GuardrailViewer/GuardrailViewer.tsx b/ui/litellm-dashboard/src/components/view_logs/GuardrailViewer/GuardrailViewer.tsx
index 28247d4b2a0..5608e3677fa 100644
--- a/ui/litellm-dashboard/src/components/view_logs/GuardrailViewer/GuardrailViewer.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/GuardrailViewer/GuardrailViewer.tsx
@@ -84,11 +84,17 @@ const PROVIDERS_WITH_CUSTOM_RENDERERS = new Set([
const resolveMode = (mode: GuardrailInformation["guardrail_mode"]): string | null => {
if (mode == null) return null;
if (typeof mode === "string") return mode;
- if (Array.isArray(mode)) return mode[0] ?? null;
+ if (Array.isArray(mode)) {
+ const first = mode[0];
+ return typeof first === "string" ? first : null;
+ }
if (typeof mode === "object" && "default" in mode) {
const def = mode.default;
if (typeof def === "string") return def;
- if (Array.isArray(def)) return def[0] ?? null;
+ if (Array.isArray(def)) {
+ const first = def[0];
+ return typeof first === "string" ? first : null;
+ }
}
return null;
};