feat: 前后端代码都需要改造封装一下,不然可读性很差

This commit is contained in:
martsforever
2025-11-02 16:51:55 +08:00
parent 6a213fe655
commit 66816ad006
@@ -83,7 +83,7 @@ def add_websocket_voice_recognise_route(app: FastAPI):
# print("已转发音频数据到百炼", f"PCM二进制数据,长度: {len(pcm_bytes)} 字节") # print("已转发音频数据到百炼", f"PCM二进制数据,长度: {len(pcm_bytes)} 字节")
except Exception as e: except Exception as e:
print(f"转发到百炼时出错: {e}") print(f"等待前端的消息出错: {e}")
async def forward_to_client(): async def forward_to_client():
"""将百炼识别结果转发到客户端""" """将百炼识别结果转发到客户端"""
@@ -106,7 +106,7 @@ def add_websocket_voice_recognise_route(app: FastAPI):
}, ensure_ascii=False)) }, ensure_ascii=False))
except Exception as e: except Exception as e:
print(f"从百炼转发到客户端时出错: {e}") print(f"等待百炼的消息出错: {e}")
# 并发运行两个任务 # 并发运行两个任务
await asyncio.gather( await asyncio.gather(