feat: 初步支持function call(WIP)

This commit is contained in:
ikechan8370 2023-06-23 01:09:12 +08:00
parent 4a4dceec18
commit 97b3acbf3b
24 changed files with 13607 additions and 841 deletions

View file

@ -0,0 +1,33 @@
import {AbstractTool} from "./AbstractTool.js";
export class SendPictureTool extends AbstractTool {
name = 'sendPicture'
parameters = {
picture: {
type: 'string',
description: '图片的url,多个用空格隔开'
},
groupId: {
type: 'string',
description: '群号或qq号发送目标'
},
required: ['picture', 'groupId']
}
func = async function (picture, groupId) {
let pictures = picture.trim().split(' ')
pictures = pictures.map(img => segment.image(img))
let groupList = await Bot.getGroupList()
if (groupList.get(groupId)) {
let group = await Bot.pickGroup(groupId)
await group.sendMsg(pictures)
} else {
let user = await Bot.pickFriend(groupId)
await user.sendMsg(pictures)
}
}
description = 'Useful when you want to send some pictures. The input to this tool should be the url of the pictures and the group number or the user\'s qq number, each url and the group number or qq number should be concated with a space, and the group number or qq number should be the last. 如果是在群聊中,优先选择群号发送。'
}