diff --git a/apps/chat.js b/apps/chat.js index 4c41612..222bf14 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -1989,7 +1989,7 @@ export class chatgpt extends plugin { new WeatherTool(), new SendPictureTool(), new TTSTool(), - new ProcessPictureTool(), + serpTool ] let img = [] @@ -2015,6 +2015,7 @@ export class chatgpt extends plugin { } if (img.length > 0 && Config.extraUrl) { tools.push(new ImageCaptionTool()) + tools.push(new ProcessPictureTool()) prompt += `\nthe url of the picture(s) above: ${img.join(', ')}` } else { tools.push(new SerpImageTool()) diff --git a/utils/tools/ProcessPictureTool.js b/utils/tools/ProcessPictureTool.js index 2540519..bf5a283 100644 --- a/utils/tools/ProcessPictureTool.js +++ b/utils/tools/ProcessPictureTool.js @@ -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' func = async function (opts) { - let { imgUrl, qq, type } = opts + let { url, qq, type } = opts 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' } - const imageResponse = await fetch(imgUrl) + const imageResponse = await fetch(url) const blob = await imageResponse.blob() const arrayBuffer = await blob.arrayBuffer() const buffer = Buffer.from(arrayBuffer)