mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
style(ui): format custom Presidio PII picker files
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9f50d18ace
commit
f147449374
3 changed files with 10 additions and 8 deletions
|
|
@ -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"]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ const PiiConfiguration: React.FC<PiiConfigurationProps> = ({
|
|||
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<string, string>();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue