diff --git a/app/controller/add_websocket_voice_recognise_route.py b/app/controller/add_websocket_voice_recognise_route.py index 56990e4..e956094 100644 --- a/app/controller/add_websocket_voice_recognise_route.py +++ b/app/controller/add_websocket_voice_recognise_route.py @@ -58,7 +58,7 @@ def add_websocket_voice_recognise_route(app: FastAPI): await bailian_socket.send(json.dumps(session_event)) # 创建双向转发任务 - async def forward_to_bailing(): + async def waiting_msg_from_front(): """将前端PCM数据转发到百炼""" try: while True: @@ -85,7 +85,7 @@ def add_websocket_voice_recognise_route(app: FastAPI): except Exception as e: print(f"等待前端的消息出错: {e}") - async def forward_to_client(): + async def waiting_msg_from_bailian(): """将百炼识别结果转发到客户端""" try: async for message in bailian_socket: @@ -110,8 +110,8 @@ def add_websocket_voice_recognise_route(app: FastAPI): # 并发运行两个任务 await asyncio.gather( - forward_to_bailing(), - forward_to_client(), + waiting_msg_from_front(), + waiting_msg_from_bailian(), return_exceptions=True )