Move new globalScanData args to the end

6ddd395211f230e99c26f7946e1a7bfe9c6d741e

Crow <bismuthglass@protonmail.com>

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