Move new globalScanData args to the end
| @@ -4155,7 +4155,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 4155 | 4155 | scenario: scenario, |
| 4156 | 4156 | creatorNotes: creatorNotes, |
| 4157 | 4157 | }; |
| 4158 | 4158 | const { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(globalScanData, chatForWI, this_max_context, dryRun, globalScanData); |
| 4159 | 4159 | setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true); |
| 4160 | 4160 | |
| 4161 | 4161 | // Add message example WI |
| @@ -187,10 +187,10 @@ class WorldInfoBuffer { | ||
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * Initialize the buffer with the given messages. |
| 190 | - * @param {WIGlobalScanData} globalScanData Chat independent context to be scanned | |
| 191 | 190 | * @param {string[]} messages Array of messages to add to the buffer |
| 191 | + * @param {WIGlobalScanData} globalScanData Chat independent context to be scanned | |
| 192 | 192 | */ |
| 193 | 193 | constructor(globalScanDatamessages, messagesglobalScanData) { |
| 194 | 194 | this.#initDepthBuffer(messages); |
| 195 | 195 | this.#globalScanDataBuffer = globalScanData; |
| 196 | 196 | } |
| @@ -796,10 +796,10 @@ export const worldInfoCache = new StructuredCloneMap({ cloneOnGet: true, cloneOn | ||
| 796 | 796 | |
| 797 | 797 | /** |
| 798 | 798 | * Gets the world info based on chat messages. |
| 799 | - * @param {WIGlobalScanData} globalScanData Chat independent context to be scanned | |
| 800 | 799 | * @param {string[]} chat - The chat messages to scan, in reverse order. |
| 801 | 800 | * @param {number} maxContext - The maximum context size of the generation. |
| 802 | 801 | * @param {boolean} isDryRun - If true, the function will not emit any events. |
| 802 | + * @param {WIGlobalScanData} globalScanData Chat independent context to be scanned | |
| 803 | 803 | * @typedef {object} WIPromptResult |
| 804 | 804 | * @property {string} worldInfoString - Complete world info string |
| 805 | 805 | * @property {string} worldInfoBefore - World info that goes before the prompt |
| @@ -810,10 +810,10 @@ export const worldInfoCache = new StructuredCloneMap({ cloneOnGet: true, cloneOn | ||
| 810 | 810 | * @property {Array} anAfter - Array of entries after Author's Note |
| 811 | 811 | * @returns {Promise<WIPromptResult>} The world info string and depth. |
| 812 | 812 | */ |
| 813 | 813 | export async function getWorldInfoPrompt(globalScanData, chat, maxContext, isDryRun, globalScanData) { |
| 814 | 814 | let worldInfoString = '', worldInfoBefore = '', worldInfoAfter = ''; |
| 815 | 815 | |
| 816 | 816 | const activatedWorldInfo = await checkWorldInfo(globalScanData, chat, maxContext, isDryRun, globalScanData); |
| 817 | 817 | worldInfoBefore = activatedWorldInfo.worldInfoBefore; |
| 818 | 818 | worldInfoAfter = activatedWorldInfo.worldInfoAfter; |
| 819 | 819 | worldInfoString = worldInfoBefore + worldInfoAfter; |
| @@ -4053,10 +4053,10 @@ function parseDecorators(content) { | ||
| 4053 | 4053 | |
| 4054 | 4054 | /** |
| 4055 | 4055 | * Performs a scan on the chat and returns the world info activated. |
| 4056 | - * @param {WIGlobalScanData} globalScanData Chat independent context to be scanned | |
| 4057 | 4056 | * @param {string[]} chat The chat messages to scan, in reverse order. |
| 4058 | 4057 | * @param {number} maxContext The maximum context size of the generation. |
| 4059 | 4058 | * @param {boolean} isDryRun Whether to perform a dry run. |
| 4059 | + * @param {WIGlobalScanData} globalScanData Chat independent context to be scanned | |
| 4060 | 4060 | * @typedef {object} WIActivated |
| 4061 | 4061 | * @property {string} worldInfoBefore The world info before the chat. |
| 4062 | 4062 | * @property {string} worldInfoAfter The world info after the chat. |
| @@ -4067,9 +4067,9 @@ function parseDecorators(content) { | ||
| 4067 | 4067 | * @property {Set<any>} allActivatedEntries All entries. |
| 4068 | 4068 | * @returns {Promise<WIActivated>} The world info activated. |
| 4069 | 4069 | */ |
| 4070 | 4070 | export async function checkWorldInfo(globalScanData, chat, maxContext, isDryRun, globalScanData) { |
| 4071 | 4071 | const context = getContext(); |
| 4072 | 4072 | const buffer = new WorldInfoBuffer(globalScanDatachat, chatglobalScanData); |
| 4073 | 4073 | |
| 4074 | 4074 | console.debug(`[WI] --- START WI SCAN (on ${chat.length} messages)${isDryRun ? ' (DRY RUN)' : ''} ---`); |
| 4075 | 4075 | |