Pass global scan data to WI prompt generator
| @@ -3129,6 +3129,7 @@ export function baseChatReplace(value, name1, name2) { | |||
| 3129 | * @property {string} jailbreak Jailbreak instructions | 3129 | * @property {string} jailbreak Jailbreak instructions |
| 3130 | * @property {string} version Character version | 3130 | * @property {string} version Character version |
| 3131 | * @property {string} charDepthPrompt Character depth note | 3131 | * @property {string} charDepthPrompt Character depth note |
| 3132 | * @property {string} creatorNotes Character creator notes | ||
| 3132 | * @returns {CharacterCardFields} Character card fields | 3133 | * @returns {CharacterCardFields} Character card fields |
| 3133 | */ | 3134 | */ |
| 3134 | export function getCharacterCardFields({ chid = null } = {}) { | 3135 | export function getCharacterCardFields({ chid = null } = {}) { |
| @@ -3144,6 +3145,7 @@ export function getCharacterCardFields({ chid = null } = {}) { | |||
| 3144 | jailbreak: '', | 3145 | jailbreak: '', |
| 3145 | version: '', | 3146 | version: '', |
| 3146 | charDepthPrompt: '', | 3147 | charDepthPrompt: '', |
| 3148 | creatorNotes: '', | ||
| 3147 | }; | 3149 | }; |
| 3148 | result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2); | 3150 | result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2); |
| 3149 | 3151 | ||
| @@ -3162,6 +3164,7 @@ export function getCharacterCardFields({ chid = null } = {}) { | |||
| 3162 | result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : ''; | 3164 | result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : ''; |
| 3163 | result.version = character.data?.character_version ?? ''; | 3165 | result.version = character.data?.character_version ?? ''; |
| 3164 | result.charDepthPrompt = baseChatReplace(character.data?.extensions?.depth_prompt?.prompt?.trim(), name1, name2); | 3166 | result.charDepthPrompt = baseChatReplace(character.data?.extensions?.depth_prompt?.prompt?.trim(), name1, name2); |
| 3167 | result.creatorNotes = baseChatReplace(character.creator_notes?.trim(), name1, name2); | ||
| 3165 | 3168 | ||
| 3166 | if (selected_group) { | 3169 | if (selected_group) { |
| 3167 | const groupCards = getGroupCharacterCards(selected_group, Number(currentChid)); | 3170 | const groupCards = getGroupCharacterCards(selected_group, Number(currentChid)); |
| @@ -3989,6 +3992,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 3989 | system, | 3992 | system, |
| 3990 | jailbreak, | 3993 | jailbreak, |
| 3991 | charDepthPrompt, | 3994 | charDepthPrompt, |
| 3995 | creatorNotes, | ||
| 3992 | } = getCharacterCardFields(); | 3996 | } = getCharacterCardFields(); |
| 3993 | 3997 | ||
| 3994 | if (main_api !== 'openai') { | 3998 | if (main_api !== 'openai') { |
| @@ -4143,8 +4147,15 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 4143 | // Make quiet prompt available for WIAN | 4147 | // Make quiet prompt available for WIAN |
| 4144 | setExtensionPrompt('QUIET_PROMPT', quiet_prompt || '', extension_prompt_types.IN_PROMPT, 0, true); | 4148 | setExtensionPrompt('QUIET_PROMPT', quiet_prompt || '', extension_prompt_types.IN_PROMPT, 0, true); |
| 4145 | const chatForWI = coreChat.map(x => world_info_include_names ? `${x.name}: ${x.mes}` : x.mes).reverse(); | 4149 | 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); | ||
| 4148 | setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true); | 4159 | setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true); |
| 4149 | 4160 | ||
| 4150 | // Add message example WI | 4161 | // Add message example WI |