Skip to content

Commit

Permalink
chore: fix
Browse files Browse the repository at this point in the history
Signed-off-by: Neko Ayaka <[email protected]>
  • Loading branch information
nekomeowww committed Dec 2, 2024
1 parent ecbeee3 commit f7fd500
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
1 change: 0 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export default defineNuxtConfig({
target: 'esnext',
},
},
noExternals: false,
routeRules: {
'/assets/**': { static: true },
'/assets/js/**': { static: true },
Expand Down
52 changes: 26 additions & 26 deletions server/api/v1/llm/voice/text-to-speech.ts
Original file line number Diff line number Diff line change
@@ -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)
// })

0 comments on commit f7fd500

Please sign in to comment.