feat: 将前端录音转发给百炼websocket接口
This commit is contained in:
@@ -2,6 +2,7 @@ import json
|
||||
import base64
|
||||
import os
|
||||
import struct
|
||||
import asyncio
|
||||
|
||||
import websockets
|
||||
import time
|
||||
@@ -108,7 +109,6 @@ def add_websocket_voice_recognise_route(app: FastAPI):
|
||||
print(f"从百炼转发到客户端时出错: {e}")
|
||||
|
||||
# 并发运行两个任务
|
||||
import asyncio
|
||||
await asyncio.gather(
|
||||
forward_to_bailing(),
|
||||
forward_to_client(),
|
||||
@@ -118,8 +118,9 @@ def add_websocket_voice_recognise_route(app: FastAPI):
|
||||
except Exception as e:
|
||||
print(f"WebSocket连接错误: {e}")
|
||||
finally:
|
||||
print("finally ===>>>>>>>>>>>>>>>>>>>>>>>>>>>")
|
||||
# 清理连接
|
||||
if bailing_socket and not bailing_socket.closed:
|
||||
if bailing_socket and bailing_socket.open:
|
||||
await bailing_socket.close()
|
||||
|
||||
if receive_socket.application_state != WebSocketState.DISCONNECTED:
|
||||
|
||||
Reference in New Issue
Block a user