Merge pull request #3363 from pipecat-ai/mb/update-audo-context-inheritance
Update AudioContextTTSService to inherit from WebsocketTTSService
This commit is contained in:
@@ -901,7 +901,7 @@ class InterruptibleWordTTSService(WebsocketWordTTSService):
|
|||||||
self._bot_speaking = False
|
self._bot_speaking = False
|
||||||
|
|
||||||
|
|
||||||
class AudioContextTTSService(WebsocketService):
|
class AudioContextTTSService(WebsocketTTSService):
|
||||||
"""Base class for websocket-based TTS services with audio context management.
|
"""Base class for websocket-based TTS services with audio context management.
|
||||||
|
|
||||||
This is a base class for websocket-based TTS services that allow correlating
|
This is a base class for websocket-based TTS services that allow correlating
|
||||||
@@ -921,7 +921,7 @@ class AudioContextTTSService(WebsocketService):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
reconnect_on_error: Whether to automatically reconnect on websocket errors.
|
reconnect_on_error: Whether to automatically reconnect on websocket errors.
|
||||||
**kwargs: Additional arguments passed to the parent WebsocketService.
|
**kwargs: Additional arguments passed to the parent WebsocketTTSService.
|
||||||
"""
|
"""
|
||||||
super().__init__(reconnect_on_error=reconnect_on_error, **kwargs)
|
super().__init__(reconnect_on_error=reconnect_on_error, **kwargs)
|
||||||
self._contexts: Dict[str, asyncio.Queue] = {}
|
self._contexts: Dict[str, asyncio.Queue] = {}
|
||||||
@@ -1077,10 +1077,12 @@ class AudioContextWordTTSService(AudioContextTTSService, WebsocketWordTTSService
|
|||||||
with the word timestamp functionality of WebsocketWordTTSService.
|
with the word timestamp functionality of WebsocketWordTTSService.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, *, reconnect_on_error: bool = True, **kwargs):
|
||||||
"""Initialize the Audio Context Word TTS service.
|
"""Initialize the Audio Context Word TTS service.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
reconnect_on_error: Whether to automatically reconnect on websocket errors.
|
||||||
**kwargs: Additional arguments passed to parent classes.
|
**kwargs: Additional arguments passed to parent classes.
|
||||||
"""
|
"""
|
||||||
super().__init__(**kwargs)
|
AudioContextTTSService.__init__(self, reconnect_on_error=reconnect_on_error, **kwargs)
|
||||||
|
WebsocketWordTTSService.__init__(self, reconnect_on_error=reconnect_on_error, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user