SyuanYu 7 달 전
부모
커밋
1275f04f5c
5개의 변경된 파일41개의 추가작업 그리고 17개의 파일을 삭제
  1. 33 9
      src/components/Chat.vue
  2. 2 2
      src/language/en.json
  3. 2 2
      src/language/ja.json
  4. 2 2
      src/language/ko.json
  5. 2 2
      src/language/zh.json

+ 33 - 9
src/components/Chat.vue

@@ -209,6 +209,8 @@ async function sendMessage(type = "") {
       handleVideoCache(); // 播放 Video Cache
       if (audioFile.value && type !== "text") {
         messageSaveMp3(message, videoCacheData.value.answer, []);
+      } else {
+        messageSave(message, videoCacheData.value.answer, []);
       }
       return;
     }
@@ -245,6 +247,8 @@ async function sendMessage(type = "") {
         console.log("response", response);
         if (audioFile.value && type !== "text") {
           messageSaveMp3(message, response.data.response, response.data.data);
+        } else {
+          messageSave(message, response.data.response, response.data.data);
         }
 
         messageNotInCache(message, response.data.response); // 回傳未收錄問題
@@ -2243,7 +2247,27 @@ function recStop() {
 
 let videoCacheData = ref({});
 
-// 儲存問答 Log & 使用者語音
+// 儲存問答 Log
+async function messageSave(question, answer, data) {
+  let url = "https://cmm.ai:9101/message_save";
+
+  let parameters = {
+    question: question,
+    answer: answer,
+    data_list: data.length ? JSON.stringify(data) : "[]",
+  };
+
+  console.log("messageSave", parameters);
+
+  try {
+    const response = await axios.post(url, parameters);
+    console.log("response", response);
+  } catch (error) {
+    console.log("error", error);
+  }
+}
+
+// 儲存問答 Log (有使用者錄音檔)
 async function messageSaveMp3(question, answer, data) {
   let url = "https://cmm.ai:9101/message_save_mp3";
 
@@ -3103,7 +3127,7 @@ async function messageNotInCache(question, answer) {
                           :href="item.info.website_url || item.info.url"
                           target="_blank"
                         >
-                          {{ t("ctaGoUrl") }}
+                          {{ t("cta_url") }}
                         </a> -->
 
                         <!-- 掃描 QR Code -->
@@ -3115,7 +3139,7 @@ async function messageNotInCache(question, answer) {
                           "
                           color="primary"
                         >
-                          <p class="text-white m-0">{{ t("ctaGoUrl") }}</p>
+                          <p class="text-white m-0">{{ t("cta_url") }}</p>
                         </v-btn>
                       </div>
                     </div>
@@ -3173,7 +3197,7 @@ async function messageNotInCache(question, answer) {
                       <span>{{ item.info.floor || item.info.price }}</span>
                       <div class="link-btn">
                         <!-- <a :href="item.info.url" target="_blank">
-                          {{ t("ctaGoUrl") }}
+                          {{ t("cta_url") }}
                         </a> -->
 
                         <!-- 掃描 QR Code -->
@@ -3181,7 +3205,7 @@ async function messageNotInCache(question, answer) {
                           @click="openQrcodeDialog(item.info.url)"
                           color="primary"
                         >
-                          <p class="text-white m-0">{{ t("ctaGoUrl") }}</p>
+                          <p class="text-white m-0">{{ t("cta_url") }}</p>
                         </v-btn>
                       </div>
                     </div>
@@ -3231,7 +3255,7 @@ async function messageNotInCache(question, answer) {
                       <span>{{ item.info.floor || item.info.price }}</span>
                       <div class="link-btn">
                         <!-- <a :href="item.info.url" target="_blank">
-                          {{ t("ctaGoUrl") }}
+                          {{ t("cta_url") }}
                         </a> -->
 
                         <!-- 掃描 QR Code -->
@@ -3239,7 +3263,7 @@ async function messageNotInCache(question, answer) {
                           @click="openQrcodeDialog(item.info.url)"
                           color="primary"
                         >
-                          <p class="text-white m-0">{{ t("ctaGoUrl") }}</p>
+                          <p class="text-white m-0">{{ t("cta_url") }}</p>
                         </v-btn>
                       </div>
                     </div>
@@ -3285,7 +3309,7 @@ async function messageNotInCache(question, answer) {
                     <span>{{ item.info.floor || item.info.price }}</span>
                     <div class="link-btn">
                       <a :href="item.info.url" target="_blank">
-                        {{ t("ctaGoUrl") }}
+                        {{ t("cta_url") }}
                       </a>
                     </div>
                   </div>
@@ -3309,7 +3333,7 @@ async function messageNotInCache(question, answer) {
                   :href="message.body.store_info_url || message.body.url"
                   target="_blank"
                 >
-                  {{ t("ctaBuyNow") }}
+                  {{ t("cta_buy") }}
                 </a>
                 <a :href="message.body.website_url" target="_blank"> 官網 </a>
               </div>

+ 2 - 2
src/language/en.json

@@ -2,8 +2,8 @@
   "title": "Artificial intelligence customer service",
   "prologue": "Hello, welcome to use the Taipei 101 Intelligent Customer Service System.",
   "service": "How may I help you?",
-  "ctaBuyNow": "Buy now",
-  "ctaGoUrl": "Go now",
+  "cta_buy": "Buy now",
+  "cta_url": "Go now",
   "customer_show": "AI Customer Service",
   "customer_hide": "AI Customer Service",
   "observation_deck": "Observatory",

+ 2 - 2
src/language/ja.json

@@ -2,8 +2,8 @@
   "title": "AIインテリジェントカスタマーサービス",
   "prologue": "こんにちは、台北101インテリジェントカスタマーサービスシステムをご利用いただき、ようこそ。",
   "service": "どうすればお手伝いできますか?",
-  "ctaBuyNow": "すぐに購入する",
-  "ctaGoUrl": "すぐに行く",
+  "cta_buy": "すぐに購入する",
+  "cta_url": "すぐに行く",
   "customer_show": "AIインテリジェントカスタマーサービス",
   "customer_hide": "AIインテリジェントカスタマーサービス",
   "observation_deck": "秘境の庭園展望台",

+ 2 - 2
src/language/ko.json

@@ -2,8 +2,8 @@
   "title": "AI 지능 고객 서비스",
   "prologue": "안녕하세요. 타이베이 101 지능형 고객 서비스 시스템을 이용해 주셔서 환영합니다.",
   "service": "어떻게 도와드릴까요?",
-  "ctaBuyNow": "바로 구매",
-  "ctaGoUrl": "즉시 이동",
+  "cta_buy": "바로 구매",
+  "cta_url": "즉시 이동",
   "customer_show": "실제 고객 상담원",
   "customer_hide": "실제 고객 상담원",
   "observation_deck": "비경 정원 전망대",

+ 2 - 2
src/language/zh.json

@@ -2,8 +2,8 @@
   "title": "AI 智能客服",
   "prologue": "您好,歡迎您使用台北101智能客服系統",
   "service": "請問有什麼可以為您服務的呢?",
-  "ctaBuyNow": "立即購票",
-  "ctaGoUrl": "立即前往",
+  "cta_buy": "立即購票",
+  "cta_url": "立即前往",
   "customer_show": "叫出真人客服",
   "customer_hide": "隱藏真人客服",
   "observation_deck": "秘境花園觀景台",