mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-18 13:10:40 +01:00
Add UI element for delay recursion level
- Tied and only visible to the "delay until recursion" toggle - Will set it to a numerical value if used, otherwise keeps true/false state of the toggle
This commit is contained in:
parent
413f6a0379
commit
eeed072ebb
@ -274,3 +274,7 @@ select.keyselect+span.select2-container .select2-selection--multiple {
|
||||
align-self: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.world_entry:has(input[name="delay_until_recursion"]:not(:checked)) .world_entry_form_control:has(input[name="delayUntilRecursionLevel"]) {
|
||||
display: none;
|
||||
}
|
||||
|
@ -5489,6 +5489,13 @@
|
||||
<small class="textAlignCenter" data-i18n="Automation ID">Automation ID</small>
|
||||
<input class="text_pole margin0" name="automationId" type="text" placeholder="( None )" data-i18n="[placeholder]( None )">
|
||||
</div>
|
||||
<div class="world_entry_form_control flex1" title="Defines delay levels for recursive scans. Initially, only the first level (smallest number) will match. Once no matches are found, the next level becomes eligible for matching. This repeats until all levels are checked. Tied to the "Delay until recursion" setting." data-i18n="[title]delay_until_recursion_level">
|
||||
<small class="textAlignCenter">
|
||||
<span data-i18n="Recursion Level">Recursion Level</span>
|
||||
<div class="fa-solid fa-circle-info opacity50p"></div>
|
||||
</small>
|
||||
<input class="text_pole margin0" name="delayUntilRecursionLevel" type="text" placeholder="1">
|
||||
</div>
|
||||
</div>
|
||||
<div name="contentAndCharFilterBlock" class="world_entry_thin_controls flex2">
|
||||
<div class="world_entry_form_control flex1">
|
||||
|
@ -2953,13 +2953,35 @@ async function getWorldEntry(name, data, entry) {
|
||||
delayUntilRecursionInput.data('uid', entry.uid);
|
||||
delayUntilRecursionInput.on('input', async function () {
|
||||
const uid = $(this).data('uid');
|
||||
const value = $(this).prop('checked');
|
||||
const toggled = $(this).prop('checked');
|
||||
|
||||
// If the value contains a number, we'll take that one (set by the level input), otherwise we can use true/false switch
|
||||
const value = toggled ? data.entries[uid].delayUntilRecursion || true : false;
|
||||
|
||||
data.entries[uid].delayUntilRecursion = value;
|
||||
setWIOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);
|
||||
await saveWorldInfo(name, data);
|
||||
});
|
||||
delayUntilRecursionInput.prop('checked', entry.delayUntilRecursion).trigger('input');
|
||||
|
||||
// delay until recursion level
|
||||
const delayUntilRecursionLevelInput = template.find('input[name="delayUntilRecursionLevel"]');
|
||||
delayUntilRecursionLevelInput.data('uid', entry.uid);
|
||||
delayUntilRecursionLevelInput.on('input', async function () {
|
||||
const uid = $(this).data('uid');
|
||||
const content = $(this).val();
|
||||
const value = content === '' ? (typeof data.entries[uid].delayUntilRecursion === 'boolean' ? data.entries[uid].delayUntilRecursion : true)
|
||||
: content === 1 ? true
|
||||
: !isNaN(Number(content)) ? Number(content)
|
||||
: false;
|
||||
|
||||
data.entries[uid].delayUntilRecursion = value;
|
||||
setWIOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);
|
||||
await saveWorldInfo(name, data);
|
||||
});
|
||||
// No need to retrigger inpout event, we'll just set the curret current value. It was edited/saved above already
|
||||
delayUntilRecursionLevelInput.val(['number', 'string'].includes(typeof entry.delayUntilRecursion) ? entry.delayUntilRecursion : '').trigger('input');
|
||||
|
||||
// duplicate button
|
||||
const duplicateButton = template.find('.duplicate_entry_button');
|
||||
duplicateButton.data('uid', entry.uid);
|
||||
@ -3257,7 +3279,7 @@ export const newWorldInfoEntryDefinition = {
|
||||
disable: { default: false, type: 'boolean' },
|
||||
excludeRecursion: { default: false, type: 'boolean' },
|
||||
preventRecursion: { default: false, type: 'boolean' },
|
||||
delayUntilRecursion: { default: false, type: 'boolean' },
|
||||
delayUntilRecursion: { default: 0, type: 'number' },
|
||||
probability: { default: 100, type: 'number' },
|
||||
useProbability: { default: true, type: 'boolean' },
|
||||
depth: { default: DEFAULT_DEPTH, type: 'number' },
|
||||
|
Loading…
x
Reference in New Issue
Block a user