mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 19:07:40 +01:00
Merge pull request #2229 from Wolfsblvt/wi-delay-until-recursion
WI entry setting "Delay until recursion"
This commit is contained in:
commit
caf85ad040
@ -5286,6 +5286,12 @@
|
|||||||
Prevent further recursion (this entry will not activate others)
|
Prevent further recursion (this entry will not activate others)
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="checkbox flex-container alignitemscenter flexNoGap">
|
||||||
|
<input type="checkbox" name="delay_until_recursion" />
|
||||||
|
<span data-i18n="Delay until recursion (this entry can only be activated on recursive checking)">
|
||||||
|
Delay until recursion (this entry can only be activated on recursive checking)
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</small>
|
</small>
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
* @property {boolean} group_override - Overrides any existing group assignment for the extension.
|
* @property {boolean} group_override - Overrides any existing group assignment for the extension.
|
||||||
* @property {number} group_weight - A value used for prioritizing extensions within the same group.
|
* @property {number} group_weight - A value used for prioritizing extensions within the same group.
|
||||||
* @property {boolean} prevent_recursion - Completely disallows recursive application of the extension.
|
* @property {boolean} prevent_recursion - Completely disallows recursive application of the extension.
|
||||||
|
* @property {boolean} delay_until_recursion - Will only be checked during recursion.
|
||||||
* @property {number} scan_depth - The maximum depth to search for matches when applying the extension.
|
* @property {number} scan_depth - The maximum depth to search for matches when applying the extension.
|
||||||
* @property {boolean} match_whole_words - Specifies if only entire words should be matched during extension application.
|
* @property {boolean} match_whole_words - Specifies if only entire words should be matched during extension application.
|
||||||
* @property {boolean} use_group_scoring - Indicates if group weight is considered when selecting extensions.
|
* @property {boolean} use_group_scoring - Indicates if group weight is considered when selecting extensions.
|
||||||
|
@ -1234,6 +1234,7 @@ const originalDataKeyMap = {
|
|||||||
'displayIndex': 'extensions.display_index',
|
'displayIndex': 'extensions.display_index',
|
||||||
'excludeRecursion': 'extensions.exclude_recursion',
|
'excludeRecursion': 'extensions.exclude_recursion',
|
||||||
'preventRecursion': 'extensions.prevent_recursion',
|
'preventRecursion': 'extensions.prevent_recursion',
|
||||||
|
'delayUntilRecursion': 'extensions.delay_until_recursion',
|
||||||
'selectiveLogic': 'selectiveLogic',
|
'selectiveLogic': 'selectiveLogic',
|
||||||
'comment': 'comment',
|
'comment': 'comment',
|
||||||
'constant': 'constant',
|
'constant': 'constant',
|
||||||
@ -1891,6 +1892,18 @@ function getWorldEntry(name, data, entry) {
|
|||||||
});
|
});
|
||||||
preventRecursionInput.prop('checked', entry.preventRecursion).trigger('input');
|
preventRecursionInput.prop('checked', entry.preventRecursion).trigger('input');
|
||||||
|
|
||||||
|
// delay until recursion
|
||||||
|
const delayUntilRecursionInput = template.find('input[name="delay_until_recursion"]');
|
||||||
|
delayUntilRecursionInput.data('uid', entry.uid);
|
||||||
|
delayUntilRecursionInput.on('input', function () {
|
||||||
|
const uid = $(this).data('uid');
|
||||||
|
const value = $(this).prop('checked');
|
||||||
|
data.entries[uid].delayUntilRecursion = value;
|
||||||
|
setOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);
|
||||||
|
saveWorldInfo(name, data);
|
||||||
|
});
|
||||||
|
delayUntilRecursionInput.prop('checked', entry.delayUntilRecursion).trigger('input');
|
||||||
|
|
||||||
// duplicate button
|
// duplicate button
|
||||||
const duplicateButton = template.find('.duplicate_entry_button');
|
const duplicateButton = template.find('.duplicate_entry_button');
|
||||||
duplicateButton.data('uid', entry.uid);
|
duplicateButton.data('uid', entry.uid);
|
||||||
@ -2152,6 +2165,8 @@ const newEntryTemplate = {
|
|||||||
position: 0,
|
position: 0,
|
||||||
disable: false,
|
disable: false,
|
||||||
excludeRecursion: false,
|
excludeRecursion: false,
|
||||||
|
preventRecursion: false,
|
||||||
|
delayUntilRecursion: false,
|
||||||
probability: 100,
|
probability: 100,
|
||||||
useProbability: true,
|
useProbability: true,
|
||||||
depth: DEFAULT_DEPTH,
|
depth: DEFAULT_DEPTH,
|
||||||
@ -2519,7 +2534,7 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allActivatedEntries.has(entry) || entry.disable == true || (count > 1 && world_info_recursive && entry.excludeRecursion)) {
|
if (allActivatedEntries.has(entry) || entry.disable == true || (count > 1 && world_info_recursive && entry.excludeRecursion) || (count == 1 && entry.delayUntilRecursion)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2887,6 +2902,7 @@ function convertAgnaiMemoryBook(inputObj) {
|
|||||||
disable: !entry.enabled,
|
disable: !entry.enabled,
|
||||||
addMemo: !!entry.name,
|
addMemo: !!entry.name,
|
||||||
excludeRecursion: false,
|
excludeRecursion: false,
|
||||||
|
delayUntilRecursion: false,
|
||||||
displayIndex: index,
|
displayIndex: index,
|
||||||
probability: 100,
|
probability: 100,
|
||||||
useProbability: true,
|
useProbability: true,
|
||||||
@ -2925,6 +2941,7 @@ function convertRisuLorebook(inputObj) {
|
|||||||
disable: false,
|
disable: false,
|
||||||
addMemo: true,
|
addMemo: true,
|
||||||
excludeRecursion: false,
|
excludeRecursion: false,
|
||||||
|
delayUntilRecursion: false,
|
||||||
displayIndex: index,
|
displayIndex: index,
|
||||||
probability: entry.activationPercent ?? 100,
|
probability: entry.activationPercent ?? 100,
|
||||||
useProbability: entry.activationPercent ?? true,
|
useProbability: entry.activationPercent ?? true,
|
||||||
@ -2968,6 +2985,7 @@ function convertNovelLorebook(inputObj) {
|
|||||||
disable: !entry.enabled,
|
disable: !entry.enabled,
|
||||||
addMemo: addMemo,
|
addMemo: addMemo,
|
||||||
excludeRecursion: false,
|
excludeRecursion: false,
|
||||||
|
delayUntilRecursion: false,
|
||||||
displayIndex: index,
|
displayIndex: index,
|
||||||
probability: 100,
|
probability: 100,
|
||||||
useProbability: true,
|
useProbability: true,
|
||||||
@ -3008,6 +3026,7 @@ function convertCharacterBook(characterBook) {
|
|||||||
position: entry.extensions?.position ?? (entry.position === 'before_char' ? world_info_position.before : world_info_position.after),
|
position: entry.extensions?.position ?? (entry.position === 'before_char' ? world_info_position.before : world_info_position.after),
|
||||||
excludeRecursion: entry.extensions?.exclude_recursion ?? false,
|
excludeRecursion: entry.extensions?.exclude_recursion ?? false,
|
||||||
preventRecursion: entry.extensions?.prevent_recursion ?? false,
|
preventRecursion: entry.extensions?.prevent_recursion ?? false,
|
||||||
|
delayUntilRecursion: entry.extensions?.delay_until_recursion ?? false,
|
||||||
disable: !entry.enabled,
|
disable: !entry.enabled,
|
||||||
addMemo: entry.comment ? true : false,
|
addMemo: entry.comment ? true : false,
|
||||||
displayIndex: entry.extensions?.display_index ?? index,
|
displayIndex: entry.extensions?.display_index ?? index,
|
||||||
|
@ -436,6 +436,7 @@ function convertWorldInfoToCharacterBook(name, entries) {
|
|||||||
group_override: entry.groupOverride ?? false,
|
group_override: entry.groupOverride ?? false,
|
||||||
group_weight: entry.groupWeight ?? null,
|
group_weight: entry.groupWeight ?? null,
|
||||||
prevent_recursion: entry.preventRecursion ?? false,
|
prevent_recursion: entry.preventRecursion ?? false,
|
||||||
|
delay_until_recursion: entry.delayUntilRecursion ?? false,
|
||||||
scan_depth: entry.scanDepth ?? null,
|
scan_depth: entry.scanDepth ?? null,
|
||||||
match_whole_words: entry.matchWholeWords ?? null,
|
match_whole_words: entry.matchWholeWords ?? null,
|
||||||
use_group_scoring: entry.useGroupScoring ?? false,
|
use_group_scoring: entry.useGroupScoring ?? false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user