mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
feat: add a tts tool
This commit is contained in:
parent
c3d9f65a03
commit
da27e6a1b3
4 changed files with 71 additions and 3 deletions
16
apps/chat.js
16
apps/chat.js
|
|
@ -61,6 +61,7 @@ import { SerpIkechan8370Tool } from '../utils/tools/SerpIkechan8370Tool.js'
|
|||
import { SendPictureTool } from '../utils/tools/SendPictureTool.js'
|
||||
import { SerpImageTool } from '../utils/tools/SearchImageTool.js'
|
||||
import { ImageCaptionTool } from '../utils/tools/ImageCaptionTool.js'
|
||||
import {TTSTool} from "../utils/tools/TTSTool.js";
|
||||
try {
|
||||
await import('emoji-strip')
|
||||
} catch (err) {
|
||||
|
|
@ -1971,7 +1972,8 @@ export class chatgpt extends plugin {
|
|||
new SearchVideoTool(),
|
||||
new SerpImageTool(),
|
||||
new SerpIkechan8370Tool(),
|
||||
new SerpTool()
|
||||
new SerpTool(),
|
||||
new TTSTool()
|
||||
]
|
||||
// todo 3.0再重构tool的插拔和管理
|
||||
let tools = [
|
||||
|
|
@ -1984,6 +1986,7 @@ export class chatgpt extends plugin {
|
|||
new KickOutTool(),
|
||||
new WeatherTool(),
|
||||
new SendPictureTool(),
|
||||
new TTSTool(),
|
||||
serpTool
|
||||
]
|
||||
let img = []
|
||||
|
|
@ -2044,7 +2047,16 @@ export class chatgpt extends plugin {
|
|||
logger.info(msg)
|
||||
while (msg.functionCall) {
|
||||
let { name, arguments: args } = msg.functionCall
|
||||
let functionResult = await fullFuncMap[name].exec(Object.assign({ isAdmin, sender }, JSON.parse(args)))
|
||||
args = JSON.parse(args)
|
||||
if (!args.groupId) {
|
||||
args.groupId = e.group_id || e.sender.user_id
|
||||
}
|
||||
try {
|
||||
parseInt(args.groupId)
|
||||
} catch (err) {
|
||||
args.groupId = e.group_id || e.sender.user_id
|
||||
}
|
||||
let functionResult = await fullFuncMap[name].exec(Object.assign({ isAdmin, sender }, ))
|
||||
logger.mark(`function ${name} execution result: ${functionResult}`)
|
||||
option.parentMessageId = msg.id
|
||||
option.name = name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue