From 6be2975020ad3524fed585f519ae6d11f02eae4e Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期一, 08 一月 2024 16:51:27 +0800
Subject: [PATCH] json stamp_sents

---
 runtime/websocket/bin/websocket-server-2pass.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/runtime/websocket/bin/websocket-server-2pass.cpp b/runtime/websocket/bin/websocket-server-2pass.cpp
index 0269e5f..c251e1d 100644
--- a/runtime/websocket/bin/websocket-server-2pass.cpp
+++ b/runtime/websocket/bin/websocket-server-2pass.cpp
@@ -83,8 +83,15 @@
 
   std::string tmp_stamp_sents = FunASRGetStampSents(result);
   if (tmp_stamp_sents != "") {
-    LOG(INFO) << "offline stamp_sents : " << tmp_stamp_sents;
-    jsonresult["stamp_sents"] = tmp_stamp_sents;
+    try{
+      nlohmann::json json_stamp = nlohmann::json::parse(tmp_stamp_sents);
+      LOG(INFO) << "offline stamp_sents : " << json_stamp;
+      jsonresult["stamp_sents"] = json_stamp;
+    }catch (std::exception const &e)
+    {
+      LOG(ERROR)<< tmp_stamp_sents << e.what();
+      jsonresult["stamp_sents"] = "";
+    }
   }
 
   return jsonresult;

--
Gitblit v1.9.1