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: validation to avoid saving customGpt params to non-custom models

Daniel Avila6192c2964ed4
diff --git a/api/models/Conversation.js b/api/models/Conversation.js
index c4151198cd..45834379e8 100644
--- a/api/models/Conversation.js
+++ b/api/models/Conversation.js
@@ -18,10 +18,12 @@ const convoSchema = mongoose.Schema(
default: 'New Chat'
},
jailbreakConversationId: {
- type: String
+ type: String,
+ default: null
},
conversationSignature: {
- type: String
+ type: String,
+ default: null
},
clientId: {
type: String
@@ -30,13 +32,16 @@ const convoSchema = mongoose.Schema(
type: String
},
chatGptLabel: {
- type: String
+ type: String,
+ default: null
},
promptPrefix: {
- type: String
+ type: String,
+ default: null
},
model: {
- type: String
+ type: String,
+ required: true
},
suggestions: [{ type: String }],
messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }]
@@ -67,8 +72,14 @@ module.exports = {
if (newConversationId) {
update.conversationId = newConversationId;
}
- if (!update.jailbreakConversationId)
- update.jailbreakConversationId = null
+ if (!update.jailbreakConversationId) {
+ update.jailbreakConversationId = null;
+ }
+ if (update.model !== 'chatgptCustom' && update.chatGptLabel && update.promptPrefix) {
+ console.log('Validation error: resetting chatgptCustom fields', update);
+ update.chatGptLabel = null;
+ update.promptPrefix = null;
+ }
return await Conversation.findOneAndUpdate(
{ conversationId },
@@ -146,7 +157,7 @@ module.exports = {
} else {
message.parentMessageId = oldId;
}
-
+
oldId = newId;
message.messageId = newId;
if (message.sender.toLowerCase() !== 'user' && !model) {