Browse Source

讯飞asr测试,debug

Davidliu 1 month ago
parent
commit
078b19086e
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/core/voip/asr.py

+ 5 - 5
src/core/voip/asr.py

@@ -248,24 +248,24 @@ class XfAsr:
             while self.ws.connected:
                 result = str(self.ws.recv())
                 if len(result) == 0:
-                    print("receive result end")
+                    self.logger.info("xunfei.Asr.recv: receive result end")
                     break
                 result_dict = json.loads(result)
                 # 解析结果
                 if result_dict["action"] == "started":
-                    print("handshake success, result: " + result)
+                    self.logger.info("xunfei.Asr.recv: handshake success, result: " + result)
 
                 if result_dict["action"] == "result":
                     result_1 = result_dict
                     # result_2 = json.loads(result_1["cn"])
                     # result_3 = json.loads(result_2["st"])
                     # result_4 = json.loads(result_3["rt"])
-                    print("rtasr result: " + result_1["data"])
+                    self.logger.info("xunfei.Asr.recv: rtasr result: " + result_1["data"])
 
                 if result_dict["action"] == "error":
-                    print("rtasr error: " + result)
+                    self.logger.info("xunfei.Asr.recv: rtasr error: " + result)
                     self.ws.close()
                     return
         except Exception as e:
             traceback.print_exc()
-            print("receive result end", e)
+            self.logger.error("xunfei.Asr.recv: receive result end", e)