From 7557fa87a8043867e39f4920b38d6163d54095ef Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: 星期一, 08 五月 2023 00:13:59 +0800
Subject: [PATCH] Merge pull request #468 from alibaba-damo-academy/dev_websocket_offline

---
 funasr/runtime/python/websocket/ws_server_online.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/funasr/runtime/python/websocket/ws_server_online.py b/funasr/runtime/python/websocket/ws_server_online.py
index 6ea8f39..b1cd4ea 100644
--- a/funasr/runtime/python/websocket/ws_server_online.py
+++ b/funasr/runtime/python/websocket/ws_server_online.py
@@ -53,7 +53,7 @@
 
                 is_speaking = message["is_speaking"]
                 websocket.param_dict_asr_online["is_final"] = not is_speaking
-
+                websocket.wav_name = message.get("wav_name", "demo")
                 websocket.param_dict_asr_online["chunk_size"] = message["chunk_size"]
                 
                 frames_online.append(audio)
@@ -81,9 +81,9 @@
                     websocket.param_dict_asr_online["cache"] = dict()
                 if "text" in rec_result:
                     if rec_result["text"] != "sil" and rec_result["text"] != "waiting_for_more_voice":
-                        if len(rec_result["text"])>0:
-                            rec_result["text"][0]=rec_result["text"][0] #.replace(" ","")
-                        message = json.dumps({"mode": "online", "text": rec_result["text"]})
+                        # if len(rec_result["text"])>0:
+                        #     rec_result["text"][0]=rec_result["text"][0] #.replace(" ","")
+                        message = json.dumps({"mode": "online", "text": rec_result["text"], "wav_name": websocket.wav_name})
                         await websocket.send(message)
 
 

--
Gitblit v1.9.1