fix: 修复前几天支持multiple tools导致的gemini搜了不发的问题

This commit is contained in:
ikechan8370 2025-02-16 20:59:26 +08:00
parent 213818b635
commit fcca28de37
2 changed files with 6 additions and 5 deletions

View file

@ -11,7 +11,8 @@ export class SerpIkechan8370Tool extends AbstractTool {
},
source: {
type: 'string',
enum: ['google', 'bing', 'baidu']
enum: ['google', 'bing', 'baidu', 'duckduckgo'],
description: 'search source, default value is bing'
}
},
required: ['q']
@ -19,8 +20,8 @@ export class SerpIkechan8370Tool extends AbstractTool {
func = async function (opts) {
let { q, source } = opts
if (!source || !['google', 'bing', 'baidu'].includes(source)) {
source = 'baidu'
if (!source || !['google', 'bing', 'baidu', 'duckduckgo'].includes(source)) {
source = 'bing'
}
let serpRes = await fetch(`https://serp.ikechan8370.com/${source}?q=${encodeURIComponent(q)}&lang=zh-CN&limit=5`, {
headers: {