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

@ -22,7 +22,7 @@ export class SerpIkechan8370Tool extends AbstractTool {
if (!source) {
source = 'baidu'
}
let serpRes = await fetch(`https://serp.ikechan8370.com/${source}?q=${encodeURIComponent(q)}&lang=zh-CN&limit=10`, {
let serpRes = await fetch(`https://serp.ikechan8370.com/${source}?q=${encodeURIComponent(q)}&lang=zh-CN&limit=5`, {
headers: {
'X-From-Library': 'ikechan8370'
}
@ -30,8 +30,11 @@ export class SerpIkechan8370Tool extends AbstractTool {
serpRes = await serpRes.json()
let res = serpRes.data
res?.forEach(r => {
delete r?.rank
})
return `the search results are here in json format:\n${JSON.stringify(res)}`
}
description = 'Useful when you want to search something from the internet. If you don\'t know much about the user\'s question, just search about it! If you want to know details of a result, you can use website tool'
description = 'Useful when you want to search something from the Internet. If you don\'t know much about the user\'s question, prefer to search about it! If you want to know further details of a result, you can use website tool'
}