mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: 微调gemini识图,删除本地缓存
This commit is contained in:
parent
f05da98d37
commit
bbba9bc872
1 changed files with 3 additions and 6 deletions
|
|
@ -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) {
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue