mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
also run regex on worldinfo
This commit is contained in:
committed by
steve02081504
parent
10fda0b220
commit
d2477bba0c
@ -97,6 +97,12 @@
|
|||||||
<span data-i18n="Slash Commands">Slash Commands</span>
|
<span data-i18n="Slash Commands">Slash Commands</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="checkbox flex-container">
|
||||||
|
<input type="checkbox" name="replace_position" value="5">
|
||||||
|
<span data-i18n="WIAN">WIAN</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="flex-container wide100p marginTop5">
|
<div class="flex-container wide100p marginTop5">
|
||||||
<div class="flex1 flex-container flexNoGap">
|
<div class="flex1 flex-container flexNoGap">
|
||||||
<small data-i18n="[title]ext_regex_min_depth_desc" title="When applied to prompts or display, only affect messages that are at least N levels deep. 0 = last message, 1 = penultimate message, etc. Only counts usable messages, i.e. not hidden or system.">
|
<small data-i18n="[title]ext_regex_min_depth_desc" title="When applied to prompts or display, only affect messages that are at least N levels deep. 0 = last message, 1 = penultimate message, etc. Only counts usable messages, i.e. not hidden or system.">
|
||||||
|
@ -17,6 +17,8 @@ const regex_placement = {
|
|||||||
USER_INPUT: 1,
|
USER_INPUT: 1,
|
||||||
AI_OUTPUT: 2,
|
AI_OUTPUT: 2,
|
||||||
SLASH_COMMAND: 3,
|
SLASH_COMMAND: 3,
|
||||||
|
// 4 - sendAs (legacy)
|
||||||
|
WAIN: 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,7 @@ import { power_user } from './power-user.js';
|
|||||||
import { getTagKeyForEntity } from './tags.js';
|
import { getTagKeyForEntity } from './tags.js';
|
||||||
import { resolveVariable } from './variables.js';
|
import { resolveVariable } from './variables.js';
|
||||||
import { debounce_timeout } from './constants.js';
|
import { debounce_timeout } from './constants.js';
|
||||||
|
import { getRegexedString, regex_placement } from './extensions/regex/engine.js';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
world_info,
|
world_info,
|
||||||
@ -2571,8 +2572,8 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const worldInfoBefore = WIBeforeEntries.length ? WIBeforeEntries.join('\n') : '';
|
var worldInfoBefore = WIBeforeEntries.length ? WIBeforeEntries.join('\n') : '';
|
||||||
const worldInfoAfter = WIAfterEntries.length ? WIAfterEntries.join('\n') : '';
|
var worldInfoAfter = WIAfterEntries.length ? WIAfterEntries.join('\n') : '';
|
||||||
|
|
||||||
if (shouldWIAddPrompt) {
|
if (shouldWIAddPrompt) {
|
||||||
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
|
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
|
||||||
@ -2582,6 +2583,14 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
|
|
||||||
buffer.cleanExternalActivations();
|
buffer.cleanExternalActivations();
|
||||||
|
|
||||||
|
{
|
||||||
|
let regexType = regex_placement.WAIN;
|
||||||
|
let options = { isPrompt: true, depth: 0 };
|
||||||
|
|
||||||
|
worldInfoAfter = getRegexedString(worldInfoAfter, regexType, options);
|
||||||
|
worldInfoBefore = getRegexedString(worldInfoBefore, regexType, options);
|
||||||
|
}
|
||||||
|
|
||||||
return { worldInfoBefore, worldInfoAfter, EMEntries, WIDepthEntries, allActivatedEntries };
|
return { worldInfoBefore, worldInfoAfter, EMEntries, WIDepthEntries, allActivatedEntries };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user