From f7fd50098648ec25e57725d3f03365061930b678 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Mon, 2 Dec 2024 21:03:53 +0800 Subject: [PATCH] chore: fix Signed-off-by: Neko Ayaka --- nuxt.config.ts | 1 - server/api/v1/llm/voice/text-to-speech.ts | 52 +++++++++++------------ 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index b9b1e48..6a1d03d 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -71,7 +71,6 @@ export default defineNuxtConfig({ target: 'esnext', }, }, - noExternals: false, routeRules: { '/assets/**': { static: true }, '/assets/js/**': { static: true }, diff --git a/server/api/v1/llm/voice/text-to-speech.ts b/server/api/v1/llm/voice/text-to-speech.ts index 553ea53..0d1d8f1 100644 --- a/server/api/v1/llm/voice/text-to-speech.ts +++ b/server/api/v1/llm/voice/text-to-speech.ts @@ -1,30 +1,30 @@ -import { ElevenLabsClient } from 'elevenlabs' +// import { ElevenLabsClient } from 'elevenlabs' -export default defineEventHandler(async (event) => { - const body = await readBody<{ text: string, apiKey: string }>(event) - const client = new ElevenLabsClient({ - apiKey: body.apiKey, - }) +// export default defineEventHandler(async (event) => { +// const body = await readBody<{ text: string, apiKey: string }>(event) +// const client = new ElevenLabsClient({ +// apiKey: body.apiKey, +// }) - const res = await client.generate({ - // voice: 'ShanShan', - // Quite good for English - voice: 'Myriam', - // Beatrice is not 'childish' like the others - // voice: 'Beatrice', - text: body.text, - stream: true, - model_id: 'eleven_multilingual_v2', - voice_settings: { - stability: 0.4, - similarity_boost: 0.5, - }, - }) +// const res = await client.generate({ +// // voice: 'ShanShan', +// // Quite good for English +// voice: 'Myriam', +// // Beatrice is not 'childish' like the others +// // voice: 'Beatrice', +// text: body.text, +// stream: true, +// model_id: 'eleven_multilingual_v2', +// voice_settings: { +// stability: 0.4, +// similarity_boost: 0.5, +// }, +// }) - // Set headers for streaming - event.node.res.setHeader('Content-Type', 'audio/mpeg') - event.node.res.setHeader('Transfer-Encoding', 'chunked') +// // Set headers for streaming +// event.node.res.setHeader('Content-Type', 'audio/mpeg') +// event.node.res.setHeader('Transfer-Encoding', 'chunked') - // res is NodeJS.ReadableStream - return sendStream(event, res) -}) +// // res is NodeJS.ReadableStream +// return sendStream(event, res) +// })