Fix an issue in ElevenLabsHttpTTSService where the last word is not emitted
This commit is contained in:
@@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an issue in `ElevenLabsTTSService` and `ElevenLabsHttpTTSService` where
|
||||||
|
the Flash models would split words, resulting in a space being inserted
|
||||||
|
between words.
|
||||||
|
|
||||||
- Fixed an issue where audio filters' `stop()` would not be called when using
|
- Fixed an issue where audio filters' `stop()` would not be called when using
|
||||||
`CancelFrame`.
|
`CancelFrame`.
|
||||||
|
|
||||||
|
|||||||
@@ -1070,6 +1070,14 @@ class ElevenLabsHttpTTSService(WordTTSService):
|
|||||||
logger.error(f"Error processing response: {e}", exc_info=True)
|
logger.error(f"Error processing response: {e}", exc_info=True)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# After processing all chunks, emit any remaining partial word
|
||||||
|
# since this is the end of the utterance
|
||||||
|
if self._partial_word:
|
||||||
|
final_word_time = [(self._partial_word, self._partial_word_start_time)]
|
||||||
|
await self.add_word_timestamps(final_word_time)
|
||||||
|
self._partial_word = ""
|
||||||
|
self._partial_word_start_time = 0.0
|
||||||
|
|
||||||
# After processing all chunks, add the total utterance duration
|
# After processing all chunks, add the total utterance duration
|
||||||
# to the cumulative time to ensure next utterance starts after this one
|
# to the cumulative time to ensure next utterance starts after this one
|
||||||
if utterance_duration > 0:
|
if utterance_duration > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user