@@ -73,6 +73,8 @@ export default defineNuxtConfig({
|
||||
},
|
||||
routeRules: {
|
||||
'/assets/**': { static: true },
|
||||
'/assets/js/**': { static: true },
|
||||
'/assets/live2d/models/**': { static: true },
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
+1
-3
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
// })
|
||||
|
||||
Reference in New Issue
Block a user