diff --git a/client/CustomGoogleGeminiClient.js b/client/CustomGoogleGeminiClient.js index 87ef625..2e5451f 100644 --- a/client/CustomGoogleGeminiClient.js +++ b/client/CustomGoogleGeminiClient.js @@ -222,11 +222,11 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient { // ANY要笑死人的效果 let mode = opt.toolMode || 'AUTO' - let lastFuncName = opt.functionResponse?.name + let lastFuncName = (/** @type {FunctionResponse[] | undefined}**/ opt.functionResponse)?.map(rsp => rsp.name) const mustSendNextTurn = [ 'searchImage', 'searchMusic', 'searchVideo' ] - if (lastFuncName && mustSendNextTurn.includes(lastFuncName)) { + if (lastFuncName && lastFuncName?.find(name => mustSendNextTurn.includes(name))) { mode = 'ANY' } body.tool_config = { diff --git a/utils/tools/SerpIkechan8370Tool.js b/utils/tools/SerpIkechan8370Tool.js index 075b059..d5d52d3 100644 --- a/utils/tools/SerpIkechan8370Tool.js +++ b/utils/tools/SerpIkechan8370Tool.js @@ -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: {