mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Pass global scan data to WI prompt generator
This commit is contained in:
@ -3129,6 +3129,7 @@ export function baseChatReplace(value, name1, name2) {
|
|||||||
* @property {string} jailbreak Jailbreak instructions
|
* @property {string} jailbreak Jailbreak instructions
|
||||||
* @property {string} version Character version
|
* @property {string} version Character version
|
||||||
* @property {string} charDepthPrompt Character depth note
|
* @property {string} charDepthPrompt Character depth note
|
||||||
|
* @property {string} creatorNotes Character creator notes
|
||||||
* @returns {CharacterCardFields} Character card fields
|
* @returns {CharacterCardFields} Character card fields
|
||||||
*/
|
*/
|
||||||
export function getCharacterCardFields({ chid = null } = {}) {
|
export function getCharacterCardFields({ chid = null } = {}) {
|
||||||
@ -3144,6 +3145,7 @@ export function getCharacterCardFields({ chid = null } = {}) {
|
|||||||
jailbreak: '',
|
jailbreak: '',
|
||||||
version: '',
|
version: '',
|
||||||
charDepthPrompt: '',
|
charDepthPrompt: '',
|
||||||
|
creatorNotes: '',
|
||||||
};
|
};
|
||||||
result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2);
|
result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2);
|
||||||
|
|
||||||
@ -3162,6 +3164,7 @@ export function getCharacterCardFields({ chid = null } = {}) {
|
|||||||
result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : '';
|
result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : '';
|
||||||
result.version = character.data?.character_version ?? '';
|
result.version = character.data?.character_version ?? '';
|
||||||
result.charDepthPrompt = baseChatReplace(character.data?.extensions?.depth_prompt?.prompt?.trim(), name1, name2);
|
result.charDepthPrompt = baseChatReplace(character.data?.extensions?.depth_prompt?.prompt?.trim(), name1, name2);
|
||||||
|
result.creatorNotes = baseChatReplace(character.creator_notes?.trim(), name1, name2);
|
||||||
|
|
||||||
if (selected_group) {
|
if (selected_group) {
|
||||||
const groupCards = getGroupCharacterCards(selected_group, Number(currentChid));
|
const groupCards = getGroupCharacterCards(selected_group, Number(currentChid));
|
||||||
@ -3989,6 +3992,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||||||
system,
|
system,
|
||||||
jailbreak,
|
jailbreak,
|
||||||
charDepthPrompt,
|
charDepthPrompt,
|
||||||
|
creatorNotes,
|
||||||
} = getCharacterCardFields();
|
} = getCharacterCardFields();
|
||||||
|
|
||||||
if (main_api !== 'openai') {
|
if (main_api !== 'openai') {
|
||||||
@ -4143,8 +4147,15 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||||||
// Make quiet prompt available for WIAN
|
// Make quiet prompt available for WIAN
|
||||||
setExtensionPrompt('QUIET_PROMPT', quiet_prompt || '', extension_prompt_types.IN_PROMPT, 0, true);
|
setExtensionPrompt('QUIET_PROMPT', quiet_prompt || '', extension_prompt_types.IN_PROMPT, 0, true);
|
||||||
const chatForWI = coreChat.map(x => world_info_include_names ? `${x.name}: ${x.mes}` : x.mes).reverse();
|
const chatForWI = coreChat.map(x => world_info_include_names ? `${x.name}: ${x.mes}` : x.mes).reverse();
|
||||||
// TODO: Build globalScanData
|
const globalScanData = {
|
||||||
const { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(null, chatForWI, this_max_context, dryRun);
|
personaDescription: persona,
|
||||||
|
characterDescription: description,
|
||||||
|
characterPersonality: personality,
|
||||||
|
characterDepthPrompt: charDepthPrompt,
|
||||||
|
scenario: scenario,
|
||||||
|
creatorNotes: creatorNotes,
|
||||||
|
};
|
||||||
|
const { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(globalScanData, chatForWI, this_max_context, dryRun);
|
||||||
setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true);
|
setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true);
|
||||||
|
|
||||||
// Add message example WI
|
// Add message example WI
|
||||||
|
Reference in New Issue
Block a user