diff --git a/public/scripts/openai.js b/public/scripts/openai.js index f3f14734b..73eb222ca 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -523,6 +523,7 @@ function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, ty // Character and world information addToChatCompletion('worldInfoBefore'); + addToChatCompletion('main'); addToChatCompletion('worldInfoAfter'); addToChatCompletion('charDescription'); addToChatCompletion('charPersonality'); @@ -531,6 +532,9 @@ function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, ty // Collection of control prompts that will always be positioned last const controlPrompts = new MessageCollection('controlPrompts'); + const impersonateMessage = Message.fromPrompt(prompts.get('impersonate')) ?? null; + if (type === 'impersonate') controlPrompts.add(impersonateMessage) + // Add quiet prompt to control prompts // This should always be last, even in control prompts. Add all further control prompts BEFORE this prompt const quietPromptMessage = Message.fromPrompt(prompts.get('quietPrompt')) ?? null; @@ -538,10 +542,6 @@ function populateChatCompletion (prompts, chatCompletion, {bias, quietPrompt, ty chatCompletion.reserveBudget(controlPrompts); - // Add main prompt - if (type === "impersonate") addToChatCompletion('impersonate', 'main'); - else addToChatCompletion('main'); - // Add ordered system and user prompts const systemPrompts = ['nsfw', 'jailbreak']; const userPrompts = prompts.collection