Prevent duplicate toasts

This commit is contained in:
Cohee 2024-09-13 11:22:12 +00:00
parent 620847c4d6
commit 8dd7a97eb3
2 changed files with 3 additions and 3 deletions

View File

@ -4413,7 +4413,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
generatedPromptCache = ''; generatedPromptCache = '';
if (data?.response) { if (data?.response) {
toastr.error(data.response, 'API Error'); toastr.error(data.response, 'API Error', { preventDuplicates: true });
} }
throw new Error(data?.response); throw new Error(data?.response);
} }

View File

@ -2262,7 +2262,7 @@ async function generateRawCallback(args, value) {
return result; return result;
} catch (err) { } catch (err) {
console.error('Error on /genraw generation', err); console.error('Error on /genraw generation', err);
toastr.error(err.message, 'Error on Generate'); toastr.error(err.message, 'API Error', { preventDuplicates: true });
} finally { } finally {
if (lock) { if (lock) {
activateSendButtons(); activateSendButtons();
@ -2297,7 +2297,7 @@ async function generateCallback(args, value) {
return result; return result;
} catch (err) { } catch (err) {
console.error('Error on /gen generation', err); console.error('Error on /gen generation', err);
toastr.error(err.message, 'Error on Generate'); toastr.error(err.message, 'API Error', { preventDuplicates: true });
} finally { } finally {
if (lock) { if (lock) {
activateSendButtons(); activateSendButtons();