ElevenLabsTTSService: Only reset the context_id when interruptions are enabled
This commit is contained in:
@@ -642,8 +642,14 @@ class ElevenLabsTTSService(AudioContextWordTTSService):
|
||||
yield TTSStartedFrame()
|
||||
self._started = True
|
||||
self._cumulative_time = 0
|
||||
# Create new context ID and register it
|
||||
self._context_id = str(uuid.uuid4())
|
||||
# If a context ID does not exist, create a new one and
|
||||
# register it. If an ID exists, that means the Pipeline is
|
||||
# configured for allow_interruptions=False, so continue
|
||||
# using the current ID. When interruptions are enabled
|
||||
# (e.g. allow_interruptions=True), user speech results in
|
||||
# an interruption, which resets the context ID.
|
||||
if not self._context_id:
|
||||
self._context_id = str(uuid.uuid4())
|
||||
await self.create_audio_context(self._context_id)
|
||||
|
||||
# Initialize context with voice settings
|
||||
|
||||
Reference in New Issue
Block a user