diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.test.ts index e1c04b24daa..0b5bfd189f5 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.test.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.test.ts @@ -16,11 +16,8 @@ describe("normalizeCustomEntityName", () => { describe("mergeCustomEntities", () => { it("keeps supported order, dedupes, and appends unknown selected entities", () => { - expect(mergeCustomEntities(["PERSON", "EMAIL"], ["EMAIL", "NO_FODSELSNUMMER", "PERSON", "SE_PERSONNUMMER"])).toEqual([ - "PERSON", - "EMAIL", - "NO_FODSELSNUMMER", - "SE_PERSONNUMMER", - ]); + expect( + mergeCustomEntities(["PERSON", "EMAIL"], ["EMAIL", "NO_FODSELSNUMMER", "PERSON", "SE_PERSONNUMMER"]), + ).toEqual(["PERSON", "EMAIL", "NO_FODSELSNUMMER", "SE_PERSONNUMMER"]); }); }); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.ts index 4f7869d4a49..aae2dc2033c 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/piiCustomEntity.ts @@ -1,5 +1,8 @@ export const normalizeCustomEntityName = (raw: string): string | null => { - const normalized = raw.trim().toUpperCase().replace(/[\s-]+/g, "_"); + const normalized = raw + .trim() + .toUpperCase() + .replace(/[\s-]+/g, "_"); return normalized !== "" && /^[A-Z0-9_]+$/.test(normalized) ? normalized : null; }; diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.tsx index 473cfc0fcb6..4efb795bb6a 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.tsx @@ -24,7 +24,9 @@ const PiiConfiguration: React.FC = ({ const allEntities = mergeCustomEntities(entities, selectedEntities); const customEntities = allEntities.filter((entity) => !entities.includes(entity)); const categories = - customEntities.length > 0 ? [...entityCategories, { category: "Custom", entities: customEntities }] : entityCategories; + customEntities.length > 0 + ? [...entityCategories, { category: "Custom", entities: customEntities }] + : entityCategories; // Create a lookup map to quickly find an entity's category const entityToCategoryMap = new Map();