This commit is contained in:
BennyKok 2023-12-15 20:27:24 +08:00
parent a484bb91fd
commit e8451c3749

View File

@ -65,27 +65,25 @@ export async function createRun(
status_endpoint: `${origin}/api/update-run`, status_endpoint: `${origin}/api/update-run`,
file_upload_endpoint: `${origin}/api/file-upload`, file_upload_endpoint: `${origin}/api/file-upload`,
}; };
console.log(body); // console.log(body);
const bodyJson = JSON.stringify(body); const bodyJson = JSON.stringify(body);
console.log(bodyJson); // console.log(bodyJson);
// Sending to comfyui // Sending to comfyui
const result = await fetch(comfyui_endpoint, { const _result = await fetch(comfyui_endpoint, {
method: "POST", method: "POST",
body: bodyJson, body: bodyJson,
cache: "no-store", cache: "no-store",
})
.then(async (res) => {
const text = await res.text();
console.log(text);
return text;
})
.then(async (res) => ComfyAPI_Run.parseAsync(JSON.parse(res)))
.catch((err) => {
console.log("Some went wrong in parsing the response");
throw new Error(err);
}); });
if (!_result.ok) {
throw new Error(`Error creating run, ${_result.statusText}`);
}
console.log(_result);
const result = await ComfyAPI_Run.parseAsync(await _result.json());
console.log(result); console.log(result);
// Add to our db // Add to our db