mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
fix: validation to avoid saving customGpt params to non-custom models
This commit is contained in:
parent
626a8fbd8e
commit
6192c2964e
1 changed files with 19 additions and 8 deletions
|
|
@ -18,10 +18,12 @@ const convoSchema = mongoose.Schema(
|
||||||
default: 'New Chat'
|
default: 'New Chat'
|
||||||
},
|
},
|
||||||
jailbreakConversationId: {
|
jailbreakConversationId: {
|
||||||
type: String
|
type: String,
|
||||||
|
default: null
|
||||||
},
|
},
|
||||||
conversationSignature: {
|
conversationSignature: {
|
||||||
type: String
|
type: String,
|
||||||
|
default: null
|
||||||
},
|
},
|
||||||
clientId: {
|
clientId: {
|
||||||
type: String
|
type: String
|
||||||
|
|
@ -30,13 +32,16 @@ const convoSchema = mongoose.Schema(
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
chatGptLabel: {
|
chatGptLabel: {
|
||||||
type: String
|
type: String,
|
||||||
|
default: null
|
||||||
},
|
},
|
||||||
promptPrefix: {
|
promptPrefix: {
|
||||||
type: String
|
type: String,
|
||||||
|
default: null
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
type: String
|
type: String,
|
||||||
|
required: true
|
||||||
},
|
},
|
||||||
suggestions: [{ type: String }],
|
suggestions: [{ type: String }],
|
||||||
messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }]
|
messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }]
|
||||||
|
|
@ -67,8 +72,14 @@ module.exports = {
|
||||||
if (newConversationId) {
|
if (newConversationId) {
|
||||||
update.conversationId = newConversationId;
|
update.conversationId = newConversationId;
|
||||||
}
|
}
|
||||||
if (!update.jailbreakConversationId)
|
if (!update.jailbreakConversationId) {
|
||||||
update.jailbreakConversationId = null
|
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(
|
return await Conversation.findOneAndUpdate(
|
||||||
{ conversationId },
|
{ conversationId },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue