Synchronize max depths for plugins
This commit is contained in:
parent
db71b87309
commit
edb79d8c53
|
@ -2613,7 +2613,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="range-block-range-and-counter">
|
<div class="range-block-range-and-counter">
|
||||||
<div class="range-block-range paddingLeftRight5">
|
<div class="range-block-range paddingLeftRight5">
|
||||||
<input type="range" id="world_info_depth" name="volume" min="0" max="10" step="1">
|
<input type="range" id="world_info_depth" name="volume" min="0" max="100" step="1">
|
||||||
</div>
|
</div>
|
||||||
<div class="range-block-counter margin0">
|
<div class="range-block-counter margin0">
|
||||||
<div contenteditable="true" data-for="world_info_depth" id="world_info_depth_counter">
|
<div contenteditable="true" data-for="world_info_depth" id="world_info_depth_counter">
|
||||||
|
@ -4018,7 +4018,7 @@
|
||||||
|
|
||||||
<div class="world_entry_form_control wi-enter-footer-text flex-container flexNoGap ">
|
<div class="world_entry_form_control wi-enter-footer-text flex-container flexNoGap ">
|
||||||
<label for="depth" data-i18n="Depth:">Depth:</label>
|
<label for="depth" data-i18n="Depth:">Depth:</label>
|
||||||
<input class="text_pole wideMax100px margin0" type="number" name="depth" placeholder="" min="0" max="10000" />
|
<input class="text_pole wideMax100px margin0" type="number" name="depth" placeholder="" min="0" max="999" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="world_entry_form_control wi-enter-footer-text flex-container flexNoGap ">
|
<div class="world_entry_form_control wi-enter-footer-text flex-container flexNoGap ">
|
||||||
|
@ -4362,7 +4362,7 @@
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="extension_floating_position" value="1" />
|
<input type="radio" name="extension_floating_position" value="1" />
|
||||||
In-chat @ Depth <input id="extension_floating_depth" class="text_pole widthUnset" type="number" min="0" max="99" />
|
In-chat @ Depth <input id="extension_floating_depth" class="text_pole widthUnset" type="number" min="0" max="999" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<!--<label for="extension_floating_interval">In-Chat Insertion Depth</label>-->
|
<!--<label for="extension_floating_interval">In-Chat Insertion Depth</label>-->
|
||||||
|
@ -4430,7 +4430,7 @@
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="extension_default_position" value="1" />
|
<input type="radio" name="extension_default_position" value="1" />
|
||||||
In-chat @ Depth <input id="extension_default_depth" class="text_pole widthUnset" type="number" min="0" max="99" />
|
In-chat @ Depth <input id="extension_default_depth" class="text_pole widthUnset" type="number" min="0" max="999" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<label for="extension_default_interval">Insertion Frequency</label>
|
<label for="extension_default_interval">Insertion Frequency</label>
|
||||||
|
|
|
@ -390,6 +390,8 @@ const extension_prompt_types = {
|
||||||
BEFORE_PROMPT: 2
|
BEFORE_PROMPT: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MAX_INJECTION_DEPTH = 1000;
|
||||||
|
|
||||||
let system_messages = {};
|
let system_messages = {};
|
||||||
|
|
||||||
function getSystemMessages() {
|
function getSystemMessages() {
|
||||||
|
@ -2883,7 +2885,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||||
// TODO: Rewrite getExtensionPrompt to not require multiple for loops
|
// TODO: Rewrite getExtensionPrompt to not require multiple for loops
|
||||||
// Set all extension prompts where insertion depth > mesSend length
|
// Set all extension prompts where insertion depth > mesSend length
|
||||||
if (finalMesSend.length) {
|
if (finalMesSend.length) {
|
||||||
for (let upperDepth = 100; upperDepth >= finalMesSend.length; upperDepth--) {
|
for (let upperDepth = MAX_INJECTION_DEPTH; upperDepth >= finalMesSend.length; upperDepth--) {
|
||||||
const upperAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, upperDepth);
|
const upperAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, upperDepth);
|
||||||
if (upperAnchor && upperAnchor.length) {
|
if (upperAnchor && upperAnchor.length) {
|
||||||
finalMesSend[0].extensionPrompts.push(upperAnchor);
|
finalMesSend[0].extensionPrompts.push(upperAnchor);
|
||||||
|
@ -5641,7 +5643,7 @@ function select_rm_characters() {
|
||||||
* @param {string} key Prompt injection id.
|
* @param {string} key Prompt injection id.
|
||||||
* @param {string} value Prompt injection value.
|
* @param {string} value Prompt injection value.
|
||||||
* @param {number} position Insertion position. 0 is after story string, 1 is in-chat with custom depth.
|
* @param {number} position Insertion position. 0 is after story string, 1 is in-chat with custom depth.
|
||||||
* @param {number} depth Insertion depth. 0 represets the last message in context. Expected values up to 100.
|
* @param {number} depth Insertion depth. 0 represets the last message in context. Expected values up to MAX_INJECTION_DEPTH.
|
||||||
*/
|
*/
|
||||||
export function setExtensionPrompt(key, value, position, depth) {
|
export function setExtensionPrompt(key, value, position, depth) {
|
||||||
extension_prompts[key] = { value: String(value), position: Number(position), depth: Number(depth) };
|
extension_prompts[key] = { value: String(value), position: Number(position), depth: Number(depth) };
|
||||||
|
|
|
@ -584,7 +584,7 @@ jQuery(function () {
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="memory_position" value="1" />
|
<input type="radio" name="memory_position" value="1" />
|
||||||
In-chat @ Depth <input id="memory_depth" class="text_pole widthUnset" type="number" min="0" max="99" />
|
In-chat @ Depth <input id="memory_depth" class="text_pole widthUnset" type="number" min="0" max="999" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div data-source="main" class="memory_contents_controls">
|
<div data-source="main" class="memory_contents_controls">
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="vectors_position" value="1" />
|
<input type="radio" name="vectors_position" value="1" />
|
||||||
In-chat @ Depth <input id="vectors_depth" class="text_pole widthUnset" type="number" min="0" max="99" />
|
In-chat @ Depth <input id="vectors_depth" class="text_pole widthUnset" type="number" min="0" max="999" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-container">
|
<div class="flex-container">
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {
|
||||||
eventSource,
|
eventSource,
|
||||||
event_types,
|
event_types,
|
||||||
substituteParams,
|
substituteParams,
|
||||||
|
MAX_INJECTION_DEPTH,
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
import { groups, selected_group } from "./group-chats.js";
|
import { groups, selected_group } from "./group-chats.js";
|
||||||
|
|
||||||
|
@ -323,7 +324,7 @@ function setOpenAIMessages(chat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add chat injections, 100 = maximum depth of injection. (Why would you ever need more?)
|
// Add chat injections, 100 = maximum depth of injection. (Why would you ever need more?)
|
||||||
for (let i = 100; i >= 0; i--) {
|
for (let i = MAX_INJECTION_DEPTH; i >= 0; i--) {
|
||||||
const anchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, i);
|
const anchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, i);
|
||||||
|
|
||||||
if (anchor && anchor.length) {
|
if (anchor && anchor.length) {
|
||||||
|
|
Loading…
Reference in New Issue