Add WI prefix to timed effect logs
| @@ -223,12 +223,12 @@ class WorldInfoBuffer { | ||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (depth < 0) { |
| 226 | 226 | console.error(`[WI] Invalid WI scan depth ${depth}. Must be >= 0`); |
| 227 | 227 | return ''; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if (depth > MAX_SCAN_DEPTH) { |
| 231 | 231 | console.warn(`[WI] Invalid WI scan depth ${depth}. Truncating to ${MAX_SCAN_DEPTH}`); |
| 232 | 232 | depth = MAX_SCAN_DEPTH; |
| 233 | 233 | } |
| 234 | 234 | |
| @@ -445,7 +445,7 @@ class WorldInfoTimedEffects { | ||
| 445 | 445 | const key = this.#getEntryKey(entry); |
| 446 | 446 | const effect = this.#getEntryTimedEffect('cooldown', entry, true); |
| 447 | 447 | chat_metadata.timedWorldInfo.cooldown[key] = effect; |
| 448 | 448 | console.log(`[WI] Adding cooldown entry ${key} on ended sticky: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); |
| 449 | 449 | // Set the cooldown immediately for this evaluation |
| 450 | 450 | this.#buffer.cooldown.push(entry); |
| 451 | 451 | }, |
| @@ -456,7 +456,7 @@ class WorldInfoTimedEffects { | ||
| 456 | 456 | * @param {WIScanEntry} entry Entry that ended cooldown |
| 457 | 457 | */ |
| 458 | 458 | 'cooldown': (entry) => { |
| 459 | 459 | console.debug('[WI] Cooldown ended for entry', entry.uid); |
| 460 | 460 | }, |
| 461 | 461 | |
| 462 | 462 | 'delay': () => { }, |
| @@ -546,11 +546,11 @@ class WorldInfoTimedEffects { | ||
| 546 | 546 | /** @type {[string, WITimedEffect][]} */ |
| 547 | 547 | const effects = Object.entries(chat_metadata.timedWorldInfo[type]); |
| 548 | 548 | for (const [key, value] of effects) { |
| 549 | 549 | console.log(`[WI] Processing ${type} entry ${key}`, value); |
| 550 | 550 | const entry = this.#entries.find(x => String(this.#getEntryHash(x)) === String(value.hash)); |
| 551 | 551 | |
| 552 | 552 | if (this.#chat.length <= Number(value.start) && !value.protected) { |
| 553 | 553 | console.log(`[WI] Removing ${type} entry ${key} from timedWorldInfo: chat not advanced`, value); |
| 554 | 554 | delete chat_metadata.timedWorldInfo[type][key]; |
| 555 | 555 | continue; |
| 556 | 556 | } |
| @@ -558,7 +558,7 @@ class WorldInfoTimedEffects { | ||
| 558 | 558 | // Missing entries (they could be from another character's lorebook) |
| 559 | 559 | if (!entry) { |
| 560 | 560 | if (this.#chat.length >= Number(value.end)) { |
| 561 | 561 | console.log(`[WI] Removing ${type} entry from timedWorldInfo: entry not found and interval passed`, entry); |
| 562 | 562 | delete chat_metadata.timedWorldInfo[type][key]; |
| 563 | 563 | } |
| 564 | 564 | continue; |
| @@ -566,13 +566,13 @@ class WorldInfoTimedEffects { | ||
| 566 | 566 | |
| 567 | 567 | // Ignore invalid entries (not configured for timed effects) |
| 568 | 568 | if (!entry[type]) { |
| 569 | 569 | console.log(`[WI] Removing ${type} entry from timedWorldInfo: entry not ${type}`, entry); |
| 570 | 570 | delete chat_metadata.timedWorldInfo[type][key]; |
| 571 | 571 | continue; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | if (this.#chat.length >= Number(value.end)) { |
| 575 | 575 | console.log(`[WI] Removing ${type} entry from timedWorldInfo: ${type} interval passed`, entry); |
| 576 | 576 | delete chat_metadata.timedWorldInfo[type][key]; |
| 577 | 577 | if (typeof onEnded === 'function') { |
| 578 | 578 | onEnded(entry); |
| @@ -581,7 +581,7 @@ class WorldInfoTimedEffects { | ||
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | buffer.push(entry); |
| 584 | 584 | console.log(`[WI] Timed effect "${type}" applied to entry`, entry); |
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | 587 | |
| @@ -597,7 +597,7 @@ class WorldInfoTimedEffects { | ||
| 597 | 597 | |
| 598 | 598 | if (this.#chat.length < entry.delay) { |
| 599 | 599 | buffer.push(entry); |
| 600 | 600 | console.log('[WI] Timed effect "delay" applied to entry', entry); |
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 | |
| @@ -644,7 +644,7 @@ class WorldInfoTimedEffects { | ||
| 644 | 644 | const effect = this.#getEntryTimedEffect(type, entry, false); |
| 645 | 645 | chat_metadata.timedWorldInfo[type][key] = effect; |
| 646 | 646 | |
| 647 | 647 | console.log(`[WI] Adding ${type} entry ${key}: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); |
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |
| @@ -676,7 +676,7 @@ class WorldInfoTimedEffects { | ||
| 676 | 676 | if (newState) { |
| 677 | 677 | const effect = this.#getEntryTimedEffect(type, entry, false); |
| 678 | 678 | chat_metadata.timedWorldInfo[type][key] = effect; |
| 679 | 679 | console.log(`[WI] Adding ${type} entry ${key}: start=${effect.start}, end=${effect.end}, protected=${effect.protected}`); |
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | 682 | |
| @@ -3847,7 +3847,7 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { | ||
| 3847 | 3847 | } |
| 3848 | 3848 | |
| 3849 | 3849 | allActivatedEntries.add(entry); |
| 3850 | 3850 | console.debug(`[WI] entryEntry ${entry.uid} activation successful, adding to prompt`, entry); |
| 3851 | 3851 | } |
| 3852 | 3852 | |
| 3853 | 3853 | const successfulNewEntries = newEntries.filter(x => !failedProbabilityChecks.has(x)); |
| @@ -3858,7 +3858,7 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { | ||
| 3858 | 3858 | } else if (!successfulNewEntries.length) { |
| 3859 | 3859 | console.debug('[WI] Probability checks failed for all activated entries, stopping'); |
| 3860 | 3860 | } else { |
| 3861 | 3861 | console.debug(`[WI] SucessfullySuccessfully activated ${successfulNewEntries.length} new entries to prompt. ${allActivatedEntries.size} total entries activated.`, successfulNewEntries); |
| 3862 | 3862 | } |
| 3863 | 3863 | |
| 3864 | 3864 | // After processing and rolling entries is done, see if we should continue with normal recursion |