mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-12 17:36:22 +01:00
Merge pull request #2766 from SillyTavern/wi-prefer-sticky-on-budget
Prefer stickied WI for budget-limited cases
This commit is contained in:
commit
a2710b70c1
@ -3940,8 +3940,16 @@ export async function checkWorldInfo(chat, maxContext, isDryRun) {
|
||||
}
|
||||
|
||||
console.debug(`[WI] Search done. Found ${activatedNow.size} possible entries.`);
|
||||
|
||||
// Sort the entries for the probability and the budget limit checks
|
||||
const newEntries = [...activatedNow]
|
||||
.sort((a, b) => sortedEntries.indexOf(a) - sortedEntries.indexOf(b));
|
||||
.sort((a, b) => {
|
||||
const isASticky = timedEffects.isEffectActive('sticky', a) ? 1 : 0;
|
||||
const isBSticky = timedEffects.isEffectActive('sticky', b) ? 1 : 0;
|
||||
return isBSticky - isASticky || sortedEntries.indexOf(a) - sortedEntries.indexOf(b);
|
||||
});
|
||||
|
||||
|
||||
let newContent = '';
|
||||
const textToScanTokens = await getTokenCountAsync(allActivatedText);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user