Don't replace well-know substitution marcos with bias. Support macros in sys and sendas messages.

This commit is contained in:
Cohee
2023-06-09 02:50:35 +03:00
parent c4a2809849
commit 3f79a066f6
2 changed files with 13 additions and 5 deletions

View File

@ -1467,13 +1467,20 @@ export function extractMessageBias(message) {
return null;
}
const forbiddenMatches = ['user', 'char', 'time', 'date'];
const found = [];
const rxp = /{{(\*?.+\*?)}}/g;
const rxp = /\{\{(.+?)\}\}/g;
//const rxp = /{([^}]+)}/g;
let curMatch;
while ((curMatch = rxp.exec(message))) {
found.push(curMatch[1].trim());
const match = curMatch[1].trim();
if (forbiddenMatches.includes(match)) {
continue;
}
found.push(match);
}
let biasString = '';
@ -2610,7 +2617,7 @@ export async function sendMessageAsUser(textareaText, messageBias) {
chat[chat.length - 1]['is_user'] = true;
chat[chat.length - 1]['is_name'] = true;
chat[chat.length - 1]['send_date'] = humanizedDateTime();
chat[chat.length - 1]['mes'] = textareaText;
chat[chat.length - 1]['mes'] = substituteParams(textareaText);
chat[chat.length - 1]['extra'] = {};
if (messageBias) {