Change group prio name, add default value set

This commit is contained in:
Wolfsblvt 2024-04-27 04:40:35 +02:00
parent 7df2f7e752
commit dcb042681d
2 changed files with 14 additions and 9 deletions

View File

@ -5135,8 +5135,8 @@
<span class="fa-solid fa-circle-question note-link-span"></span>
</a>
</small>
<label class="checkbox_label flexNoGap margin-r5" for="groupPrio">
<input type="checkbox" name="groupPrio" />
<label class="checkbox_label flexNoGap margin-r5" for="groupOverride">
<input type="checkbox" name="groupOverride" />
<span>
<small data-i18n="Prioritize Inclusion" title="Prioritize this entry: When checked, this entry is prioritized out of all selections.&#13;If multiple are prioritized, the one with the highest 'Order' is chosen.&#13;" data-i18n="[title]Prioritize this entry: When checked, this entry is prioritized out of all selections.&#13;If multiple are prioritized, the one with the highest 'Order' is chosen.">
Prioritize Inclusion

View File

@ -1339,16 +1339,16 @@ function getWorldEntry(name, data, entry) {
setTimeout(() => createEntryInputAutocomplete(groupInput, getInclusionGroupCallback(data)), 1);
// inclusion priority
const groupPrioInput = template.find('input[name="groupPrio"]');
groupPrioInput.data('uid', entry.uid);
groupPrioInput.on('input', function () {
const groupOverrideInput = template.find('input[name="groupPrio"]');
groupOverrideInput.data('uid', entry.uid);
groupOverrideInput.on('input', function () {
const uid = $(this).data('uid');
const value = $(this).prop('checked');
data.entries[uid].groupPrio = value;
setOriginalDataValue(data, uid, 'extensions.groupPrio', data.entries[uid].groupPrio);
data.entries[uid].groupOverride = value;
setOriginalDataValue(data, uid, 'extensions.groupOverride', data.entries[uid].groupOverride);
saveWorldInfo(name, data);
});
groupPrioInput.prop('checked', entry.groupPrio).trigger('input');
groupOverrideInput.prop('checked', entry.groupOverride).trigger('input');
// probability
if (entry.probability === undefined) {
@ -1798,6 +1798,7 @@ const newEntryTemplate = {
useProbability: true,
depth: DEFAULT_DEPTH,
group: '',
groupOverride: false,
scanDepth: null,
caseSensitive: null,
matchWholeWords: null,
@ -2416,7 +2417,7 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) {
}
// Check for group prio
const prios = group.filter(x => x.groupPrio).sort(sortFn);
const prios = group.filter(x => x.groupOverride).sort(sortFn);
if (prios.length) {
console.debug(`Activated inclusion group '${key}' with by prio winner entry '${prios[0].uid}'`, prios[0]);
removeAllBut(group, prios[0]);
@ -2473,6 +2474,7 @@ function convertAgnaiMemoryBook(inputObj) {
probability: null,
useProbability: false,
group: '',
groupOverride: false,
scanDepth: entry.extensions?.scan_depth ?? null,
caseSensitive: entry.extensions?.case_sensitive ?? null,
matchWholeWords: entry.extensions?.match_whole_words ?? null,
@ -2508,6 +2510,7 @@ function convertRisuLorebook(inputObj) {
probability: entry.activationPercent ?? null,
useProbability: entry.activationPercent ?? false,
group: '',
groupOverride: false,
scanDepth: entry.extensions?.scan_depth ?? null,
caseSensitive: entry.extensions?.case_sensitive ?? null,
matchWholeWords: entry.extensions?.match_whole_words ?? null,
@ -2548,6 +2551,7 @@ function convertNovelLorebook(inputObj) {
probability: null,
useProbability: false,
group: '',
groupOverride: false,
scanDepth: entry.extensions?.scan_depth ?? null,
caseSensitive: entry.extensions?.case_sensitive ?? null,
matchWholeWords: entry.extensions?.match_whole_words ?? null,
@ -2589,6 +2593,7 @@ function convertCharacterBook(characterBook) {
depth: entry.extensions?.depth ?? DEFAULT_DEPTH,
selectiveLogic: entry.extensions?.selectiveLogic ?? world_info_logic.AND_ANY,
group: entry.extensions?.group ?? '',
groupOverride: entry.extensions?.groupOverride ?? false,
scanDepth: entry.extensions?.scan_depth ?? null,
caseSensitive: entry.extensions?.case_sensitive ?? null,
matchWholeWords: entry.extensions?.match_whole_words ?? null,