File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 99from websockets .sync .client import connect
1010
1111from .core .api_error import ApiError
12+ from .core .client_wrapper import SyncClientWrapper
1213from .core .jsonable_encoder import jsonable_encoder
1314from .core .remove_none_from_dict import remove_none_from_dict
1415from .core .request_options import RequestOptions
@@ -39,6 +40,9 @@ def text_chunker(chunks: typing.Iterator[str]) -> typing.Iterator[str]:
3940
4041
4142class RealtimeTextToSpeechClient (TextToSpeechClient ):
43+ def __init__ (self , * , client_wrapper : SyncClientWrapper ):
44+ super ().__init__ (client_wrapper = client_wrapper )
45+ self ._ws_base_url = urllib .parse .urlparse (self ._client_wrapper .get_base_url ())._replace (scheme = "wss" ).geturl ()
4246
4347 def convert_realtime (
4448 self ,
@@ -88,7 +92,7 @@ def get_text() -> typing.Iterator[str]:
8892 """
8993 with connect (
9094 urllib .parse .urljoin (
91- "wss://api.elevenlabs.io/" ,
95+ self . _ws_base_url ,
9296 f"v1/text-to-speech/{ jsonable_encoder (voice_id )} /stream-input?model_id={ model_id } &output_format={ output_format } "
9397 ),
9498 additional_headers = jsonable_encoder (
You can’t perform that action at this time.
0 commit comments