From 685e9b7e79fa22f7dceaa17c1e6e91b4d00e5b38 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 25 Aug 2023 17:15:55 +0300 Subject: [PATCH] Stabilize extension injections order for prompt manager --- public/scripts/openai.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() }); } } }