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;