From 8dd7a97eb37922a324d2610d28ec60b9aa6806db Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:22:12 +0000 Subject: [PATCH] Prevent duplicate toasts --- public/script.js | 2 +- public/scripts/slash-commands.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/script.js b/public/script.js index 3acb6f33f..e512ec774 100644 --- a/public/script.js +++ b/public/script.js @@ -4413,7 +4413,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro generatedPromptCache = ''; if (data?.response) { - toastr.error(data.response, 'API Error'); + toastr.error(data.response, 'API Error', { preventDuplicates: true }); } throw new Error(data?.response); } diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 08dd6744c..201dcb122 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -2262,7 +2262,7 @@ async function generateRawCallback(args, value) { return result; } catch (err) { console.error('Error on /genraw generation', err); - toastr.error(err.message, 'Error on Generate'); + toastr.error(err.message, 'API Error', { preventDuplicates: true }); } finally { if (lock) { activateSendButtons(); @@ -2297,7 +2297,7 @@ async function generateCallback(args, value) { return result; } catch (err) { console.error('Error on /gen generation', err); - toastr.error(err.message, 'Error on Generate'); + toastr.error(err.message, 'API Error', { preventDuplicates: true }); } finally { if (lock) { activateSendButtons();