Pass global scan data to WI prompt generator

a261e87d4cab1c56bd02c6c5134cf680c47d9c13

Crow <bismuthglass@protonmail.com>

1 files changed, +13 -2Ignore whitespace
public/script.js+13 -2
@@ -3129,6 +3129,7 @@ export function baseChatReplace(value, name1, name2) {
31293129 * @property {string} jailbreak Jailbreak instructions
31303130 * @property {string} version Character version
31313131 * @property {string} charDepthPrompt Character depth note
3132+ * @property {string} creatorNotes Character creator notes
31323133 * @returns {CharacterCardFields} Character card fields
31333134 */
31343135export function getCharacterCardFields({ chid = null } = {}) {
@@ -3144,6 +3145,7 @@ export function getCharacterCardFields({ chid = null } = {}) {
31443145 jailbreak: '',
31453146 version: '',
31463147 charDepthPrompt: '',
3148+ creatorNotes: '',
31473149 };
31483150 result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2);
31493151
@@ -3162,6 +3164,7 @@ export function getCharacterCardFields({ chid = null } = {}) {
31623164 result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : '';
31633165 result.version = character.data?.character_version ?? '';
31643166 result.charDepthPrompt = baseChatReplace(character.data?.extensions?.depth_prompt?.prompt?.trim(), name1, name2);
3167+ result.creatorNotes = baseChatReplace(character.creator_notes?.trim(), name1, name2);
31653168
31663169 if (selected_group) {
31673170 const groupCards = getGroupCharacterCards(selected_group, Number(currentChid));
@@ -3989,6 +3992,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
39893992 system,
39903993 jailbreak,
39913994 charDepthPrompt,
3995+ creatorNotes,
39923996 } = getCharacterCardFields();
39933997
39943998 if (main_api !== 'openai') {
@@ -4143,8 +4147,15 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
41434147 // Make quiet prompt available for WIAN
41444148 setExtensionPrompt('QUIET_PROMPT', quiet_prompt || '', extension_prompt_types.IN_PROMPT, 0, true);
41454149 const chatForWI = coreChat.map(x => world_info_include_names ? `${x.name}: ${x.mes}` : x.mes).reverse();
4146- // TODO: Build globalScanData
4150+ const globalScanData = {
4147- const { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(null, chatForWI, this_max_context, dryRun);
4151+ personaDescription: persona,
4152+ characterDescription: description,
4153+ characterPersonality: personality,
4154+ characterDepthPrompt: charDepthPrompt,
4155+ scenario: scenario,
4156+ creatorNotes: creatorNotes,
4157+ };
4158+ const { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(globalScanData, chatForWI, this_max_context, dryRun);
41484159 setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true);
41494160
41504161 // Add message example WI