Better Horde error reporting

This commit is contained in:
Cohee 2023-09-18 18:00:11 +03:00
parent 3d83d1d5b7
commit 10f27f41d1

View File

@ -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;