From 2b481dae2d738cfcc4dadcc3366a88b64c75e5fd Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 23 Nov 2024 20:41:57 +0200 Subject: [PATCH] Fix continue prefill newline prefix --- public/scripts/openai.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index dbbd33386..959a87571 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -752,7 +752,8 @@ async function populateChatHistory(messages, prompts, chatCompletion, type = nul if (type === 'continue' && oai_settings.continue_prefill && chatPrompt === firstNonInjected) { // in case we are using continue_prefill and the latest message is an assistant message, we want to prepend the users assistant prefill on the message if (chatPrompt.role === 'assistant') { - const continueMessage = await Message.createAsync(chatMessage.role, substituteParams(oai_settings.assistant_prefill + '\n\n') + chatMessage.content, chatMessage.identifier); + const messageContent = [substituteParams(oai_settings.assistant_prefill), chatMessage.content].filter(x => x).join('\n\n'); + const continueMessage = await Message.createAsync(chatMessage.role, messageContent, chatMessage.identifier); const collection = new MessageCollection('continuePrefill', continueMessage); chatCompletion.add(collection, -1); continue;