#1630 Fix display mode regex depth calc

This commit is contained in:
Cohee 2024-01-25 02:53:39 +02:00
parent 422b41fcfa
commit 1ae5a8bd66
1 changed files with 2 additions and 1 deletions

View File

@ -1605,7 +1605,8 @@ function messageFormatting(mes, ch_name, isSystem, isUser, messageId) {
}
const usableMessages = chat.map((x, index) => ({ message: x, index: index })).filter(x => !x.message.is_system);
const depth = messageId >= 0 && usableMessages.some(x => x.index === messageId) ? (usableMessages.length - messageId - 1) : undefined;
const indexOf = usableMessages.findIndex(x => x.index === Number(messageId));
const depth = messageId >= 0 && indexOf !== -1 ? (usableMessages.length - indexOf - 1) : undefined;
// Always override the character name
mes = getRegexedString(mes, regexPlacement, {