Prefer stickied WI for budget-limited cases
- Instead of processing entries by default sorting (based on order and books (char first, etc)), sticky will now be the first to process. This will make sure that stickied entries will reach the prompt, even in budget-limited scenarios.
This commit is contained in:
parent
4bc1943439
commit
a70b5af0c4
|
@ -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