diff --git a/public/scripts/openai.js b/public/scripts/openai.js index c9302b0b0..ab67c44ac 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -294,11 +294,11 @@ function setOpenAIMessages(chat) { } // Add chat injections, 100 = maximum depth of injection. (Why would you ever need more?) - for (let i = 0; i < 100; i++) { + for (let i = 100; i >= 0; i--) { const anchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, i); if (anchor && anchor.length) { - openai_msgs.splice(i, 0, { "role": 'system', 'content': anchor.trim() }) + openai_msgs.splice(i, 0, { "role": 'system', 'content': anchor.trim() }); } } }