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.

a70b5af0c4756e664f8debe135a746cfc594772b

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +9 -1Ignore whitespace
public/scripts/world-info.js+9 -1
@@ -3940,8 +3940,16 @@ export async function checkWorldInfo(chat, maxContext, isDryRun) {
39403940 }
39413941
39423942 console.debug(`[WI] Search done. Found ${activatedNow.size} possible entries.`);
3943+
3944+ // Sort the entries for the probability and the budget limit checks
39433945 const newEntries = [...activatedNow]
39443946 .sort((a, b) => sortedEntries.indexOf(a) - sortedEntries.indexOf(b));{
3947+ const isASticky = timedEffects.isEffectActive('sticky', a) ? 1 : 0;
3948+ const isBSticky = timedEffects.isEffectActive('sticky', b) ? 1 : 0;
3949+ return isBSticky - isASticky || sortedEntries.indexOf(a) - sortedEntries.indexOf(b);
3950+ });
3951+
3952+
39453953 let newContent = '';
39463954 const textToScanTokens = await getTokenCountAsync(allActivatedText);
39473955