mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #3889 from BismuthGlass/feature/wi_global_matches
World Info chat-independent data matching
This commit is contained in:
@ -2753,6 +2753,7 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
|
||||
environment.charVersion = fields.version || '';
|
||||
environment.char_version = fields.version || '';
|
||||
environment.charDepthPrompt = fields.charDepthPrompt || '';
|
||||
environment.creatorNotes = fields.creatorNotes || '';
|
||||
}
|
||||
|
||||
// Must be substituted last so that they're replaced inside {{description}}
|
||||
@ -3131,6 +3132,7 @@ export function baseChatReplace(value, name1, name2) {
|
||||
* @property {string} jailbreak Jailbreak instructions
|
||||
* @property {string} version Character version
|
||||
* @property {string} charDepthPrompt Character depth note
|
||||
* @property {string} creatorNotes Character creator notes
|
||||
* @returns {CharacterCardFields} Character card fields
|
||||
*/
|
||||
export function getCharacterCardFields({ chid = null } = {}) {
|
||||
@ -3146,6 +3148,7 @@ export function getCharacterCardFields({ chid = null } = {}) {
|
||||
jailbreak: '',
|
||||
version: '',
|
||||
charDepthPrompt: '',
|
||||
creatorNotes: '',
|
||||
};
|
||||
result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2);
|
||||
|
||||
@ -3164,6 +3167,7 @@ export function getCharacterCardFields({ chid = null } = {}) {
|
||||
result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : '';
|
||||
result.version = character.data?.character_version ?? '';
|
||||
result.charDepthPrompt = baseChatReplace(character.data?.extensions?.depth_prompt?.prompt?.trim(), name1, name2);
|
||||
result.creatorNotes = baseChatReplace(character.data?.creator_notes?.trim(), name1, name2);
|
||||
|
||||
if (selected_group) {
|
||||
const groupCards = getGroupCharacterCards(selected_group, Number(currentChid));
|
||||
@ -3991,6 +3995,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
system,
|
||||
jailbreak,
|
||||
charDepthPrompt,
|
||||
creatorNotes,
|
||||
} = getCharacterCardFields();
|
||||
|
||||
if (main_api !== 'openai') {
|
||||
@ -4145,7 +4150,15 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
// Make quiet prompt available for WIAN
|
||||
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 { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(chatForWI, this_max_context, dryRun);
|
||||
const globalScanData = {
|
||||
personaDescription: persona,
|
||||
characterDescription: description,
|
||||
characterPersonality: personality,
|
||||
characterDepthPrompt: charDepthPrompt,
|
||||
scenario: scenario,
|
||||
creatorNotes: creatorNotes,
|
||||
};
|
||||
const { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(chatForWI, this_max_context, dryRun, globalScanData);
|
||||
setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true);
|
||||
|
||||
// Add message example WI
|
||||
|
Reference in New Issue
Block a user