游雁
2023-05-08 a6b790bffc56b27932c9a9e985bb71c437372822
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)