mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: 增加智能模式私聊开关
This commit is contained in:
parent
777279e410
commit
d96349dde3
5 changed files with 36 additions and 68 deletions
|
|
@ -29,7 +29,7 @@ import { SendAvatarTool } from '../utils/tools/SendAvatarTool.js'
|
|||
import { SerpImageTool } from '../utils/tools/SearchImageTool.js'
|
||||
import { SearchMusicTool } from '../utils/tools/SearchMusicTool.js'
|
||||
import { SendMusicTool } from '../utils/tools/SendMusicTool.js'
|
||||
import { SendAudioMessageTool } from '../utils/tools/SendAudioMessageTool.js'
|
||||
// import { SendAudioMessageTool } from '../utils/tools/SendAudioMessageTool.js'
|
||||
import { SendMessageToSpecificGroupOrUserTool } from '../utils/tools/SendMessageToSpecificGroupOrUserTool.js'
|
||||
import { QueryGenshinTool } from '../utils/tools/QueryGenshinTool.js'
|
||||
import { WeatherTool } from '../utils/tools/WeatherTool.js'
|
||||
|
|
@ -42,11 +42,11 @@ import { SerpIkechan8370Tool } from '../utils/tools/SerpIkechan8370Tool.js'
|
|||
import { SerpTool } from '../utils/tools/SerpTool.js'
|
||||
import common from '../../../lib/common/common.js'
|
||||
import { SendDiceTool } from '../utils/tools/SendDiceTool.js'
|
||||
import { EliMovieTool } from '../utils/tools/EliMovieTool.js'
|
||||
import { EliMusicTool } from '../utils/tools/EliMusicTool.js'
|
||||
// import { EliMovieTool } from '../utils/tools/EliMovieTool.js'
|
||||
// import { EliMusicTool } from '../utils/tools/EliMusicTool.js'
|
||||
import { HandleMessageMsgTool } from '../utils/tools/HandleMessageMsgTool.js'
|
||||
import { ProcessPictureTool } from '../utils/tools/ProcessPictureTool.js'
|
||||
import { ImageCaptionTool } from '../utils/tools/ImageCaptionTool.js'
|
||||
// import { ImageCaptionTool } from '../utils/tools/ImageCaptionTool.js'
|
||||
import { ChatGPTAPI } from '../utils/openai/chatgpt-api.js'
|
||||
import { newFetch } from '../utils/proxy.js'
|
||||
import { ChatGLM4Client } from '../client/ChatGLM4Client.js'
|
||||
|
|
@ -530,57 +530,10 @@ class Core {
|
|||
option.image = base64Image.toString('base64')
|
||||
}
|
||||
if (opt.enableSmart) {
|
||||
/**
|
||||
* @type {AbstractTool[]}
|
||||
*/
|
||||
let tools = [
|
||||
new QueryStarRailTool(),
|
||||
new WebsiteTool(),
|
||||
new SendPictureTool(),
|
||||
new SendVideoTool(),
|
||||
new SearchVideoTool(),
|
||||
new SendAvatarTool(),
|
||||
new SerpImageTool(),
|
||||
new SearchMusicTool(),
|
||||
new SendMusicTool(),
|
||||
new SendAudioMessageTool(),
|
||||
new APTool(),
|
||||
new SendMessageToSpecificGroupOrUserTool(),
|
||||
new QueryGenshinTool()
|
||||
]
|
||||
if (Config.amapKey) {
|
||||
tools.push(new WeatherTool())
|
||||
}
|
||||
if (e.isGroup) {
|
||||
tools.push(new QueryUserinfoTool())
|
||||
if (e.group.is_admin || e.group.is_owner) {
|
||||
tools.push(new EditCardTool())
|
||||
tools.push(new JinyanTool())
|
||||
tools.push(new KickOutTool())
|
||||
tools.push(new HandleMessageMsgTool())
|
||||
}
|
||||
if (e.group.is_owner) {
|
||||
tools.push(new SetTitleTool())
|
||||
}
|
||||
}
|
||||
switch (Config.serpSource) {
|
||||
case 'ikechan8370': {
|
||||
tools.push(new SerpIkechan8370Tool())
|
||||
break
|
||||
}
|
||||
case 'azure': {
|
||||
if (!Config.azSerpKey) {
|
||||
logger.warn('未配置bing搜索密钥,转为使用ikechan8370搜索源')
|
||||
tools.push(new SerpIkechan8370Tool())
|
||||
} else {
|
||||
tools.push(new SerpTool())
|
||||
}
|
||||
break
|
||||
}
|
||||
default: {
|
||||
tools.push(new SerpIkechan8370Tool())
|
||||
}
|
||||
}
|
||||
const {
|
||||
funcMap
|
||||
} = await collectTools(e)
|
||||
let tools = Object.keys(funcMap).map(k => funcMap[k].tool)
|
||||
client.addTools(tools)
|
||||
}
|
||||
let system = opt.system.gemini
|
||||
|
|
@ -822,12 +775,12 @@ async function collectTools (e) {
|
|||
new SetTitleTool()
|
||||
]
|
||||
// todo 3.0再重构tool的插拔和管理
|
||||
let /** @type{AbstractTool} **/ tools = [
|
||||
let /** @type{AbstractTool[]} **/ tools = [
|
||||
new SendAvatarTool(),
|
||||
new SendDiceTool(),
|
||||
new SendMessageToSpecificGroupOrUserTool(),
|
||||
// new EditCardTool(),
|
||||
// new QueryStarRailTool(),
|
||||
new QueryStarRailTool(),
|
||||
new QueryGenshinTool(),
|
||||
new SendMusicTool(),
|
||||
new SearchMusicTool(),
|
||||
|
|
@ -874,13 +827,15 @@ async function collectTools (e) {
|
|||
tools.forEach(tool => {
|
||||
funcMap[tool.name] = {
|
||||
exec: tool.func,
|
||||
function: tool.function()
|
||||
function: tool.function(),
|
||||
tool
|
||||
}
|
||||
})
|
||||
fullTools.forEach(tool => {
|
||||
fullFuncMap[tool.name] = {
|
||||
exec: tool.func,
|
||||
function: tool.function()
|
||||
function: tool.function(),
|
||||
tool
|
||||
}
|
||||
})
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue