mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
The messagePiiFilterSchema declares
`redactionText: z.string().default('[REDACTED]')` but the LibreChat
config loader at api/server/services/Config/loadCustomConfig.js only
copies `result.data.modelSpecs` back onto the raw YAML object after
parsing, so Zod's parsed defaults for every other field are dropped.
An operator who omits `redactionText` ends up with `undefined` at
runtime even though the schema documents `[REDACTED]` as the default.
The browser serializer already coalesced to `[REDACTED]` for the
client side, but the server-side factory hook and the
`applyMessagePiiRedaction` helper passed `config.redactionText`
through unchanged. That produced a UX mismatch (client toasts said
`sk-[REDACTED]` while server-scrubbed prompts were stamped with
literal `undefined`) for the default-shape config.
Added a shared `DEFAULT_PII_REDACTION_TEXT` constant in
packages/api/src/agents/messagePiiFilter.ts and routed all three
helpers (factory, applyMessagePiiRedaction, serializer) through it
so the server and client always agree on the redaction text without
relying on the loader to surface schema defaults.
|
||
|---|---|---|
| .. | ||
| src | ||
| types | ||
| .gitignore | ||
| babel.config.cjs | ||
| jest.config.mjs | ||
| jest.setup.cjs | ||
| package.json | ||
| rollup.config.js | ||
| tsconfig-paths-bootstrap.mjs | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| tsconfig.spec.json | ||