mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-03 06:17:21 +02:00
🔒 fix: Exclude Unnecessary fields from Conversation $unset (#12501)
`BaseClient.js` iterates existing conversation keys to build `unsetFields` for removal when `endpointOptions` doesn't include them. When tenant isolation stamps `tenantId` on the document, it gets swept into `$unset`, triggering `assertNoTenantIdMutation`. Adding `tenantId` to `excludedKeys` prevents this — it's a system field, not an endpoint option.
This commit is contained in:
parent
5e789f589f
commit
c4b5dedb77
2 changed files with 11 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import type { TEndpointsConfig } from './types';
|
||||
import { EModelEndpoint, isDocumentSupportedProvider } from './schemas';
|
||||
import { getEndpointFileConfig, mergeFileConfig } from './file-config';
|
||||
import { resolveEndpointType } from './config';
|
||||
import { resolveEndpointType, excludedKeys } from './config';
|
||||
|
||||
const endpointsConfig: TEndpointsConfig = {
|
||||
[EModelEndpoint.openAI]: { userProvide: false, order: 0 },
|
||||
|
|
@ -13,6 +13,15 @@ const endpointsConfig: TEndpointsConfig = {
|
|||
Gemini: { type: EModelEndpoint.custom, userProvide: false, order: 9999 },
|
||||
};
|
||||
|
||||
describe('excludedKeys', () => {
|
||||
it.each(['_id', 'user', 'conversationId', '__v', 'tenantId'])(
|
||||
'excludes system field "%s"',
|
||||
(field) => {
|
||||
expect(excludedKeys.has(field)).toBe(true);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('resolveEndpointType', () => {
|
||||
describe('non-agents endpoints', () => {
|
||||
it('returns the config type for a custom endpoint', () => {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ export const excludedKeys = new Set([
|
|||
'isArchived',
|
||||
'tags',
|
||||
'user',
|
||||
'tenantId',
|
||||
'__v',
|
||||
'_id',
|
||||
'tools',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue