fix: remove unuseful fields to reduce token usage

This commit is contained in:
ikechan8370 2023-07-10 11:18:15 +08:00
parent db24de9ae3
commit b5669de782
2 changed files with 13 additions and 6 deletions

View file

@ -8,14 +8,18 @@ export class SerpImageTool extends AbstractTool {
q: {
type: 'string',
description: 'search keyword'
},
limit: {
type: 'number',
description: 'image number'
}
},
required: ['q']
}
func = async function (opts) {
let { q } = opts
let serpRes = await fetch(`https://serp.ikechan8370.com/image/bing?q=${encodeURIComponent(q)}`, {
let { q, limit = 2 } = opts
let serpRes = await fetch(`https://serp.ikechan8370.com/image/bing?q=${encodeURIComponent(q)}&limit=${limit}`, {
headers: {
'X-From-Library': 'ikechan8370'
}
@ -23,8 +27,8 @@ export class SerpImageTool extends AbstractTool {
serpRes = await serpRes.json()
let res = serpRes.data
return `the images search results are here in json format:\n${JSON.stringify(res)}. the murl field is real picture url. You should use sendPicture to send them`
return `images search results in json format:\n${JSON.stringify(res)}. the murl field is actual picture url. You should use sendPicture to send them`
}
description = 'Useful when you want to search images from the internet.'
description = 'Useful when you want to search images from the Internet.'
}