diff --git a/public/script.js b/public/script.js index 02d7dfa3a..01e2f265b 100644 --- a/public/script.js +++ b/public/script.js @@ -784,7 +784,10 @@ function messageFormating(mes, ch_name, isSystem, forceAvatar) { .replace(/\n/g, "
"); } else if (!isSystem) { mes = converter.makeHtml(mes); - mes = mes.replace(/{.*}/g, ""); + //mes = mes.replace(/{.*}/g, ""); + mes = mes.replace(/{{(\*?.+?\*?)}}/g, ""); + + mes = mes.replace(/\n/g, "
"); mes = mes.trim(); @@ -971,7 +974,8 @@ function extractMessageBias(message) { } const found = []; - const rxp = /{([^}]+)}/g; + const rxp = /{{(\*?.+?\*?)}}/g; + //const rxp = /{([^}]+)}/g; let curMatch; while ((curMatch = rxp.exec(message))) { @@ -1261,7 +1265,8 @@ async function Generate(type, automatic_trigger, force_name2) {//encode("dsfs"). } // replace bias markup - chat2[i] = (chat2[i] ?? '').replace(/{.*}/g, ''); + //chat2[i] = (chat2[i] ?? '').replace(/{.*}/g, ''); + chat2[i] = (chat2[i] ?? '').replace(/{{(\*?.+?\*?)}}/g, ''); //console.log('replacing chat2 {}s'); j++; } diff --git a/public/scripts/openai.js b/public/scripts/openai.js index cbd45a23e..68e846d3b 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -108,7 +108,8 @@ function setOpenAIMessages(chat) { } // replace bias markup - content = (content ?? '').replace(/{.*}/g, ''); + //content = (content ?? '').replace(/{.*}/g, ''); + content = (content ?? '').replace(/{{(\*?.+?\*?)}}/g, ''); // Apply the "wrap in quotes" option if (role == 'user' && oai_settings.wrap_in_quotes) content = `"${content}"`;