mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: 修复前几天支持multiple tools导致的gemini搜了不发的问题
This commit is contained in:
parent
213818b635
commit
fcca28de37
2 changed files with 6 additions and 5 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue