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>
Signed| @@ -6486,9 +6486,10 @@ | ||
| 6486 | 6486 | <div id="completion_prompt_manager_order_block" class="completion_prompt_manager_popup_entry_form_control flex1"> |
| 6487 | 6487 | <label for="completion_prompt_manager_popup_entry_form_injection_order"> |
| 6488 | 6488 | <span data-i18n="prompt_manager_order">Order</span> |
| 6489 | + <i class="fas fa-info-circle" title="Prompt injections from other sources (World Info, Author's Note, etc.) always have a default order of 100." data-i18n="[title]prompt_manager_order_note"></i> | |
| 6489 | 6490 | </label> |
| 6490 | 6491 | <input id="completion_prompt_manager_popup_entry_form_injection_order" class="text_pole" type="number" name="injection_order" min="0" max="9999" value="0100" /> |
| 6491 | 6492 | <div class="text_muted" data-i18n="Ordered from highlow/top to lowhigh/bottom, and at same order: SystemAssistant, User, AssistantSystem.">Ordered from highlow/top to lowhigh/bottom, and at same order: SystemAssistant, User, AssistantSystem.</div> |
| 6492 | 6493 | </div> |
| 6493 | 6494 | </div> |
| 6494 | 6495 | <div class="completion_prompt_manager_popup_entry_form_control"> |
| @@ -106,7 +106,7 @@ class Prompt { | ||
| 106 | 106 | this.injection_position = injection_position; |
| 107 | 107 | this.forbid_overrides = forbid_overrides; |
| 108 | 108 | this.extension = extension ?? false; |
| 109 | 109 | this.injection_order = injection_order ?? 0100; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| @@ -449,7 +449,7 @@ class PromptManager { | ||
| 449 | 449 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value = prompt.content ?? ''; |
| 450 | 450 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value = prompt.injection_position ?? 0; |
| 451 | 451 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value = prompt.injection_depth ?? DEFAULT_DEPTH; |
| 452 | 452 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order').value = prompt.injection_order ?? 0100; |
| 453 | 453 | document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; |
| 454 | 454 | document.getElementById(this.configuration.prefix + 'prompt_manager_order_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; |
| 455 | 455 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked = prompt.forbid_overrides ?? false; |
| @@ -1243,7 +1243,7 @@ class PromptManager { | ||
| 1243 | 1243 | promptField.disabled = prompt.marker ?? false; |
| 1244 | 1244 | injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE; |
| 1245 | 1245 | injectionDepthField.value = prompt.injection_depth ?? DEFAULT_DEPTH; |
| 1246 | 1246 | injectionOrderField.value = prompt.injection_order ?? 0100; |
| 1247 | 1247 | injectionDepthBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; |
| 1248 | 1248 | injectionOrderBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; |
| 1249 | 1249 | injectionPositionField.removeAttribute('disabled'); |
| @@ -765,12 +765,12 @@ async function populationInjectionPrompts(prompts, messages) { | ||
| 765 | 765 | const wrap = false; |
| 766 | 766 | |
| 767 | 767 | // Group prompts by priority |
| 768 | 768 | const extensionPromptsOrder = '0100'; |
| 769 | 769 | const orderGroups = { |
| 770 | 770 | [extensionPromptsOrder]: [], |
| 771 | 771 | }; |
| 772 | 772 | for (const prompt of depthPrompts) { |
| 773 | 773 | const order = prompt.injection_order ||?? 0100; |
| 774 | 774 | if (!orderGroups[order]) { |
| 775 | 775 | orderGroups[order] = []; |
| 776 | 776 | } |
| @@ -778,7 +778,7 @@ async function populationInjectionPrompts(prompts, messages) { | ||
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | // Process each order group in order (b - a = low to high ; a - b = high to low) |
| 781 | 781 | const orders = Object.keys(orderGroups).sort((a, b) => +ab - +ba); |
| 782 | 782 | for (const order of orders) { |
| 783 | 783 | const orderPrompts = orderGroups[order]; |
| 784 | 784 | |