mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 19:07:40 +01:00
#1649 Fix deactivation of singular group entry per recursion step
This commit is contained in:
parent
ead0aa65ff
commit
aa796e5aae
@ -2004,11 +2004,6 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) {
|
|||||||
for (const [key, group] of Object.entries(grouped)) {
|
for (const [key, group] of Object.entries(grouped)) {
|
||||||
console.debug(`Checking inclusion group '${key}' with ${group.length} entries`, group);
|
console.debug(`Checking inclusion group '${key}' with ${group.length} entries`, group);
|
||||||
|
|
||||||
if (!Array.isArray(group) || group.length <= 1) {
|
|
||||||
console.debug('Skipping inclusion group check, only one entry');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.from(allActivatedEntries).some(x => x.group === key)) {
|
if (Array.from(allActivatedEntries).some(x => x.group === key)) {
|
||||||
console.debug(`Skipping inclusion group check, group already activated '${key}'`);
|
console.debug(`Skipping inclusion group check, group already activated '${key}'`);
|
||||||
// We need to forcefully deactivate all other entries in the group
|
// We need to forcefully deactivate all other entries in the group
|
||||||
@ -2018,6 +2013,11 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Array.isArray(group) || group.length <= 1) {
|
||||||
|
console.debug('Skipping inclusion group check, only one entry');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Do weighted random using probability of entry as weight
|
// Do weighted random using probability of entry as weight
|
||||||
const totalWeight = group.reduce((acc, item) => acc + item.probability, 0);
|
const totalWeight = group.reduce((acc, item) => acc + item.probability, 0);
|
||||||
const rollValue = Math.random() * totalWeight;
|
const rollValue = Math.random() * totalWeight;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user