Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

websocket bug

游雁7314f0795c47
diff --git a/funasr/runtime/html5/demo.gif b/funasr/runtime/html5/demo.gif
deleted file mode 100644
index f487f2c66..000000000
Binary files a/funasr/runtime/html5/demo.gif and /dev/null differ
diff --git a/funasr/runtime/python/websocket/funasr_wss_client.py b/funasr/runtime/python/websocket/funasr_wss_client.py
index 72121f73c..264014f05 100644
--- a/funasr/runtime/python/websocket/funasr_wss_client.py
+++ b/funasr/runtime/python/websocket/funasr_wss_client.py
@@ -204,6 +204,7 @@ async def message(id):
meg = await websocket.recv()
meg = json.loads(meg)
+ print(meg)
wav_name = meg.get("wav_name", "demo")
text = meg["text"]
diff --git a/funasr/runtime/python/websocket/funasr_wss_server.py b/funasr/runtime/python/websocket/funasr_wss_server.py
index 4929090d8..2aff9ba0e 100644
--- a/funasr/runtime/python/websocket/funasr_wss_server.py
+++ b/funasr/runtime/python/websocket/funasr_wss_server.py
@@ -240,7 +240,8 @@ async def async_asr(websocket, audio_in):
param_dict=websocket.param_dict_punc)
# print("offline", rec_result)
if 'text' in rec_result:
- message = json.dumps({"mode": websocket.mode, "text": rec_result["text"], "wav_name": websocket.wav_name})
+ mode = "2pass-offline" if "2pass" in websocket.mode else websocket.mode
+ message = json.dumps({"mode": mode, "text": rec_result["text"], "wav_name": websocket.wav_name})
await websocket.send(message)
@@ -256,7 +257,8 @@ async def async_asr_online(websocket, audio_in):
if "text" in rec_result:
if rec_result["text"] != "sil" and rec_result["text"] != "waiting_for_more_voice":
# print("online", rec_result)
- message = json.dumps({"mode": websocket.mode, "text": rec_result["text"], "wav_name": websocket.wav_name})
+ mode = "2pass-online" if "2pass" in websocket.mode else websocket.mode
+ message = json.dumps({"mode": mode, "text": rec_result["text"], "wav_name": websocket.wav_name})
await websocket.send(message)
if len(args.certfile)>0: