Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🔒 fix: Exclude Unnecessary fields from Conversation `$unset` (#12501)

Danny Avilac4b5dedb77e6
diff --git a/packages/data-provider/src/config.spec.ts b/packages/data-provider/src/config.spec.ts
index 4197cb754e..d7c81b02bc 100644
--- a/packages/data-provider/src/config.spec.ts
+++ b/packages/data-provider/src/config.spec.ts
@@ -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', () => {
diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.ts
index ae3f5b9560..779885b456 100644
--- a/packages/data-provider/src/config.ts
+++ b/packages/data-provider/src/config.ts
@@ -48,6 +48,7 @@ export const excludedKeys = new Set([
'isArchived',
'tags',
'user',
+ 'tenantId',
'__v',
'_id',
'tools',