mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 10:57:45 +01:00
add option on WI entries to prevent further recursion
This commit is contained in:
parent
e3d1008aa1
commit
9e34804ab0
@ -4337,7 +4337,13 @@
|
|||||||
<label class="checkbox flex-container alignitemscenter flexNoGap">
|
<label class="checkbox flex-container alignitemscenter flexNoGap">
|
||||||
<input type="checkbox" name="exclude_recursion" />
|
<input type="checkbox" name="exclude_recursion" />
|
||||||
<span data-i18n="Exclude from recursion">
|
<span data-i18n="Exclude from recursion">
|
||||||
Non-recursable
|
Non-recursable (this entry will not be activated by another)
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox flex-container alignitemscenter flexNoGap">
|
||||||
|
<input type="checkbox" name="prevent_recursion" />
|
||||||
|
<span data-i18n="Prevent further recursion (this entry will not activate others)">
|
||||||
|
Prevent further recursion (this entry will not activate others)
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -757,6 +757,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) {
|
|||||||
const originalDataKeyMap = {
|
const originalDataKeyMap = {
|
||||||
'displayIndex': 'extensions.display_index',
|
'displayIndex': 'extensions.display_index',
|
||||||
'excludeRecursion': 'extensions.exclude_recursion',
|
'excludeRecursion': 'extensions.exclude_recursion',
|
||||||
|
'preventRecursion': 'extensions.prevent_recursion',
|
||||||
'selectiveLogic': 'selectiveLogic',
|
'selectiveLogic': 'selectiveLogic',
|
||||||
'comment': 'comment',
|
'comment': 'comment',
|
||||||
'constant': 'constant',
|
'constant': 'constant',
|
||||||
@ -1326,6 +1327,18 @@ function getWorldEntry(name, data, entry) {
|
|||||||
});
|
});
|
||||||
excludeRecursionInput.prop('checked', entry.excludeRecursion).trigger('input');
|
excludeRecursionInput.prop('checked', entry.excludeRecursion).trigger('input');
|
||||||
|
|
||||||
|
// prevent recursion
|
||||||
|
const preventRecursionInput = template.find('input[name="prevent_recursion"]');
|
||||||
|
preventRecursionInput.data('uid', entry.uid);
|
||||||
|
preventRecursionInput.on('input', function () {
|
||||||
|
const uid = $(this).data('uid');
|
||||||
|
const value = $(this).prop('checked');
|
||||||
|
data.entries[uid].preventRecursion = value;
|
||||||
|
setOriginalDataValue(data, uid, 'extensions.prevent_recursion', data.entries[uid].preventRecursion);
|
||||||
|
saveWorldInfo(name, data);
|
||||||
|
});
|
||||||
|
preventRecursionInput.prop('checked', entry.preventRecursion).trigger('input');
|
||||||
|
|
||||||
// delete button
|
// delete button
|
||||||
const deleteButton = template.find('.delete_entry_button');
|
const deleteButton = template.find('.delete_entry_button');
|
||||||
deleteButton.data('uid', entry.uid);
|
deleteButton.data('uid', entry.uid);
|
||||||
@ -1886,6 +1899,7 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
if (needsToScan) {
|
if (needsToScan) {
|
||||||
const text = newEntries
|
const text = newEntries
|
||||||
.filter(x => !failedProbabilityChecks.has(x))
|
.filter(x => !failedProbabilityChecks.has(x))
|
||||||
|
.filter(x => !x.preventRecursion)
|
||||||
.map(x => x.content).join('\n');
|
.map(x => x.content).join('\n');
|
||||||
const currentlyActivatedText = transformString(text);
|
const currentlyActivatedText = transformString(text);
|
||||||
textToScan = (currentlyActivatedText + '\n' + textToScan);
|
textToScan = (currentlyActivatedText + '\n' + textToScan);
|
||||||
@ -2158,6 +2172,7 @@ function convertCharacterBook(characterBook) {
|
|||||||
order: entry.insertion_order,
|
order: entry.insertion_order,
|
||||||
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,
|
||||||
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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user