mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: 啊
This commit is contained in:
parent
19f9c804bb
commit
8c7e6489e7
2 changed files with 6 additions and 5 deletions
|
|
@ -1989,7 +1989,7 @@ export class chatgpt extends plugin {
|
||||||
new WeatherTool(),
|
new WeatherTool(),
|
||||||
new SendPictureTool(),
|
new SendPictureTool(),
|
||||||
new TTSTool(),
|
new TTSTool(),
|
||||||
new ProcessPictureTool(),
|
|
||||||
serpTool
|
serpTool
|
||||||
]
|
]
|
||||||
let img = []
|
let img = []
|
||||||
|
|
@ -2015,6 +2015,7 @@ export class chatgpt extends plugin {
|
||||||
}
|
}
|
||||||
if (img.length > 0 && Config.extraUrl) {
|
if (img.length > 0 && Config.extraUrl) {
|
||||||
tools.push(new ImageCaptionTool())
|
tools.push(new ImageCaptionTool())
|
||||||
|
tools.push(new ProcessPictureTool())
|
||||||
prompt += `\nthe url of the picture(s) above: ${img.join(', ')}`
|
prompt += `\nthe url of the picture(s) above: ${img.join(', ')}`
|
||||||
} else {
|
} else {
|
||||||
tools.push(new SerpImageTool())
|
tools.push(new SerpImageTool())
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,14 @@ export class ProcessPictureTool extends AbstractTool {
|
||||||
description = 'useful when you want to know what is inside a photo, such as user\'s avatar or other pictures'
|
description = 'useful when you want to know what is inside a photo, such as user\'s avatar or other pictures'
|
||||||
|
|
||||||
func = async function (opts) {
|
func = async function (opts) {
|
||||||
let { imgUrl, qq, type } = opts
|
let { url, qq, type } = opts
|
||||||
if (qq) {
|
if (qq) {
|
||||||
imgUrl = `https://q1.qlogo.cn/g?b=qq&s=160&nk=${qq}`
|
url = `https://q1.qlogo.cn/g?b=qq&s=160&nk=${qq}`
|
||||||
}
|
}
|
||||||
if (!imgUrl) {
|
if (!url) {
|
||||||
return 'you must give at least one parameter of imgUrl and qq'
|
return 'you must give at least one parameter of imgUrl and qq'
|
||||||
}
|
}
|
||||||
const imageResponse = await fetch(imgUrl)
|
const imageResponse = await fetch(url)
|
||||||
const blob = await imageResponse.blob()
|
const blob = await imageResponse.blob()
|
||||||
const arrayBuffer = await blob.arrayBuffer()
|
const arrayBuffer = await blob.arrayBuffer()
|
||||||
const buffer = Buffer.from(arrayBuffer)
|
const buffer = Buffer.from(arrayBuffer)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue