mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +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)
|
const image = await getImg(e)
|
||||||
let imageUrl = image ? image[0] : undefined
|
let imageUrl = image ? image[0] : undefined
|
||||||
if (imageUrl) {
|
if (imageUrl) {
|
||||||
let md5 = imageUrl.split(/[/-]/).find(s => s.length === 32)?.toUpperCase()
|
const response = await fetch(imageUrl)
|
||||||
let imageLoc = await getOrDownloadFile(`ocr/${md5}.png`, imageUrl)
|
const base64Image = Buffer.from(await response.arrayBuffer())
|
||||||
let outputLoc = imageLoc.replace(`${md5}.png`, `${md5}_512.png`)
|
option.image = base64Image.toString('base64')
|
||||||
await resizeAndCropImage(imageLoc, outputLoc, 512)
|
|
||||||
let buffer = fs.readFileSync(outputLoc)
|
|
||||||
option.image = buffer.toString('base64')
|
|
||||||
}
|
}
|
||||||
if (opt.enableSmart) {
|
if (opt.enableSmart) {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue