mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: 修复搜索为空
This commit is contained in:
parent
f619035e52
commit
213818b635
1 changed files with 2 additions and 2 deletions
|
|
@ -20,7 +20,7 @@ export class SerpIkechan8370Tool extends AbstractTool {
|
|||
func = async function (opts) {
|
||||
let { q, source } = opts
|
||||
if (!source || !['google', 'bing', 'baidu'].includes(source)) {
|
||||
source = 'bing'
|
||||
source = 'baidu'
|
||||
}
|
||||
let serpRes = await fetch(`https://serp.ikechan8370.com/${source}?q=${encodeURIComponent(q)}&lang=zh-CN&limit=5`, {
|
||||
headers: {
|
||||
|
|
@ -29,7 +29,7 @@ export class SerpIkechan8370Tool extends AbstractTool {
|
|||
})
|
||||
serpRes = await serpRes.json()
|
||||
|
||||
let res = serpRes.data
|
||||
let res = serpRes.data || serpRes.results
|
||||
res?.forEach(r => {
|
||||
delete r?.rank
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue