mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-13 02:20:14 +01:00
Don't unblock generation if a parallel stream is still running after quiet gens
This commit is contained in:
parent
3e60919289
commit
fd0c16bf12
@ -3065,14 +3065,14 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
|
||||
if (interruptedByCommand) {
|
||||
//$("#send_textarea").val('').trigger('input');
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
if (main_api == 'kobold' && kai_settings.streaming_kobold && !kai_flags.can_use_streaming) {
|
||||
toastr.error('Streaming is enabled, but the version of Kobold used does not support token streaming.', undefined, { timeOut: 10000, preventDuplicates: true });
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@ -3081,12 +3081,12 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
textgen_settings.legacy_api &&
|
||||
(textgen_settings.type === OOBA || textgen_settings.type === APHRODITE)) {
|
||||
toastr.error('Streaming is not supported for the Legacy API. Update Ooba and use new API to enable streaming.', undefined, { timeOut: 10000, preventDuplicates: true });
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (isHordeGenerationNotAllowed()) {
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@ -3122,7 +3122,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
setCharacterName('');
|
||||
} else {
|
||||
console.log('No enabled members found');
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
@ -3296,7 +3296,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
|
||||
if (aborted) {
|
||||
console.debug('Generation aborted by extension interceptors');
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return Promise.resolve();
|
||||
}
|
||||
} else {
|
||||
@ -3310,7 +3310,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
adjustedParams = await adjustHordeGenerationParams(max_context, amount_gen);
|
||||
}
|
||||
catch {
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (horde_settings.auto_adjust_context_length) {
|
||||
@ -4097,7 +4097,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
await eventSource.emit(event_types.IMPERSONATE_READY, getMessage);
|
||||
}
|
||||
else if (type == 'quiet') {
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
return getMessage;
|
||||
}
|
||||
else {
|
||||
@ -4165,7 +4165,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
|
||||
console.debug('/api/chats/save called by /Generate');
|
||||
await saveChatConditional();
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
streamingProcessor = null;
|
||||
|
||||
if (type !== 'quiet') {
|
||||
@ -4183,7 +4183,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||
|
||||
generatedPromptCache = '';
|
||||
|
||||
unblockGeneration();
|
||||
unblockGeneration(type);
|
||||
console.log(exception);
|
||||
streamingProcessor = null;
|
||||
throw exception;
|
||||
@ -4253,7 +4253,16 @@ function flushWIDepthInjections() {
|
||||
}
|
||||
}
|
||||
|
||||
function unblockGeneration() {
|
||||
/**
|
||||
* Unblocks the UI after a generation is complete.
|
||||
* @param {string} [type] Generation type (optional)
|
||||
*/
|
||||
function unblockGeneration(type) {
|
||||
// Don't unblock if a parallel stream is still running
|
||||
if (type === 'quiet' && streamingProcessor && !streamingProcessor.isFinished) {
|
||||
return;
|
||||
}
|
||||
|
||||
is_send_press = false;
|
||||
activateSendButtons();
|
||||
showSwipeButtons();
|
||||
|
Loading…
x
Reference in New Issue
Block a user