debug: 增加了讯飞语音识别接口的timeout机制,防止语音识别未完成时连接断开

This commit is contained in:
killua committed 2024-06-05 14:57:18 +08:00
1 parent 2378fee258
commit 5975d4687f
3 files changed
+40 -13

No files matched your search

+6 -1
View File
@@ -1,3 +1,4 @@
import websockets
import datetime
import hashlib
import base64
@@ -61,4 +62,8 @@ def parse_xfasr_recv(message):
for i in data:
for w in i['cw']:
result += w['w']
return result
return result
async def xf_asr_websocket_factory():
url = generate_xf_asr_url()
return await websockets.connect(url)