Run eslint

3fb83e47ecc616b4557d737a9ac77197898ee7cd

Cohee <18619528+Cohee1207@users.noreply.github.com>

4 files changed, +29 -29Ignore whitespace
public/scripts/macros.js+1 -1
@@ -464,7 +464,7 @@ export function evaluateMacros(content, env) {
464464 content = content.replace(/{{firstIncludedMessageId}}/gi, () => String(getFirstIncludedMessageId() ?? ''));
465465 content = content.replace(/{{lastSwipeId}}/gi, () => String(getLastSwipeId() ?? ''));
466466 content = content.replace(/{{currentSwipeId}}/gi, () => String(getCurrentSwipeId() ?? ''));
467467 content = content.replace(/{{reverse\:(.+?)}}/gi, (_, str) => Array.from(str).reverse().join(''));
468468
469469 content = content.replace(/\{\{\/\/([\s\S]*?)\}\}/gm, '');
470470
public/scripts/world-info.js+24 -24
@@ -108,7 +108,7 @@ const METADATA_KEY = 'world_info';
108108const DEFAULT_DEPTH = 4;
109109const DEFAULT_WEIGHT = 100;
110110const MAX_SCAN_DEPTH = 1000;
111111const KNOWN_DECORATORS = ['@@activate', '@@dont_activate'];
112112
113113// Typedef area
114114/**
@@ -3538,53 +3538,53 @@ export async function getSortedEntries() {
35383538 * @param {string} content The content to parse
35393539 * @returns {[string[],string]} The decorators found in the content and the content without decorators
35403540*/
35413541function parseDecorators(content) {
35423542 /**
35433543 * Check if the decorator is known
35443544 * @param {string} data string to check
35453545 * @returns {boolean} true if the decorator is known
35463546 */
35473547 const isKnownDecorator = (data) => {
35483548 if (data.startsWith('@@@')) {
35493549 data = data.substring(1);
35503550 }
35513551
35523552 for (let i = 0; i < KNOWN_DECORATORS.length; i++) {
35533553 if (data.startsWith(KNOWN_DECORATORS[i])) {
35543554 return true;
35553555 }
35563556 }
35573557 return false;
35583558 };
35593559
35603560 if (content.startsWith('@@')) {
35613561 let newContent = content;
35623562 const splited = content.split('\n');
35633563 let decorators = [];
35643564 let fallbacked = false;
35653565
35663566 for (let i = 0; i < splited.length; i++) {
35673567 if (splited[i].startsWith('@@')) {
35683568 if (splited[i].startsWith('@@@') && !fallbacked) {
35693569 continue;
35703570 }
35713571
35723572 if (isKnownDecorator(splited[i])) {
35733573 decorators.push(splited[i].startsWith('@@@') ? splited[i].substring(1) : splited[i]);
35743574 fallbacked = false;
35753575 }
35763576 else {
35773577 fallbacked = true;
35783578 }
35793579 } else {
35803580 newContent = splited.slice(i).join('\n');
35813581 break;
35823582 }
35833583 }
35843584 return [decorators, newContent];
35853585 }
35863586
35873587 return [[], content];
35883588
35893589}
35903590
@@ -3714,17 +3714,17 @@ async function checkWorldInfo(chat, maxContext, isDryRun) {
37143714 continue;
37153715 }
37163716
37173717 if (decorators.includes('@@activate')) {
37183718 //activate in any case
37193719 activatedNow.add(entry);
37203720 continue;
37213721 }
37223722
37233723 if (decorators.includes('@@dont_activate')) {
37243724 //deactivate in any case if @@activate is not present
37253725 continue;
37263726 }
3727-
3727+
37283728 if (entry.constant || buffer.isExternallyActivated(entry) || isSticky) {
37293729 activatedNow.add(entry);
37303730 continue;
src/character-card-parser.js+3 -3
@@ -31,12 +31,12 @@ const write = (image, data) => {
3131 try {
3232 //change v2 format to v3
3333 const v3Data = JSON.parse(data);
3434 v3Data.spec = 'chara_card_v3';
3535 v3Data.spec_version = '3.0';
3636
3737 const base64EncodedData = Buffer.from(JSON.stringify(v3Data), 'utf8').toString('base64');
3838 chunks.splice(-1, 0, PNGtext.encode('ccv3', base64EncodedData));
3939 } catch (error) { }
4040
4141 const newBuffer = Buffer.from(encode(chunks));
4242 return newBuffer;
src/endpoints/characters.js+1 -1
@@ -409,7 +409,7 @@ function charaFormatData(data, directories) {
409409 //_.set(char, 'data.extensions.chat', data.ch_name + ' - ' + humanizedISO8601DateTime());
410410
411411 // V3 fields
412412 _.set(char, 'data.group_only_greetings', data.group_only_greetings ?? []);
413413
414414 if (data.world) {
415415 try {