mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 22:07:10 +00:00
feat: 初步支持function call(WIP)
This commit is contained in:
parent
4a4dceec18
commit
97b3acbf3b
24 changed files with 13607 additions and 841 deletions
33
utils/tools/SendAvatarTool.js
Normal file
33
utils/tools/SendAvatarTool.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import {AbstractTool} from "./AbstractTool.js";
|
||||
|
||||
export class SendAvatarTool extends AbstractTool {
|
||||
name = 'sendAvatar'
|
||||
|
||||
parameters = {
|
||||
properties: {
|
||||
qq: {
|
||||
type: 'string',
|
||||
description: '要发头像的人的qq号'
|
||||
},
|
||||
groupId: {
|
||||
type: 'string',
|
||||
description: '群号或qq号,发送目标'
|
||||
}
|
||||
},
|
||||
required: ['qq', 'groupId']
|
||||
}
|
||||
|
||||
func = async function (opts) {
|
||||
let {qq, groupId} = opts
|
||||
let groupList = await Bot.getGroupList()
|
||||
groupId = parseInt(groupId.trim())
|
||||
console.log('sendAvatar', groupId, qq)
|
||||
if (groupList.get(groupId)) {
|
||||
let group = await Bot.pickGroup(groupId)
|
||||
await group.sendMsg(segment.image('https://q1.qlogo.cn/g?b=qq&s=0&nk=' + qq))
|
||||
}
|
||||
return `the user ${qq}'s avatar has been sent to group ${groupId}`
|
||||
}
|
||||
|
||||
description = 'Useful when you want to send the user avatar picture to the group. The input to this tool should be the user\'s qq number and the target group number, and they should be concated with a space. 如果是在群聊中,优先选择群号发送。'
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue