mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
#606 Support multiline curly bias
This commit is contained in:
@ -1086,7 +1086,7 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
|
|||||||
mes = mes.replaceAll('\\begin{align*}', '$$');
|
mes = mes.replaceAll('\\begin{align*}', '$$');
|
||||||
mes = mes.replaceAll('\\end{align*}', '$$');
|
mes = mes.replaceAll('\\end{align*}', '$$');
|
||||||
mes = converter.makeHtml(mes);
|
mes = converter.makeHtml(mes);
|
||||||
mes = mes.replace(/{{(\*?.*\*?)}}/g, "");
|
mes = replaceBiasMarkup(mes);
|
||||||
|
|
||||||
mes = mes.replace(/<code(.*)>[\s\S]*?<\/code>/g, function (match) {
|
mes = mes.replace(/<code(.*)>[\s\S]*?<\/code>/g, function (match) {
|
||||||
// Firefox creates extra newlines from <br>s in code blocks, so we replace them before converting newlines to <br>s.
|
// Firefox creates extra newlines from <br>s in code blocks, so we replace them before converting newlines to <br>s.
|
||||||
@ -1101,10 +1101,12 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Hides bias from empty messages send with slash commands
|
// Hides bias from empty messages send with slash commands
|
||||||
if (isSystem) {
|
if (isSystem) {
|
||||||
mes = mes.replace(/{{(\*?.*\*?)}}/g, "");
|
mes = mes.replace(/\{\{[\s\S]*?\}\}/gm, "");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (!power_user.allow_name2_display && ch_name && !isUser && !isSystem) {
|
if (!power_user.allow_name2_display && ch_name && !isUser && !isSystem) {
|
||||||
mes = mes.replaceAll(`${ch_name}:`, "");
|
mes = mes.replaceAll(`${ch_name}:`, "");
|
||||||
@ -1534,7 +1536,7 @@ export function extractMessageBias(message) {
|
|||||||
|
|
||||||
const forbiddenMatches = ['user', 'char', 'time', 'date'];
|
const forbiddenMatches = ['user', 'char', 'time', 'date'];
|
||||||
const found = [];
|
const found = [];
|
||||||
const rxp = /\{\{(.+?)\}\}/g;
|
const rxp = /\{\{([\s\S]+?)\}\}/gm;
|
||||||
//const rxp = /{([^}]+)}/g;
|
//const rxp = /{([^}]+)}/g;
|
||||||
let curMatch;
|
let curMatch;
|
||||||
|
|
||||||
@ -2741,7 +2743,7 @@ function formatMessageHistoryItem(chatItem, isInstruct) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function replaceBiasMarkup(str) {
|
export function replaceBiasMarkup(str) {
|
||||||
return (str ?? '').replace(/{{(\*?.*\*?)}}/g, '');
|
return (str ?? '').replace(/\{\{[\s\S]*?\}\}/gm, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sendMessageAsUser(textareaText, messageBias) {
|
export async function sendMessageAsUser(textareaText, messageBias) {
|
||||||
|
@ -193,7 +193,7 @@ table.responsiveTable {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mes_text br {
|
.mes_text br, .mes_bias br {
|
||||||
content: ' ';
|
content: ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5001,4 +5001,4 @@ body.waifuMode .zoomed_avatar {
|
|||||||
background-color: var(--SmartThemeBlurTintColor);
|
background-color: var(--SmartThemeBlurTintColor);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 14px;
|
line-height: 14px;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user