Make generation actually work

This commit is contained in:
Cohee 2024-07-04 22:51:47 +03:00
parent e32b0cc223
commit 5da3921907
2 changed files with 4 additions and 5 deletions

View File

@ -2725,12 +2725,10 @@ async function generateStabilityImage(prompt, negativePrompt) {
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(`HTTP ${response.status}: ${errorText}`);
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const blob = await response.blob();
const base64Image = await getBase64Async(blob);
const base64Image = await response.text();
return {
format: IMAGE_FORMAT,

View File

@ -836,6 +836,7 @@ stability.post('/generate', jsonParser, async (request, response) => {
'Accept': 'image/*',
},
body: formData,
timeout: 0,
});
if (!result.ok) {
@ -845,7 +846,7 @@ stability.post('/generate', jsonParser, async (request, response) => {
}
const buffer = await result.buffer();
return response.send(buffer);
return response.send(buffer.toString('base64'));
} catch (error) {
console.log(error);
return response.sendStatus(500);