mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: remove unuseful fields to reduce token usage
This commit is contained in:
parent
db24de9ae3
commit
b5669de782
2 changed files with 13 additions and 6 deletions
|
|
@ -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.'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue