diff --git a/guoba.support.js b/guoba.support.js index a5b022c..383766a 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -557,6 +557,25 @@ export function supportGuoba () { bottomHelpMessage: '对https://generativelanguage.googleapis.com的反代', component: 'Input' }, + { + field: 'geminiForceToolKeywords', + label: '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' diff --git a/model/core.js b/model/core.js index f898a2e..a7aa61c 100644 --- a/model/core.js +++ b/model/core.js @@ -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 ? 'ANY' : 'AUTO' return await client.sendMessage(prompt, option) } else if (use === 'chatglm4') { const client = new ChatGLM4Client({ diff --git a/utils/config.js b/utils/config.js index b30e544..edba6a4 100644 --- a/utils/config.js +++ b/utils/config.js @@ -228,6 +228,7 @@ const defaultConfig = { bingReasoning: false, // 是否深度思考 apiMaxToken: 4096, enableToolPrivateSend: true, // 是否允许智能模式下私聊骚扰其他群友。主人不受影响。 + geminiForceToolKeywords: [], version: 'v2.8.4' } const _path = process.cwd()