From 9cbf3920367122f4711e8ec3ea38eeca73138e9a Mon Sep 17 00:00:00 2001 From: Dragon-Fish Date: Fri, 10 Nov 2023 18:30:21 +0800 Subject: [PATCH] fix(openai): update tts options --- src/plugins/openai/index.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/openai/index.tsx b/src/plugins/openai/index.tsx index 42453dc..f418d1d 100644 --- a/src/plugins/openai/index.tsx +++ b/src/plugins/openai/index.tsx @@ -314,12 +314,13 @@ export default class PluginOpenAi extends BasePlugin { }) this.ctx - .command('openai.tts ', '说话', { + .command('openai.tts ', 'Generates audio from the input text', { maxUsage: 3, bypassAuthority: 3, }) - .option('voice', '-v ') - .option('speed', '-s ') + .option('model', '-m tts-1 or tts-1-hd') + .option('voice', '-v alloy, echo, fable, onyx, nova, and shimmer') + .option('speed', '-s 0.25 - 4.0') .action(async ({ options }, input) => { if (!input) { return 'SILI不知道你想说什么呢。' @@ -376,7 +377,7 @@ export default class PluginOpenAi extends BasePlugin { ) { const data = await this.openai.audio.speech.create({ model: 'tts-1', - voice: 'alloy', + voice: 'nova', input, response_format: 'mp3', speed: 1, @@ -485,10 +486,10 @@ export default class PluginOpenAi extends BasePlugin { } formatRecords(records: Session.Payload[]) { return JSON.stringify( - records.map(({ author, content }) => { + records.map((session) => { return { - user: author.nickname || author.username || author.userId, - msg: content, + user: getUserNickFromSession(session), + msg: session.content, } }) )