Better WI type readability, fixed clone and type opeators.

8dc66bd21b1697ddddc7709ac733b6c8a81e2081

bmen25124 <bmen25124@gmail.com>

3 files changed, +21 -7Showing whitespace changes
public/scripts/openai.js+1 -1
@@ -710,7 +710,7 @@ export function formatWorldInfo(value, { wiFormat = null } = {}) {
710710 return '';
711711 }
712712
713713 const format = wiFormat ||?? oai_settings.wi_format;
714714
715715 if (!format.trim()) {
716716 return value;
public/scripts/power-user.js+1 -1
@@ -1992,7 +1992,7 @@ export function fuzzySearchGroups(searchValue, fuzzySearchCaches = null) {
19921992 */
19931993export function renderStoryString(params, { customStoryString = null, customInstructSettings = null } = {}) {
19941994 try {
19951995 const storyString = structuredClone(customStoryString ?? power_user.context.story_string);
19961996 const instructSettings = customInstructSettings ?? power_user.instruct;
19971997
19981998 // Validate and log possible warnings/errors
public/scripts/world-info.js+19 -5
@@ -753,10 +753,17 @@ export const worldInfoCache = new StructuredCloneMap({ cloneOnGet: true, cloneOn
753753
754754/**
755755 * Gets the world info based on chat messages.
756756 * @param {string[]} chat - The chat messages to scan, in reverse order.
757757 * @param {number} maxContext - The maximum context size of the generation.
758758 * @param {boolean} isDryRun - If true, the function will not emit any events.
759- * @typedef {{worldInfoString: string, worldInfoBefore: string, worldInfoAfter: string, worldInfoExamples: any[], worldInfoDepth: any[], anBefore: any[], anAfter: any[]}} WIPromptResult
759+ * @typedef {object} WIPromptResult
760+ * @property {string} worldInfoString - Complete world info string
761+ * @property {string} worldInfoBefore - World info that goes before the prompt
762+ * @property {string} worldInfoAfter - World info that goes after the prompt
763+ * @property {Array} worldInfoExamples - Array of example entries
764+ * @property {Array} worldInfoDepth - Array of depth entries
765+ * @property {Array} anBefore - Array of entries before Author's Note
766+ * @property {Array} anAfter - Array of entries after Author's Note
760767 * @returns {Promise<WIPromptResult>} The world info string and depth.
761768 */
762769export async function getWorldInfoPrompt(chat, maxContext, isDryRun) {
@@ -3864,7 +3871,14 @@ function parseDecorators(content) {
38643871 * @param {string[]} chat The chat messages to scan, in reverse order.
38653872 * @param {number} maxContext The maximum context size of the generation.
38663873 * @param {boolean} isDryRun Whether to perform a dry run.
3867- * @typedef {{ worldInfoBefore: string, worldInfoAfter: string, EMEntries: any[], WIDepthEntries: any[], ANBeforeEntries: any[], ANAfterEntries: any[], allActivatedEntries: Set<any> }} WIActivated
3874+ * @typedef {object} WIActivated
3875+ * @property {string} worldInfoBefore The world info before the chat.
3876+ * @property {string} worldInfoAfter The world info after the chat.
3877+ * @property {any[]} EMEntries The entries for examples.
3878+ * @property {any[]} WIDepthEntries The depth entries.
3879+ * @property {any[]} ANBeforeEntries The entries before Author's Note.
3880+ * @property {any[]} ANAfterEntries The entries after Author's Note.
3881+ * @property {Set<any>} allActivatedEntries All entries.
38683882 * @returns {Promise<WIActivated>} The world info activated.
38693883 */
38703884export async function checkWorldInfo(chat, maxContext, isDryRun) {