Fix empty stat and original param
This commit is contained in:
parent
ed366b15ca
commit
212e98302a
|
@ -1527,7 +1527,6 @@ function scrollChatToBottom() {
|
||||||
function substituteParams(content, _name1, _name2, _original) {
|
function substituteParams(content, _name1, _name2, _original) {
|
||||||
_name1 = _name1 ?? name1;
|
_name1 = _name1 ?? name1;
|
||||||
_name2 = _name2 ?? name2;
|
_name2 = _name2 ?? name2;
|
||||||
_original = _original || '';
|
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -1536,7 +1535,9 @@ function substituteParams(content, _name1, _name2, _original) {
|
||||||
// Replace {{original}} with the original message
|
// Replace {{original}} with the original message
|
||||||
// Note: only replace the first instance of {{original}}
|
// Note: only replace the first instance of {{original}}
|
||||||
// This will hopefully prevent the abuse
|
// This will hopefully prevent the abuse
|
||||||
content = content.replace(/{{original}}/i, _original);
|
if (typeof _original === 'string') {
|
||||||
|
content = content.replace(/{{original}}/i, _original);
|
||||||
|
}
|
||||||
content = content.replace(/{{input}}/gi, $('#send_textarea').val());
|
content = content.replace(/{{input}}/gi, $('#send_textarea').val());
|
||||||
content = content.replace(/{{user}}/gi, _name1);
|
content = content.replace(/{{user}}/gi, _name1);
|
||||||
content = content.replace(/{{char}}/gi, _name2);
|
content = content.replace(/{{char}}/gi, _name2);
|
||||||
|
|
|
@ -256,6 +256,19 @@ async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
||||||
|
|
||||||
let stat = charStats[characters[this_chid].avatar];
|
let stat = charStats[characters[this_chid].avatar];
|
||||||
|
|
||||||
|
if (!stat) {
|
||||||
|
stat = {
|
||||||
|
total_gen_time: 0,
|
||||||
|
user_word_count: 0,
|
||||||
|
non_user_msg_count: 0,
|
||||||
|
user_msg_count: 0,
|
||||||
|
non_user_msg_count: 0,
|
||||||
|
total_swipe_count: 0,
|
||||||
|
date_first_chat: Date.now(),
|
||||||
|
date_last_chat: Date.now(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
stat.total_gen_time += calculateGenTime(
|
stat.total_gen_time += calculateGenTime(
|
||||||
line.gen_started,
|
line.gen_started,
|
||||||
line.gen_finished
|
line.gen_finished
|
||||||
|
|
Loading…
Reference in New Issue