Add expressions plugin

This commit is contained in:
SillyLossy
2023-03-04 22:23:22 +02:00
parent ada45f2c70
commit ea44f763c2
4 changed files with 141 additions and 1 deletions

View File

@@ -135,7 +135,7 @@ async function moduleWorker() {
&& chat[chat.length - 1].extra.memory
&& lastMessageId === chat.length
&& getStringHash(chat[chat.length - 1].mes) !== lastMessageHash) {
chat[chat.length - 1].extra.memory = null;
delete chat[chat.length - 1].extra.memory;
}
try {
@@ -228,7 +228,19 @@ async function summarizeChat(context) {
}
function onMemoryRestoreClick() {
const context = getContext();
const content = $('#memory_contents').val();
const reversedChat = context.chat.slice().reverse();
for (let mes of reversedChat) {
if (mes.extra && mes.extra.memory == content) {
delete mes.extra.memory;
break;
}
}
const newContent = getLatestMemoryFromChat(context.chat);
setMemoryContext(newContent, false);
}
function onMemoryContentInput() {