Update bym.js (#735)

* feat: new bing (WIP)

* fix: update CopilotAIClient.js

* fix: gemini强制调用tool;real at

* feat: add bym support
This commit is contained in:
ikechan8370 2024-12-29 19:57:55 +08:00 committed by GitHub
parent 5f6c4e5abb
commit 26444df2a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 599 additions and 30 deletions

View file

@ -105,6 +105,7 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
* topP: number?,
* tokK: number?,
* replyPureTextCallback: Function,
* toolMode: 'AUTO' | 'ANY' | 'NONE'
* search: boolean,
* codeExecution: boolean
* }} opt
@ -199,9 +200,17 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
})
// ANY要笑死人的效果
let mode = opt.toolMode || 'AUTO'
let lastFuncName = opt.functionResponse?.name
const mustSendNextTurn = [
'searchImage', 'searchMusic', 'searchVideo'
]
if (lastFuncName && mustSendNextTurn.includes(lastFuncName)) {
mode = 'ANY'
}
body.tool_config = {
function_calling_config: {
mode: 'AUTO'
mode
}
}
}
@ -248,6 +257,7 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
const text = responseContent.parts.find(i => i.text)?.text
if (text) {
// send reply first
logger.info('send message: ' + text)
opt.replyPureTextCallback && await opt.replyPureTextCallback(text)
}
// Gemini有时候只回复一个空的functionCall,无语死了