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> <span class="fa-solid fa-circle-question note-link-span"></span>
</a> </a>
</small> </small>
<label class="checkbox_label flexNoGap margin-r5" for="groupPrio"> <label class="checkbox_label flexNoGap margin-r5" for="groupOverride">
<input type="checkbox" name="groupPrio" /> <input type="checkbox" name="groupOverride" />
<span> <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."> <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 Prioritize Inclusion

View File

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