litellm/ui/litellm-dashboard/src/data/compliancePrompts.test.ts
yuneng-jiang 969161501a
feat(ui): add LITELLM_UI_USE_SI_TERMINOLOGY to show SI instead of AI in the Admin UI (#47440)
* feat(ui): add LITELLM_UI_USE_SI_TERMINOLOGY to show SI instead of AI in the Admin UI

Setting LITELLM_UI_USE_SI_TERMINOLOGY=true on the proxy makes the Admin UI
say "SI" where its own copy says "AI" and "Super Intelligence" where it says
"Artificial Intelligence". This covers the nav, page headings, settings text,
guardrail garden blurbs, the compliance playground prompts and the playground
sample prompts. Third-party product, provider and law names keep their
spelling (Vertex AI, Cisco AI Defense, EU AI Act, ...), and user data such as
guardrail names, gateway URLs and keys is never rewritten.

The proxy exposes the flag on /.well-known/litellm-ui-config, a
TerminologyProvider at the app root reads it, and components call
useTerminology() on their own strings. The context defaults to a pass-through,
so nothing changes when the flag is unset.

* fix(ui): apply SI terminology to the command palette, page visibility groups and guardrail garden search

* test(ui): cover the flag-off wording on the palette, page visibility and garden search tests

* fix(ui): apply SI terminology to the Aria usage assistant copy

* test(ui): keep the Aria ui-config stub within the inline object lint budget

* fix(ui): keep AI wording in prompts sent to models
2026-10-27 22:54:39 +00:00

33 lines
1.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { toSiTerminology } from "@/lib/terminology";
import { getFrameworks } from "./compliancePrompts";
describe("getFrameworks with a terminology", () => {
const original = getFrameworks();
const si = getFrameworks(toSiTerminology);
const categoriesOf = (frameworks: typeof original) => frameworks.flatMap((framework) => framework.categories);
const promptsOf = (frameworks: typeof original) => categoriesOf(frameworks).flatMap((category) => category.prompts);
it("keeps the prompts the playground sends to the model in their original wording", () => {
expect(promptsOf(si).length).toBeGreaterThan(0);
expect(promptsOf(original).some((prompt) => toSiTerminology(prompt.prompt) !== prompt.prompt)).toBe(true);
expect(promptsOf(si).map((prompt) => prompt.prompt)).toEqual(promptsOf(original).map((prompt) => prompt.prompt));
});
it("rewrites framework and category descriptions", () => {
expect(si.map((framework) => framework.description)).toEqual(
original.map((framework) => toSiTerminology(framework.description)),
);
expect(categoriesOf(si).map((category) => category.description)).toEqual(
categoriesOf(original).map((category) => toSiTerminology(category.description)),
);
});
it("keeps framework names, category names and prompt ids stable for selection and CSV export", () => {
expect(si.map((framework) => framework.name)).toEqual(original.map((framework) => framework.name));
expect(categoriesOf(si).map((category) => category.name)).toEqual(
categoriesOf(original).map((category) => category.name),
);
expect(promptsOf(si).map((prompt) => prompt.id)).toEqual(promptsOf(original).map((prompt) => prompt.id));
});
});