Pass group chat id to extensions. Remove temporary swipes fix from memory ext.

This commit is contained in:
SillyLossy
2023-05-02 18:30:19 +03:00
parent 51940c4501
commit e2187638fd
2 changed files with 5 additions and 6 deletions

View File

@ -157,7 +157,7 @@ async function moduleWorker() {
}
// No new messages - do nothing
if (lastMessageId === chat.length && getStringHash(chat[chat.length - 1].mes) === lastMessageHash) {
if (chat.length === 0 || (lastMessageId === chat.length && getStringHash(chat[chat.length - 1].mes) === lastMessageHash)) {
return;
}
@ -196,7 +196,6 @@ async function summarizeChat(context) {
const longMemory = getLatestMemoryFromChat(chat);
const reversedChat = chat.slice().reverse();
reversedChat.shift();
const preSummaryLastMessage = getStringHash(reversedChat.length ? reversedChat[reversedChat.length - 1] : '');
let memoryBuffer = [];
for (let mes of reversedChat) {
@ -256,11 +255,9 @@ async function summarizeChat(context) {
const summary = data.summary;
const newContext = getContext();
const postSummaryLastMessage = getStringHash(newContext.chat.length ? newContext.chat[newContext.chat.length - 2] : '');
// something changed during summarization request
if (postSummaryLastMessage !== preSummaryLastMessage
|| newContext.groupId !== context.groupId
if (newContext.groupId !== context.groupId
|| newContext.chatId !== context.chatId
|| (!newContext.groupId && (newContext.characterId !== context.characterId))) {
console.log('Context changed, summary discarded');