From 94bc880b7f2a4a96b425b13d092e37c56510f071 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Tue, 16 Jul 2024 01:45:15 +0800 Subject: [PATCH] fixed typescript error --- app/components/sd.tsx | 17 ++++++----------- app/utils/chat.ts | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/components/sd.tsx b/app/components/sd.tsx index e06ee1683..19684c240 100644 --- a/app/components/sd.tsx +++ b/app/components/sd.tsx @@ -253,17 +253,12 @@ export function Sd() { onClick={async () => { if (await showConfirm(Locale.Sd.Danger.Delete)) { // remove img_data + remove item in list - removeImage(item.img_data).finally( - () => { - sdStore.draw = sdImages.filter( - (i: any) => i.id !== item.id, - ); - sdStore.getNextId(); - }, - (error) => { - console.error(error); - }, - ); + removeImage(item.img_data).finally(() => { + sdStore.draw = sdImages.filter( + (i: any) => i.id !== item.id, + ); + sdStore.getNextId(); + }); } }} /> diff --git a/app/utils/chat.ts b/app/utils/chat.ts index 55127f50e..be9908906 100644 --- a/app/utils/chat.ts +++ b/app/utils/chat.ts @@ -64,7 +64,7 @@ export function base64Image2Blob(base64Data: string, contentType: string) { return new Blob([byteArray], { type: contentType }); } -export function uploadImage(file: File): Promise { +export function uploadImage(file: Blob): Promise { const body = new FormData(); body.append("file", file); return fetch(UPLOAD_URL, {