diff --git a/vocode/streaming/synthesizer/base_synthesizer.py b/vocode/streaming/synthesizer/base_synthesizer.py index a7d28bc7f..435f0b3f3 100644 --- a/vocode/streaming/synthesizer/base_synthesizer.py +++ b/vocode/streaming/synthesizer/base_synthesizer.py @@ -158,6 +158,9 @@ def get_message_cutoff_from_total_response_length( estimated_output_seconds = ( size_of_output / self.synthesizer_config.sampling_rate ) + if not message.text: + return message.text + estimated_output_seconds_per_char = estimated_output_seconds / len(message.text) return message.text[: int(seconds / estimated_output_seconds_per_char)]