From 10f27f41d17d9e66d224a2f734a7dee5e84549b0 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 18 Sep 2023 18:00:11 +0300 Subject: [PATCH] Better Horde error reporting --- public/scripts/horde.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/scripts/horde.js b/public/scripts/horde.js index 1b24d02db..566afc7f2 100644 --- a/public/scripts/horde.js +++ b/public/scripts/horde.js @@ -153,6 +153,16 @@ async function generateHorde(prompt, params, signal) { const statusCheckJson = await statusCheckResponse.json(); console.log(statusCheckJson); + if (statusCheckJson.faulted === true) { + toastr.error('Horde request faulted. Please try again.'); + throw new Error(`Horde generation failed: Faulted`); + } + + if (statusCheckJson.is_possible === false) { + toastr.error('There are no Horde workers that are able to generate text with your request. Please change the parameters or try again later.'); + throw new Error(`Horde generation failed: Unsatisfiable request`); + } + if (statusCheckJson.done && Array.isArray(statusCheckJson.generations) && statusCheckJson.generations.length) { setGenerationProgress(100); const generatedText = statusCheckJson.generations[0].text;