Merge pull request #2254 from pipecat-ai/mb/11labs-create-context-id
ElevenLabsTTSService: Only reset the context_id when interruptions ar…
This commit is contained in:
@@ -45,6 +45,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
`pyneuphonic` package. This removes a package requirement, allowing Neuphonic
|
`pyneuphonic` package. This removes a package requirement, allowing Neuphonic
|
||||||
to work with more services.
|
to work with more services.
|
||||||
|
|
||||||
|
- Updated `ElevenLabsTTSService` to handle the case where
|
||||||
|
`allow_interruptions=False`. Now, when interruptions are disabled, the same
|
||||||
|
context ID will be used throughout the conversation.
|
||||||
|
|
||||||
- Updated the `deepgram` optional dependency to 4.7.0, which downgrades the
|
- Updated the `deepgram` optional dependency to 4.7.0, which downgrades the
|
||||||
`tasks cancelled error` to a debug log. This removes the log from appearing
|
`tasks cancelled error` to a debug log. This removes the log from appearing
|
||||||
in Pipecat logs upon leaving.
|
in Pipecat logs upon leaving.
|
||||||
|
|||||||
@@ -642,9 +642,16 @@ class ElevenLabsTTSService(AudioContextWordTTSService):
|
|||||||
yield TTSStartedFrame()
|
yield TTSStartedFrame()
|
||||||
self._started = True
|
self._started = True
|
||||||
self._cumulative_time = 0
|
self._cumulative_time = 0
|
||||||
# Create new context ID and register it
|
# If a context ID does not exist, create a new one and
|
||||||
self._context_id = str(uuid.uuid4())
|
# register it. If an ID exists, that means the Pipeline is
|
||||||
await self.create_audio_context(self._context_id)
|
# 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())
|
||||||
|
if not self.audio_context_available(self._context_id):
|
||||||
|
await self.create_audio_context(self._context_id)
|
||||||
|
|
||||||
# Initialize context with voice settings
|
# Initialize context with voice settings
|
||||||
msg = {"text": " ", "context_id": self._context_id}
|
msg = {"text": " ", "context_id": self._context_id}
|
||||||
|
|||||||
Reference in New Issue
Block a user