mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix /continue getting stuck on API errors
This commit is contained in:
@ -2639,15 +2639,16 @@ async function openChat(id) {
|
|||||||
async function continueChatCallback(args, prompt) {
|
async function continueChatCallback(args, prompt) {
|
||||||
const shouldAwait = isTrueBoolean(args?.await);
|
const shouldAwait = isTrueBoolean(args?.await);
|
||||||
|
|
||||||
const outerPromise = new Promise((resolve) => {
|
const outerPromise = new Promise(async (resolve, reject) => {
|
||||||
setTimeout(async () => {
|
|
||||||
try {
|
try {
|
||||||
await waitUntilCondition(() => !is_send_press && !is_group_generating, 10000, 100);
|
await waitUntilCondition(() => !is_send_press && !is_group_generating, 10000, 100);
|
||||||
} catch {
|
} catch {
|
||||||
console.warn('Timeout waiting for generation unlock');
|
console.warn('Timeout waiting for generation unlock');
|
||||||
toastr.warning('Cannot run /continue command while the reply is being generated.');
|
toastr.warning('Cannot run /continue command while the reply is being generated.');
|
||||||
|
return reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// Prevent infinite recursion
|
// Prevent infinite recursion
|
||||||
$('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles: true }));
|
$('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
|
||||||
@ -2655,7 +2656,10 @@ async function continueChatCallback(args, prompt) {
|
|||||||
await Generate('continue', options);
|
await Generate('continue', options);
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
}, 1);
|
} catch (error) {
|
||||||
|
console.error('Error running /continue command:', error);
|
||||||
|
reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (shouldAwait) {
|
if (shouldAwait) {
|
||||||
|
Reference in New Issue
Block a user