mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Summary plugin improvements: In-chat position, customizable template, force insert after X words
This commit is contained in:
@ -470,6 +470,20 @@ export function getCharaFilename(chid) {
|
||||
}
|
||||
}
|
||||
|
||||
export function extractAllWords(value) {
|
||||
const words = [];
|
||||
|
||||
if (!value) {
|
||||
return words;
|
||||
}
|
||||
|
||||
const matches = value.matchAll(/\b\w+\b/gim);
|
||||
for (let match of matches) {
|
||||
words.push(match[0].toLowerCase());
|
||||
}
|
||||
return words;
|
||||
}
|
||||
|
||||
export function escapeRegex(string) {
|
||||
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
|
Reference in New Issue
Block a user