mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Remove isGenerationAborted
Just check the AbortSignal.
This commit is contained in:
@@ -658,7 +658,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
|
|||||||
let activationText = '';
|
let activationText = '';
|
||||||
let isUserInput = false;
|
let isUserInput = false;
|
||||||
let isGenerationDone = false;
|
let isGenerationDone = false;
|
||||||
let isGenerationAborted = false;
|
|
||||||
|
|
||||||
if (userInput?.length && !by_auto_mode) {
|
if (userInput?.length && !by_auto_mode) {
|
||||||
isUserInput = true;
|
isUserInput = true;
|
||||||
@@ -673,16 +672,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
|
|||||||
const resolveOriginal = params.resolve;
|
const resolveOriginal = params.resolve;
|
||||||
const rejectOriginal = params.reject;
|
const rejectOriginal = params.reject;
|
||||||
|
|
||||||
if (params.signal instanceof AbortSignal) {
|
if (params.signal instanceof AbortSignal && params.signal.aborted) {
|
||||||
if (params.signal.aborted) {
|
|
||||||
throw new Error('Already aborted signal passed. Group generation stopped');
|
throw new Error('Already aborted signal passed. Group generation stopped');
|
||||||
}
|
}
|
||||||
|
|
||||||
params.signal.onabort = () => {
|
|
||||||
isGenerationAborted = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof params.resolve === 'function') {
|
if (typeof params.resolve === 'function') {
|
||||||
params.resolve = function () {
|
params.resolve = function () {
|
||||||
isGenerationDone = true;
|
isGenerationDone = true;
|
||||||
@@ -760,7 +753,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
|
|||||||
// TODO: This is awful. Refactor this
|
// TODO: This is awful. Refactor this
|
||||||
while (true) {
|
while (true) {
|
||||||
deactivateSendButtons();
|
deactivateSendButtons();
|
||||||
if (isGenerationAborted) {
|
if (params.signal instanceof AbortSignal && params.signal.aborted) {
|
||||||
throw new Error('Group generation aborted');
|
throw new Error('Group generation aborted');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user