From 65c18785016c099f40ff626c2c6a7dac91c3426f Mon Sep 17 00:00:00 2001
From: zhaomingwork <61895407+zhaomingwork@users.noreply.github.com>
Date: 星期二, 01 八月 2023 08:54:20 +0800
Subject: [PATCH] add is_final for python_ws_srv (#794)

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

diff --git a/funasr/runtime/python/websocket/funasr_wss_server.py b/funasr/runtime/python/websocket/funasr_wss_server.py
index 2aff9ba..57f7584 100644
--- a/funasr/runtime/python/websocket/funasr_wss_server.py
+++ b/funasr/runtime/python/websocket/funasr_wss_server.py
@@ -241,7 +241,7 @@
                     # print("offline", rec_result)
                 if 'text' in rec_result:
                     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})
+                    message = json.dumps({"mode": mode, "text": rec_result["text"], "wav_name": websocket.wav_name,"is_final":websocket.is_speaking})
                     await websocket.send(message)
 
 
@@ -258,7 +258,7 @@
             if rec_result["text"] != "sil" and rec_result["text"] != "waiting_for_more_voice":
                 # print("online", rec_result)
                 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})
+                message = json.dumps({"mode": mode, "text": rec_result["text"], "wav_name": websocket.wav_name,"is_final":websocket.is_speaking})
                 await websocket.send(message)
 
 if len(args.certfile)>0:

--
Gitblit v1.9.1