From 40c69d7dd6f4cff969f189a37c5182e8f0d0d5fd Mon Sep 17 00:00:00 2001 From: tim h Date: Sun, 8 Jan 2023 16:44:46 -0600 Subject: [PATCH] tiny fix to prevent generate-ahead from freaking out with alerts if something goes wrong --- index.html | 6 +++--- js/ui/tool/dream.js | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index f32419f..797c48d 100644 --- a/index.html +++ b/index.html @@ -339,7 +339,7 @@ - + @@ -368,10 +368,10 @@ - + diff --git a/js/ui/tool/dream.js b/js/ui/tool/dream.js index 7760de4..daa0670 100644 --- a/js/ui/tool/dream.js +++ b/js/ui/tool/dream.js @@ -177,6 +177,7 @@ const _dream = async (endpoint, request) => { * @returns {Promise} */ const _generate = async (endpoint, request, bb, options = {}) => { + var alertCount = 0; defaultOpt(options, { drawEvery: 0.2 / request.n_iter, keepUnmask: null, @@ -532,9 +533,14 @@ const _generate = async (endpoint, request, bb, options = {}) => { seeds.push(...dreamData.seeds); imageindextxt.textContent = `${at}/${images.length - 1}`; } catch (e) { - alert( - `Error generating images. Please try again or see console for more details` - ); + if (alertCount < 2) { + alert( + `Error generating images. Please try again or see console for more details` + ); + } else { + eagerGenerateCount = 0; + } + alertCount++; console.warn(`[dream] Error generating images:`); console.warn(e); } finally {