mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
#843 Wait for group to stop generating before checking objectives
This commit is contained in:
@ -334,7 +334,7 @@ async function summarizeChat(context) {
|
|||||||
async function summarizeChatMain(context, force) {
|
async function summarizeChatMain(context, force) {
|
||||||
try {
|
try {
|
||||||
// Wait for the send button to be released
|
// Wait for the send button to be released
|
||||||
waitUntilCondition(() => is_send_press === false, 10000, 100);
|
waitUntilCondition(() => is_send_press === false, 30000, 100);
|
||||||
} catch {
|
} catch {
|
||||||
console.debug('Timeout waiting for is_send_press');
|
console.debug('Timeout waiting for is_send_press');
|
||||||
return;
|
return;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { chat_metadata, callPopup, saveSettingsDebounced, getCurrentChatId } from "../../../script.js";
|
import { chat_metadata, callPopup, saveSettingsDebounced, is_send_press } from "../../../script.js";
|
||||||
import { getContext, extension_settings, saveMetadataDebounced } from "../../extensions.js";
|
import { getContext, extension_settings, saveMetadataDebounced } from "../../extensions.js";
|
||||||
import {
|
import {
|
||||||
substituteParams,
|
substituteParams,
|
||||||
@ -7,6 +7,8 @@ import {
|
|||||||
generateQuietPrompt,
|
generateQuietPrompt,
|
||||||
} from "../../../script.js";
|
} from "../../../script.js";
|
||||||
import { registerSlashCommand } from "../../slash-commands.js";
|
import { registerSlashCommand } from "../../slash-commands.js";
|
||||||
|
import { waitUntilCondition } from "../../utils.js";
|
||||||
|
import { is_group_generating, selected_group } from "../../group-chats.js";
|
||||||
|
|
||||||
const MODULE_NAME = "Objective"
|
const MODULE_NAME = "Objective"
|
||||||
|
|
||||||
@ -109,6 +111,19 @@ async function checkTaskCompleted() {
|
|||||||
if (jQuery.isEmptyObject(currentTask)) {
|
if (jQuery.isEmptyObject(currentTask)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Wait for group to finish generating
|
||||||
|
if (selected_group) {
|
||||||
|
await waitUntilCondition(() => is_group_generating === false, 1000, 10);
|
||||||
|
}
|
||||||
|
// Another extension might be doing something with the chat, so wait for it to finish
|
||||||
|
await waitUntilCondition(() => is_send_press === false, 30000, 10);
|
||||||
|
} catch {
|
||||||
|
console.debug("Failed to wait for group to finish generating")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
checkCounter = $('#objective-check-frequency').val()
|
checkCounter = $('#objective-check-frequency').val()
|
||||||
toastr.info("Checking for task completion.")
|
toastr.info("Checking for task completion.")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user