Merge pull request #9 from ikechan8370/v2

up
This commit is contained in:
ycxom 2025-02-17 02:32:58 +08:00 committed by GitHub
commit d41ceec7da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 1 deletions

View file

@ -245,6 +245,8 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
if (lastFuncName && lastFuncName?.find(name => mustSendNextTurn.includes(name))) {
mode = 'ANY'
}
// 防止死循环。
delete opt.toolMode
body.tool_config = {
function_calling_config: {
mode

View file

@ -557,6 +557,26 @@ export function supportGuoba () {
bottomHelpMessage: '对https://generativelanguage.googleapis.com的反代',
component: 'Input'
},
{
field: 'geminiForceToolKeywords',
label: 'gemini强制工具关键词',
bottomHelpMessage: 'gemini强制工具关键词包含这里关键词的问题一定会调用工具。',
component: 'GTags',
componentProps: {
placeholder: '请输入强制工具关键词',
allowAdd: true,
allowDel: true,
showPrompt: true,
promptProps: {
content: '添加新的强制工具关键词',
okText: '添加',
rules: [
{ required: true, message: '强制工具关键词不能为空' }
]
},
valueParser: (value) => value.split(',') || []
}
},
{
label: '以下为一些杂项配置。',
component: 'Divider'

View file

@ -127,7 +127,8 @@ class Core {
},
settings: {
replyPureTextCallback: undefined,
enableGroupContext: Config.enableGroupContext
enableGroupContext: Config.enableGroupContext,
forceTool: false
}
}) {
if (!conversation) {
@ -567,6 +568,7 @@ class Core {
await e.reply(msg, true)
}
})
option.toolMode = (opt.settings.forceTool || Config.geminiForceToolKeywords?.find(k => prompt.includes(k))) ? 'ANY' : 'AUTO'
return await client.sendMessage(prompt, option)
} else if (use === 'chatglm4') {
const client = new ChatGLM4Client({

View file

@ -228,6 +228,7 @@ const defaultConfig = {
bingReasoning: false, // 是否深度思考
apiMaxToken: 4096,
enableToolPrivateSend: true, // 是否允许智能模式下私聊骚扰其他群友。主人不受影响。
geminiForceToolKeywords: [],
version: 'v2.8.4'
}
const _path = process.cwd()