From 6608f5dd95c0817915346f1081a312db0aa4ce8c Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 24 Sep 2024 22:18:28 +0300 Subject: [PATCH] Fix the use of stop strings for Gemini --- public/scripts/openai.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index bc4a50056..df798132b 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -1795,10 +1795,9 @@ async function sendOpenAIRequest(type, messages, signal) { } if (isGoogle) { - const nameStopString = isImpersonate ? `\n${name2}:` : `\n${name1}:`; - const stopStringsLimit = 3; // 5 - 2 (nameStopString and new_chat_prompt) + const stopStringsLimit = 5; generate_data['top_k'] = Number(oai_settings.top_k_openai); - generate_data['stop'] = [nameStopString, substituteParams(oai_settings.new_chat_prompt), ...getCustomStoppingStrings(stopStringsLimit)]; + generate_data['stop'] = getCustomStoppingStrings(stopStringsLimit).slice(0, stopStringsLimit).filter(x => x.length >= 1 && x.length <= 16); generate_data['use_makersuite_sysprompt'] = oai_settings.use_makersuite_sysprompt; }