From f6ab33d8359d83cce748ca8846bc347d91bcb55c Mon Sep 17 00:00:00 2001 From: cloak1505 <170299980+cloak1505@users.noreply.github.com> Date: Fri, 16 May 2025 15:53:37 -0500 Subject: [PATCH] Reverse CC prompt manager's injection order of "Order" to match World Info (#4004) * Reverse CC injection "Order" to match World Info * Set CC injection order default to 100 * Update non-PM injects order + add hint * Update default order value on inject --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> --- public/index.html | 5 +++-- public/scripts/PromptManager.js | 6 +++--- public/scripts/openai.js | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/public/index.html b/public/index.html index 015d14666..4deb5fbdd 100644 --- a/public/index.html +++ b/public/index.html @@ -6486,9 +6486,10 @@
- -
Ordered from high/top to low/bottom, and at same order: System, User, Assistant.
+ +
Ordered from low/top to high/bottom, and at same order: Assistant, User, System.
diff --git a/public/scripts/PromptManager.js b/public/scripts/PromptManager.js index a93e4db90..486989586 100644 --- a/public/scripts/PromptManager.js +++ b/public/scripts/PromptManager.js @@ -106,7 +106,7 @@ class Prompt { this.injection_position = injection_position; this.forbid_overrides = forbid_overrides; this.extension = extension ?? false; - this.injection_order = injection_order ?? 0; + this.injection_order = injection_order ?? 100; } } @@ -449,7 +449,7 @@ class PromptManager { document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value = prompt.content ?? ''; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value = prompt.injection_position ?? 0; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value = prompt.injection_depth ?? DEFAULT_DEPTH; - document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order').value = prompt.injection_order ?? 0; + document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order').value = prompt.injection_order ?? 100; document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; document.getElementById(this.configuration.prefix + 'prompt_manager_order_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked = prompt.forbid_overrides ?? false; @@ -1243,7 +1243,7 @@ class PromptManager { promptField.disabled = prompt.marker ?? false; injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE; injectionDepthField.value = prompt.injection_depth ?? DEFAULT_DEPTH; - injectionOrderField.value = prompt.injection_order ?? 0; + injectionOrderField.value = prompt.injection_order ?? 100; injectionDepthBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; injectionOrderBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; injectionPositionField.removeAttribute('disabled'); diff --git a/public/scripts/openai.js b/public/scripts/openai.js index a8a8cdb3f..fccfd7846 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -765,12 +765,12 @@ async function populationInjectionPrompts(prompts, messages) { const wrap = false; // Group prompts by priority - const extensionPromptsOrder = '0'; + const extensionPromptsOrder = '100'; const orderGroups = { [extensionPromptsOrder]: [], }; for (const prompt of depthPrompts) { - const order = prompt.injection_order || 0; + const order = prompt.injection_order ?? 100; if (!orderGroups[order]) { orderGroups[order] = []; } @@ -778,7 +778,7 @@ async function populationInjectionPrompts(prompts, messages) { } // Process each order group in order (b - a = low to high ; a - b = high to low) - const orders = Object.keys(orderGroups).sort((a, b) => +a - +b); + const orders = Object.keys(orderGroups).sort((a, b) => +b - +a); for (const order of orders) { const orderPrompts = orderGroups[order];