Add language and rate in the cloud task params

This commit is contained in:
Hongbo Wu 2022-11-08 16:22:23 +08:00
parent 769e8c5f96
commit ddd1e84686
2 changed files with 9 additions and 3 deletions

View file

@ -68,9 +68,7 @@ export function textToSpeechRouter() {
content: page.content,
options: {
primaryVoice: userPersonalization?.speechVoice || 'Axel',
secondaryVoice: userPersonalization?.speechVoice || 'Evelyn',
language: page.language || 'English',
rate: '1.1',
secondaryVoice: 'Evelyn',
},
})
@ -83,6 +81,8 @@ export function textToSpeechRouter() {
voice: utterance.voice || 'Axel',
priority: 'high',
isUltraRealisticVoice: true,
language: page.language || 'English',
rate: '1.1',
})
logger.info('Start Text to speech task', { taskName })
}

View file

@ -345,6 +345,8 @@ export const enqueueTextToSpeech = async ({
queue = 'omnivore-demo-text-to-speech-queue',
location = env.gcp.location,
isUltraRealisticVoice = false,
language,
rate,
}: {
userId: string
speechId: string
@ -356,6 +358,8 @@ export const enqueueTextToSpeech = async ({
queue?: string
location?: string
isUltraRealisticVoice?: boolean
language?: string
rate?: string
}): Promise<string> => {
const { GOOGLE_CLOUD_PROJECT } = process.env
const payload = {
@ -365,6 +369,8 @@ export const enqueueTextToSpeech = async ({
bucket,
textType,
isUltraRealisticVoice,
language,
rate,
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore