This commit is contained in:
BennyKok 2023-12-15 20:09:46 +08:00
parent 942660d505
commit 708fc02c44

View File

@ -60,33 +60,29 @@ export async function createRun(
} }
} }
console.log(workflow_api); const body = {
workflow_api: workflow_api,
status_endpoint: `${origin}/api/update-run`,
file_upload_endpoint: `${origin}/api/file-upload`,
};
console.log(body);
const bodyJson = JSON.stringify(body);
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",
// headers: { body: bodyJson,
// "Content-Type": "application/json", cache: "no-store",
// }, })
body: JSON.stringify({ .then((res) => res.text())
workflow_api: workflow_api, .then(async (res) => ComfyAPI_Run.parseAsync(JSON.parse(res)))
status_endpoint: `${origin}/api/update-run`, .catch((err) => {
file_upload_endpoint: `${origin}/api/file-upload`, console.log("Some went wrong in parsing the response");
}), throw new Error(err);
}).then(async (res) => ComfyAPI_Run.parseAsync(await res.json())); });
// .catch((error) => {
// console.error(error);
// return new Response(error.details, {
// status: 500,
// });
// });
// console.log(result); console.log(result);
// // return the error
// if (result instanceof Response) {
// return result;
// }
// Add to our db // Add to our db
const workflow_run = await db const workflow_run = await db