SyuanYu 8 ay önce
ebeveyn
işleme
c7bf750799
1 değiştirilmiş dosya ile 14 ekleme ve 148 silme
  1. 14 148
      src/components/Chat.vue

+ 14 - 148
src/components/Chat.vue

@@ -228,6 +228,8 @@ async function sendMessage(type = "") {
 
         console.log("response", response);
 
+        messageNotInCache(message, response.data.response); // 回傳未收錄問題
+
         if (type !== "text") {
           handleTTS(response.data.response); // 取得語音回覆
         }
@@ -918,24 +920,6 @@ let locationList = reactive([
         text: "supermarket",
       },
     ],
-    // navigation: [
-    //   "景觀餐廳櫃台",
-    //   "ATM",
-    //   "觀景台售票處",
-    //   "廁所",
-    //   "無障礙廁所",
-    //   "計程車乘車處",
-    //   "客服(退稅櫃台/外幣兌換)",
-    //   "飲水機",
-    //   "哺乳室",
-    //   "置物櫃",
-    //   "客服(停車折抵)",
-    //   "美食街",
-    //   "伴手禮區",
-    //   "鼎泰豐",
-    //   "捷運",
-    //   "超市",
-    // ],
   },
   {
     location: "1F 信義環", // 編號 6
@@ -1005,24 +989,6 @@ let locationList = reactive([
         text: "supermarket",
       },
     ],
-    // navigation: [
-    //   "景觀餐廳櫃台",
-    //   "ATM",
-    //   "觀景台售票處",
-    //   "廁所",
-    //   "ATM",
-    //   "置物櫃",
-    //   "飲水機",
-    //   "無障礙廁所",
-    //   "哺乳室",
-    //   "客服(停車折抵)",
-    //   "退稅/外幣兌換櫃台",
-    //   "伴手禮區",
-    //   "美食街",
-    //   "捷運",
-    //   "鼎泰豐",
-    //   "超市",
-    // ],
   },
   {
     location: "1F 3號電梯", // 編號 7
@@ -1088,23 +1054,6 @@ let locationList = reactive([
         text: "snackable_souvenirs",
       },
     ],
-    // navigation: [
-    //   "景觀餐廳櫃台",
-    //   "ATM",
-    //   "觀景台售票處",
-    //   "廁所",
-    //   "置物櫃",
-    //   "飲水機",
-    //   "無障礙廁所",
-    //   "哺乳室",
-    //   "客服(停車折抵)",
-    //   "退稅/外幣兌換櫃台",
-    //   "計程車乘車處",
-    //   "美食街",
-    //   "超市",
-    //   "捷運",
-    //   "伴手禮區",
-    // ],
   },
   {
     location: "2F 3號電梯", // 編號 8
@@ -1154,19 +1103,6 @@ let locationList = reactive([
         text: "service_counter_parking_discount",
       },
     ],
-    // navigation: [
-    //   "景觀餐廳櫃台",
-    //   "ATM",
-    //   "觀景台售票處",
-    //   "廁所",
-    //   "置物櫃",
-    //   "飲水機",
-    //   "無障礙廁所",
-    //   "哺乳室",
-    //   "計程車乘車處",
-    //   "退稅/外幣兌換櫃台",
-    //   "客服(停車折抵)",
-    // ],
   },
   {
     location: "89F 觀景台", // 編號 9
@@ -1196,14 +1132,6 @@ let locationList = reactive([
         text: "101f_queue_area",
       },
     ],
-    // navigation: [
-    //   "景觀餐廳櫃台",
-    //   "ATM",
-    //   "客服",
-    //   "91F戶外區",
-    //   "廁所",
-    //   "101F排隊處",
-    // ],
   },
   {
     location: "88F 觀景台", // 編號 10
@@ -1229,7 +1157,6 @@ let locationList = reactive([
         text: "nursing_room",
       },
     ],
-    // navigation: ["景觀餐廳櫃台", "ATM", "廁所", "飲水機", "哺乳室"],
   },
 ]);
 
