(textToSpeechConfig: string | undefined | null)
| 74 | import { Organization } from '../enterprise/database/entities/organization.entity' |
| 75 | |
| 76 | const shouldAutoPlayTTS = (textToSpeechConfig: string | undefined | null): boolean => { |
| 77 | if (!textToSpeechConfig) return false |
| 78 | try { |
| 79 | const config = typeof textToSpeechConfig === 'string' ? JSON.parse(textToSpeechConfig) : textToSpeechConfig |
| 80 | for (const providerKey in config) { |
| 81 | const provider = config[providerKey] |
| 82 | if (provider && provider.status === true && provider.autoPlay === true) { |
| 83 | return true |
| 84 | } |
| 85 | } |
| 86 | return false |
| 87 | } catch (error) { |
| 88 | logger.error(`Error parsing textToSpeechConfig: ${getErrorMessage(error)}`) |
| 89 | return false |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | const generateTTSForResponseStream = async ( |
| 94 | responseText: string, |
no test coverage detected