From f00a8f87f7608658363a3044d39ce39237a77ddc Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Tue, 21 May 2024 09:51:29 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(StableDiffusion):=20Temporar?= =?UTF-8?q?ily=20Remove=20`sampler=5Findex`=20(#2815)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/clients/tools/structured/StableDiffusion.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/app/clients/tools/structured/StableDiffusion.js b/api/app/clients/tools/structured/StableDiffusion.js index e891cbb398..cfcbf73ac4 100644 --- a/api/app/clients/tools/structured/StableDiffusion.js +++ b/api/app/clients/tools/structured/StableDiffusion.js @@ -80,13 +80,18 @@ class StableDiffusionAPI extends StructuredTool { const payload = { prompt, negative_prompt, - sampler_index: 'DPM++ 2M Karras', cfg_scale: 4.5, steps: 22, width: 1024, height: 1024, }; - const generationResponse = await axios.post(`${url}/sdapi/v1/txt2img`, payload); + let generationResponse; + try { + generationResponse = await axios.post(`${url}/sdapi/v1/txt2img`, payload); + } catch (error) { + logger.error('[StableDiffusion] Error while generating image:', error); + return 'Error making API request.'; + } const image = generationResponse.data.images[0]; /** @type {{ height: number, width: number, seed: number, infotexts: string[] }} */