mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +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要笑死人的效果
|
// ANY要笑死人的效果
|
||||||
let mode = opt.toolMode || 'AUTO'
|
let mode = opt.toolMode || 'AUTO'
|
||||||
let lastFuncName = opt.functionResponse?.name
|
let lastFuncName = (/** @type {FunctionResponse[] | undefined}**/ opt.functionResponse)?.map(rsp => rsp.name)
|
||||||
const mustSendNextTurn = [
|
const mustSendNextTurn = [
|
||||||
'searchImage', 'searchMusic', 'searchVideo'
|
'searchImage', 'searchMusic', 'searchVideo'
|
||||||
]
|
]
|
||||||
if (lastFuncName && mustSendNextTurn.includes(lastFuncName)) {
|
if (lastFuncName && lastFuncName?.find(name => mustSendNextTurn.includes(name))) {
|
||||||
mode = 'ANY'
|
mode = 'ANY'
|
||||||
}
|
}
|
||||||
body.tool_config = {
|
body.tool_config = {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ export class SerpIkechan8370Tool extends AbstractTool {
|
||||||
},
|
},
|
||||||
source: {
|
source: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
enum: ['google', 'bing', 'baidu']
|
enum: ['google', 'bing', 'baidu', 'duckduckgo'],
|
||||||
|
description: 'search source, default value is bing'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
required: ['q']
|
required: ['q']
|
||||||
|
|
@ -19,8 +20,8 @@ export class SerpIkechan8370Tool extends AbstractTool {
|
||||||
|
|
||||||
func = async function (opts) {
|
func = async function (opts) {
|
||||||
let { q, source } = opts
|
let { q, source } = opts
|
||||||
if (!source || !['google', 'bing', 'baidu'].includes(source)) {
|
if (!source || !['google', 'bing', 'baidu', 'duckduckgo'].includes(source)) {
|
||||||
source = 'baidu'
|
source = 'bing'
|
||||||
}
|
}
|
||||||
let serpRes = await fetch(`https://serp.ikechan8370.com/${source}?q=${encodeURIComponent(q)}&lang=zh-CN&limit=5`, {
|
let serpRes = await fetch(`https://serp.ikechan8370.com/${source}?q=${encodeURIComponent(q)}&lang=zh-CN&limit=5`, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue