From 716849854329da473215f1e41b6c94cf33b17e78 Mon Sep 17 00:00:00 2001 From: Wentao Lyu <35-wentao.lyu@users.noreply.git.stereye.tech> Date: Wed, 15 Mar 2023 00:47:17 +0800 Subject: [PATCH] fix: jailbreakConversationId=false response will be saved jailbreakConversationId='false' in database. --- api/app/bingai.js | 6 ++++-- api/models/Conversation.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/app/bingai.js b/api/app/bingai.js index d1175c0bfc..2ccbc2b356 100644 --- a/api/app/bingai.js +++ b/api/app/bingai.js @@ -22,8 +22,10 @@ const askBing = async ({ text, progressCallback, convo }) => { options = { ...options, ...convo }; } - const res = await bingAIClient.sendMessage(text, options - ); + if (options?.jailbreakConversationId == 'false') + options.jailbreakConversationId = false + + const res = await bingAIClient.sendMessage(text, options); return res; diff --git a/api/models/Conversation.js b/api/models/Conversation.js index 1c994fdc38..d2ead788d2 100644 --- a/api/models/Conversation.js +++ b/api/models/Conversation.js @@ -64,6 +64,8 @@ module.exports = { if (title) { update.title = title; } + if (!update.jailbreakConversationId) + update.jailbreakConversationId = null return await Conversation.findOneAndUpdate( { conversationId },