mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Pass group chat id to extensions. Remove temporary swipes fix from memory ext.
This commit is contained in:
@ -3688,7 +3688,9 @@ window["SillyTavern"].getContext = function () {
|
||||
name2: name2,
|
||||
characterId: this_chid,
|
||||
groupId: selected_group,
|
||||
chatId: this_chid && characters[this_chid] && characters[this_chid].chat,
|
||||
chatId: selected_group
|
||||
? groups.find(x => x.id == selected_group)?.chat_id
|
||||
: (this_chid && characters[this_chid] && characters[this_chid].chat),
|
||||
onlineStatus: online_status,
|
||||
maxContext: Number(max_context),
|
||||
chatMetadata: chat_metadata,
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user