From 2a153e3b1526402ae3a62a3c009f9ecec9cf6478 Mon Sep 17 00:00:00 2001 From: Cohee Date: Thu, 3 Aug 2023 17:17:58 +0300 Subject: [PATCH] #866 Wait for group to stop generating before auto-summarizing --- public/scripts/extensions/memory/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/scripts/extensions/memory/index.js b/public/scripts/extensions/memory/index.js index f2e9433ea..e33994bc1 100644 --- a/public/scripts/extensions/memory/index.js +++ b/public/scripts/extensions/memory/index.js @@ -1,6 +1,7 @@ import { getStringHash, debounce, waitUntilCondition, extractAllWords } from "../../utils.js"; import { getContext, getApiUrl, extension_settings, doExtrasFetch, modules } from "../../extensions.js"; import { eventSource, event_types, extension_prompt_types, generateQuietPrompt, is_send_press, saveSettingsDebounced, substituteParams } from "../../../script.js"; +import { is_group_generating, selected_group } from "../../group-chats.js"; export { MODULE_NAME }; const MODULE_NAME = '1_memory'; @@ -333,6 +334,10 @@ async function summarizeChat(context) { async function summarizeChatMain(context, force) { try { + // Wait for group to finish generating + if (selected_group) { + await waitUntilCondition(() => is_group_generating === false, 1000, 10); + } // Wait for the send button to be released waitUntilCondition(() => is_send_press === false, 30000, 100); } catch {