From bbba9bc872d8b792ad19c0b14fdd7bd3147dd077 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Mon, 3 Feb 2025 20:11:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BE=AE=E8=B0=83gemini=E8=AF=86?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E5=88=A0=E9=99=A4=E6=9C=AC=E5=9C=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/core.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/model/core.js b/model/core.js index c63da23..7b62716 100644 --- a/model/core.js +++ b/model/core.js @@ -744,12 +744,9 @@ class Core { const image = await getImg(e) let imageUrl = image ? image[0] : undefined if (imageUrl) { - let md5 = imageUrl.split(/[/-]/).find(s => s.length === 32)?.toUpperCase() - let imageLoc = await getOrDownloadFile(`ocr/${md5}.png`, imageUrl) - let outputLoc = imageLoc.replace(`${md5}.png`, `${md5}_512.png`) - await resizeAndCropImage(imageLoc, outputLoc, 512) - let buffer = fs.readFileSync(outputLoc) - option.image = buffer.toString('base64') + const response = await fetch(imageUrl) + const base64Image = Buffer.from(await response.arrayBuffer()) + option.image = base64Image.toString('base64') } if (opt.enableSmart) { /**