mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Return empty result if no synthesized output from api
This commit is contained in:
parent
c3020e4ddc
commit
9d5b298dc0
1 changed files with 3 additions and 3 deletions
|
|
@ -246,7 +246,7 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction(
|
|||
try {
|
||||
const utteranceInput = req.body as UtteranceInput
|
||||
if (!utteranceInput.text) {
|
||||
return res.status(400).send('INVALID_INPUT')
|
||||
return res.send({ idx: utteranceInput.idx, audioData: '', speechMarks: [] })
|
||||
}
|
||||
|
||||
// validate if user has opted in to use ultra realistic voice feature
|
||||
|
|
@ -307,7 +307,7 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction(
|
|||
const [exists] = await audioFile.exists()
|
||||
if (exists) {
|
||||
console.debug('Audio file already exists')
|
||||
;[audioData] = await audioFile.download()
|
||||
;[audioData] = await audioFile.download()
|
||||
const [speechMarksExists] = await speechMarksFile.exists()
|
||||
if (speechMarksExists) {
|
||||
speechMarks = JSON.parse(
|
||||
|
|
@ -326,7 +326,7 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction(
|
|||
audioData = output.audioData
|
||||
speechMarks = output.speechMarks
|
||||
if (!audioData || audioData.length === 0) {
|
||||
return res.status(500).send({ errorCode: 'SYNTHESIZER_ERROR' })
|
||||
return res.send({ idx: utteranceInput.idx, audioData: '', speechMarks: [] })
|
||||
}
|
||||
|
||||
console.debug('saving audio file')
|
||||
|
|
|
|||
Loading…
Reference in a new issue