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 8b1338c commit 87e8413
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 2 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export default defineNuxtConfig({
},
routeRules: {
'/assets/**': { static: true },
'/assets/js/**': { static: true },
'/assets/live2d/models/**': { static: true },
},
},

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@
"vite-plugin-inspect": "^0.10.2",
"vue-tsc": "^2.1.10",
"yauzl": "^3.2.0",
"zod": "^3.23.8"
},
"dependencies": {
"zod": "^3.23.8",
"elevenlabs": "^0.18.1"
}
}
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 87e8413

Please sign in to comment.