SimpleChat: highlight trim, garbage trimming bitmore aggressive

Make it easy for end user to identified the trimmed text.

Make garbage trimming logic, consider a longer repeat garbage
substring.
This commit is contained in:
HanishKVC 2024-05-27 18:07:36 +05:30
parent 42b4fe555e
commit f9fc543190
2 changed files with 6 additions and 2 deletions

View file

@ -21,6 +21,9 @@
.role-user {
background-color: lightgray;
}
.role-trim {
background-color: lightpink;
}
.flex-grow {
flex-grow: 1;

View file

@ -450,14 +450,15 @@ class MultiChatUI {
}
if (gMe.bTrimGarbage) {
let origMsg = assistantMsg;
assistantMsg = du.trim_hist_garbage_at_end_loop(assistantMsg, 8, 16, 72);
assistantMsg = du.trim_hist_garbage_at_end_loop(assistantMsg, 8, 24, 72);
trimmedMsg = origMsg.substring(assistantMsg.length);
}
chat.add(Roles.Assistant, assistantMsg);
if (chatId == this.curChatId) {
chat.show(this.elDivChat);
if (trimmedMsg.length > 0) {
ui.el_create_append_p(`TRIMMED:${trimmedMsg}`, this.elDivChat);
let p = ui.el_create_append_p(`TRIMMED:${trimmedMsg}`, this.elDivChat);
p.className="role-trim";
}
} else {
console.debug(`DBUG:SimpleChat:MCUI:HandleUserSubmit:ChatId has changed:[${chatId}] [${this.curChatId}]`);