feat: rename variable
This commit is contained in:
@@ -58,7 +58,7 @@ def add_websocket_voice_recognise_route(app: FastAPI):
|
|||||||
await bailian_socket.send(json.dumps(session_event))
|
await bailian_socket.send(json.dumps(session_event))
|
||||||
|
|
||||||
# 创建双向转发任务
|
# 创建双向转发任务
|
||||||
async def forward_to_bailing():
|
async def waiting_msg_from_front():
|
||||||
"""将前端PCM数据转发到百炼"""
|
"""将前端PCM数据转发到百炼"""
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
@@ -85,7 +85,7 @@ def add_websocket_voice_recognise_route(app: FastAPI):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"等待前端的消息出错: {e}")
|
print(f"等待前端的消息出错: {e}")
|
||||||
|
|
||||||
async def forward_to_client():
|
async def waiting_msg_from_bailian():
|
||||||
"""将百炼识别结果转发到客户端"""
|
"""将百炼识别结果转发到客户端"""
|
||||||
try:
|
try:
|
||||||
async for message in bailian_socket:
|
async for message in bailian_socket:
|
||||||
@@ -110,8 +110,8 @@ def add_websocket_voice_recognise_route(app: FastAPI):
|
|||||||
|
|
||||||
# 并发运行两个任务
|
# 并发运行两个任务
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
forward_to_bailing(),
|
waiting_msg_from_front(),
|
||||||
forward_to_client(),
|
waiting_msg_from_bailian(),
|
||||||
return_exceptions=True
|
return_exceptions=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user