@@ -1248,9 +1175,6 @@ let mapList = reactive([
 
 let assignLocation = ref("當前位置"); // 指定定位點
 let assignNavigationList = ref(null); // 指定導覽點列表
-// let assignLocationFloor = ref(null); // 指定定位點樓層
-// let assignNavigation = ref(null); // 指定導覽點
-// let navigationBtn = reactive(["B1", "1F", "2F", "4F", "5F", "89F", "91F"]);
 
 let arVideo = ref(null);
 let arVideoDialog = ref(false);
@@ -1264,11 +1188,6 @@ async function getArviews(route, text, type = "") {
   if (type === "garden") {
     console.log("route", route);
     let start;
-    // if (route === "B1 鼎泰豐旁 數位屏幕") {
-    //   start = "B1 鼎泰豐";
-    // } else if (route === "B1 松智藍梯梯廳") {
-    //   start = "B1 3號電梯";
-    // }
 
     switch (route) {
       case "B1 鼎泰豐旁 數位屏幕":
@@ -1661,26 +1580,6 @@ function getImageUrl(name) {
 }
 
 let showAnchor = ref(false); // AI 主播影片
-let videoContent = ref(null); // 主播影片區塊
-
-// 動態更改主播區塊位置
-// watch(showAnchor, () => {
-//   console.log("showAnchor", showAnchor.value);
-//   nextTick(() => {
-//     changeAnchorTop();
-//   });
-// });
-
-// watch(hideMenu, () => {
-//   nextTick(() => {
-//     changeAnchorTop();
-//   });
-// });
-
-// function changeAnchorTop() {
-//   const menuOffsetTop = menu.value.offsetTop;
-//   videoContent.value.style.top = `${menuOffsetTop - 170}px`;
-// }
 
 const menuList = reactive([
   [
@@ -1718,10 +1617,6 @@ async function findBrand(value) {
     const response = await axios.get(url);
     console.log("response", response);
 
-    // response.data.data.map(
-    //   (item) => (item.info.tags = JSON.parse(item.info.tags))
-    // );
-
     messages.value.push({
       label: "brand",
       author: "ai",
@@ -1730,29 +1625,11 @@ async function findBrand(value) {
 
     assignCategoryIndex.value = null;
     assignCategory.value = "";
-
-    // messages.value.push({
-    //   label: "text",
-    //   author: "ai",
-    //   body: "請選擇問題類型:",
-    // });
-
-    // messages.value.push({
-    //   label: "btn-list",
-    //   author: "ai",
-    //   body: "",
-    // });
   } catch (error) {
     console.log("error", error);
   }
 }
 
-// 處理電話格式
-// function getPhoneNumber(phoneString) {
-//   const parts = phoneString.split("\n");
-//   return parts[1];
-// }
-
 // 取得線上購票
 async function getStaticTickets(type) {
   let url = `https://cmm.ai:9101/static_tickets?is_Chinese=${type}`;
@@ -1848,16 +1725,6 @@ function handleObservationDialog(value) {
       label: "garden_route",
       author: "ai",
       body: gardenRouteList,
-      // body: [
-      //   "B1 鼎泰豐旁 數位屏幕",
-      //   "B1 中環WOW屏幕",
-      //   "B1 信義橘梯梯廳",
-      //   "B1 信義綠梯梯廳",
-      //   "B1 松智藍梯梯廳",
-      //   "1F 信義綠梯出入口",
-      //   "1F 松智梯廳",
-      //   "2F 松智藍梯梯廳",
-      // ],
     });
   }
 }
@@ -2218,19 +2085,6 @@ function recStop() {
 
       console.log("audioFile", audioFile.value);
 
-      // 自動播放(測試用)
-      // const audio = document.createElement("audio");
-      // audio.src = localUrl;
-      // audio.autoplay = true;
-      // audio
-      //   .play()
-      //   .then(() => {
-      //     console.log("Audio is playing automatically.");
-      //   })
-      //   .catch((error) => {
-      //     console.error("Error playing audio:", error);
-      //   });
-
       rec.close(); // 釋放錄音資源 (若不釋放系統或瀏覽器將持續提示在錄音中)
       rec = null;
 
@@ -2352,6 +2206,18 @@ function handleVoice(state) {
     }
   }
 }
+
+// 回傳未收錄問題
+async function messageNotInCache(question, answer) {
+  let url = `https://cmm.ai:9101/message_not_in_cache?question=${question}&answer=${answer}&client_id=0`;
+
+  try {
+    const response = await axios.post(url);
+    console.log("messageNotInCache response", response);
+  } catch (error) {
+    console.log("error", error);
+  }
+}
 </script>
 
 <template>