dashscope 1.20.2__py3-none-any.whl → 1.20.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dashscope might be problematic. Click here for more details.
- dashscope/audio/tts_v2/speech_synthesizer.py +12 -6
- dashscope/version.py +1 -1
- {dashscope-1.20.2.dist-info → dashscope-1.20.3.dist-info}/METADATA +1 -1
- {dashscope-1.20.2.dist-info → dashscope-1.20.3.dist-info}/RECORD +8 -8
- {dashscope-1.20.2.dist-info → dashscope-1.20.3.dist-info}/LICENSE +0 -0
- {dashscope-1.20.2.dist-info → dashscope-1.20.3.dist-info}/WHEEL +0 -0
- {dashscope-1.20.2.dist-info → dashscope-1.20.3.dist-info}/entry_points.txt +0 -0
- {dashscope-1.20.2.dist-info → dashscope-1.20.3.dist-info}/top_level.txt +0 -0
|
@@ -345,7 +345,7 @@ class SpeechSynthesizer:
|
|
|
345
345
|
self.__submit_text(text)
|
|
346
346
|
return None
|
|
347
347
|
|
|
348
|
-
def streaming_complete(self, complete_timeout_millis=
|
|
348
|
+
def streaming_complete(self, complete_timeout_millis=600000):
|
|
349
349
|
"""
|
|
350
350
|
Synchronously stop the streaming input speech synthesis task.
|
|
351
351
|
Wait for all remaining synthesized audio before returning
|
|
@@ -376,14 +376,18 @@ class SpeechSynthesizer:
|
|
|
376
376
|
self._is_started = False
|
|
377
377
|
|
|
378
378
|
def __waiting_for_complete(self, timeout):
|
|
379
|
-
if not
|
|
380
|
-
|
|
381
|
-
|
|
379
|
+
if timeout is not None and timeout > 0:
|
|
380
|
+
if not self.complete_event.wait(timeout=timeout / 1000):
|
|
381
|
+
raise TimeoutError(
|
|
382
|
+
f'speech synthesizer wait for complete timeout {timeout}ms'
|
|
383
|
+
)
|
|
384
|
+
else:
|
|
385
|
+
self.complete_event.wait()
|
|
382
386
|
self.close()
|
|
383
387
|
self._stopped.set()
|
|
384
388
|
self._is_started = False
|
|
385
389
|
|
|
386
|
-
def async_streaming_complete(self, complete_timeout_millis=
|
|
390
|
+
def async_streaming_complete(self, complete_timeout_millis=600000):
|
|
387
391
|
"""
|
|
388
392
|
Asynchronously stop the streaming input speech synthesis task, returns immediately.
|
|
389
393
|
You need to listen and handle the STREAM_INPUT_TTS_EVENT_SYNTHESIS_COMPLETE event in the on_event callback.
|
|
@@ -445,6 +449,7 @@ class SpeechSynthesizer:
|
|
|
445
449
|
self.callback.on_close()
|
|
446
450
|
else:
|
|
447
451
|
logger.error(f'TaskFailed: {message}')
|
|
452
|
+
raise Exception(f'TaskFailed: {message}')
|
|
448
453
|
elif EventType.GENERATED == event:
|
|
449
454
|
if self.callback:
|
|
450
455
|
self.callback.on_event(message)
|
|
@@ -452,6 +457,7 @@ class SpeechSynthesizer:
|
|
|
452
457
|
pass
|
|
453
458
|
except json.JSONDecodeError:
|
|
454
459
|
logger.error('Failed to parse message as JSON.')
|
|
460
|
+
raise Exception('Failed to parse message as JSON.')
|
|
455
461
|
elif isinstance(message, (bytes, bytearray)):
|
|
456
462
|
# 如果失败,认为是二进制消息
|
|
457
463
|
logger.debug('<<<recv binary {}'.format(len(message)))
|
|
@@ -510,10 +516,10 @@ class SpeechSynthesizer:
|
|
|
510
516
|
# WebSocket关闭的回调函数
|
|
511
517
|
def on_close(self, ws, close_status_code, close_msg):
|
|
512
518
|
pass
|
|
513
|
-
# print("### websocket closed msg [{}]{} ###".format(close_status_code, close_msg))
|
|
514
519
|
|
|
515
520
|
# WebSocket发生错误的回调函数
|
|
516
521
|
def on_error(self, ws, error):
|
|
522
|
+
print(f'websocket closed due to {error}')
|
|
517
523
|
raise Exception(f'websocket closed due to {error}')
|
|
518
524
|
|
|
519
525
|
# 关闭WebSocket连接
|
dashscope/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.20.
|
|
1
|
+
__version__ = '1.20.3'
|
|
@@ -6,7 +6,7 @@ dashscope/files.py,sha256=QgJjwhtn9F548nCA8jD8OvE6aQEj-20hZqJgYXsUdQU,3930
|
|
|
6
6
|
dashscope/finetune.py,sha256=_tflDUvu0KagSoCzLaf0hofpG_P8NU6PylL8CPjVhrA,6243
|
|
7
7
|
dashscope/model.py,sha256=UPOn1qMYFhX-ovXi3BMxZEBk8qOK7WLJOYHMbPZwYBo,1440
|
|
8
8
|
dashscope/models.py,sha256=1-bc-Ue68zurgu_y6RhfFr9uzeQMF5AZq-C32lJGMGU,1224
|
|
9
|
-
dashscope/version.py,sha256=
|
|
9
|
+
dashscope/version.py,sha256=axe7tbDmiC_ViryS2MD_XVQpBGZsB2RQ0ksPIJnHWeo,23
|
|
10
10
|
dashscope/aigc/__init__.py,sha256=s-MCA87KYiVumYtKtJi5IMN7xelSF6TqEU3s3_7RF-Y,327
|
|
11
11
|
dashscope/aigc/code_generation.py,sha256=KAJVrGp6tiNFBBg64Ovs9RfcP5SrIhrbW3wdA89NKso,10885
|
|
12
12
|
dashscope/aigc/conversation.py,sha256=xRoJlCR-IXHjSdkDrK74a9ut1FJg0FZhTNXZAJC18MA,14231
|
|
@@ -36,7 +36,7 @@ dashscope/audio/asr/transcription.py,sha256=1WAg9WH89antVzRYEKXb5LQP9xylZmX4YKp7
|
|
|
36
36
|
dashscope/audio/tts/__init__.py,sha256=fbnieZX9yNFNh5BsxLpLXb63jlxzxrdCJakV3ignjlQ,194
|
|
37
37
|
dashscope/audio/tts/speech_synthesizer.py,sha256=dnKx9FDDdO_ETHAjhK8zaMVaH6SfoTtN5YxXXqgY1JA,7571
|
|
38
38
|
dashscope/audio/tts_v2/__init__.py,sha256=ve5a81qTbWDcRaSuritZtJBzryOIol2_dxzfqqdCw-k,345
|
|
39
|
-
dashscope/audio/tts_v2/speech_synthesizer.py,sha256=
|
|
39
|
+
dashscope/audio/tts_v2/speech_synthesizer.py,sha256=bpzj9gx2D_FfOzgsjU-GBGmeWvEdewNPFd447mOgM-o,19220
|
|
40
40
|
dashscope/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
41
|
dashscope/client/base_api.py,sha256=rXN97XGyDhCCaD_dz_clpFDjOJfpGjqiH7yX3LaD-GE,41233
|
|
42
42
|
dashscope/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -82,9 +82,9 @@ dashscope/tokenizers/tokenizer.py,sha256=y6P91qTCYo__pEx_0VHAcj9YECfbUdRqZU1fdGT
|
|
|
82
82
|
dashscope/tokenizers/tokenizer_base.py,sha256=REDhzRyDT13iequ61-a6_KcTy0GFKlihQve5HkyoyRs,656
|
|
83
83
|
dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
84
|
dashscope/utils/oss_utils.py,sha256=fi8-PPsN-iR-iv5k2NS5Z8nlWkpgUhr56FRWm4BDh4A,6984
|
|
85
|
-
dashscope-1.20.
|
|
86
|
-
dashscope-1.20.
|
|
87
|
-
dashscope-1.20.
|
|
88
|
-
dashscope-1.20.
|
|
89
|
-
dashscope-1.20.
|
|
90
|
-
dashscope-1.20.
|
|
85
|
+
dashscope-1.20.3.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
|
|
86
|
+
dashscope-1.20.3.dist-info/METADATA,sha256=JUS8qY6hiQtwyE2f65w3JBnaqUsyhAV3kfwE-4KkSoM,6641
|
|
87
|
+
dashscope-1.20.3.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
88
|
+
dashscope-1.20.3.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
|
|
89
|
+
dashscope-1.20.3.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
|
|
90
|
+
dashscope-1.20.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|