From c0ff61d066a9f65aa0cdbeb1e10a249763f1e966 Mon Sep 17 00:00:00 2001
From: yxl <584911253@qq.com>
Date: 星期四, 02 一月 2025 09:58:41 +0800
Subject: [PATCH] 最新代码提交

---
 src/views/chartView/index.vue |  184 +++++++++++++++++++++++++--------------------
 1 files changed, 102 insertions(+), 82 deletions(-)

diff --git a/src/views/chartView/index.vue b/src/views/chartView/index.vue
index cdf71d4..d6299d3 100644
--- a/src/views/chartView/index.vue
+++ b/src/views/chartView/index.vue
@@ -1,7 +1,12 @@
 <template>
   <div class="chartBox">
     <div class="ChartBox">
-      <JwChat-index :taleList="list" @enter="bindEnter" v-model="inputMsg" :toolConfig="tool">
+      <JwChat-index
+        :taleList="list"
+        @enter="bindEnter"
+        v-model="inputMsg"
+        :toolConfig="tool"
+      >
       </JwChat-index>
     </div>
   </div>
@@ -12,9 +17,14 @@
 import msgData from "../../assets/js/msg/msgData";
 import store from "../../store";
 import bus from "./../../assets/js/bus.js";
-import { getAgentThistoryUpdate, getAgentIntention, getAgentLayerList, getAgentThistorySave } from "../../api/api.js";
+import {
+  getAgentThistoryUpdate,
+  getAgentIntention,
+  getAgentLayerList,
+  getAgentThistorySave,
+} from "../../api/api.js";
 import mapSetFunc from "../../assets/js/mapSetFunc.js";
-import { nanoid } from 'nanoid'
+import { nanoid } from "nanoid";
 import mapServer from "../../assets/js/map/mapServer.js";
 import mapImg from "../../assets/js/map/mapImg.js";
 import mapModel from "../../assets/js/map/mapModel.js";
@@ -32,20 +42,20 @@
       obj: null,
       tool: {
         show: ["file", "history", "img"],
-        callback: this.toolEvent
+        callback: this.toolEvent,
       },
       config: {
         img: "/image/cover.png",
         name: "JwChat",
         dept: "鏈�绠�鍗曘�佹渶渚挎嵎",
-        callback: this.bindCover
-      }
+        callback: this.bindCover,
+      },
     };
   },
   computed: {
     Obj() {
       return store.state.setMsgData;
-    }
+    },
   },
   watch: {
     Obj(newVal, oldVal) {
@@ -63,7 +73,7 @@
           this.list[this.list.length - 1].text = newVal;
         }
       }
-    }
+    },
   },
   mounted() {
     this.uuid = nanoid();
@@ -78,7 +88,6 @@
     // modelLayer.init();
     setTimeout(() => {
       this.getMsg("ai", "鎮ㄥソ锛岃杈撳叆鎸囦护");
-
     }, 1000);
 
     bus.$on("mapInfo", (res) => {
@@ -107,16 +116,15 @@
     createSocket() {
       this.wsSocket = new WebSocket(config.wsHost);
       this.wsSocket.onopen = (event) => {
-        console.log('WebSocket杩炴帴鎴愬姛');
+        console.log("WebSocket杩炴帴鎴愬姛");
         //瀹氭椂浠诲姟锛岀敱浜庝娇鐢╪ginx鍙嶅悜浠g悊锛�60绉掓棤鏁版嵁浼犺緭浼氭柇寮�
         var timer = setInterval(() => {
-          if ( this.wsSocket.readyState == 1) {
+          if (this.wsSocket.readyState == 1) {
             this.wsSocket.send("蹇冭烦鍖呮娴�");
           } else {
             //IM杩炴帴宸叉柇寮�
           }
         }, 50 * 1000);
-
       };
       this.wsSocket.onmessage = (event) => {
         // console.log('Received message:', event.data);
@@ -124,29 +132,25 @@
 
         if (event.data != "杩炴帴鎴愬姛") {
           console.log(event.data);
-          const val = JSON.parse(event.data)
+          const val = JSON.parse(event.data);
           if (val.session_id == this.uuid) {
-            this.setMapfunc(val, this.obj)
+            this.setMapfunc(val, this.obj);
           }
         }
-
-      }
+      };
     },
     async getQueryLayerList() {
-      getAgentLayerList().then(response => {
+      getAgentLayerList().then((response) => {
         if (response.code != 200) return;
         const items = response.data;
         for (var i in items) {
           const name = items[i].name;
-          if (
-            name != "FW20" && name != "FW12"
-          ) {
-            mapServer.addServer(items[i])
+          if (name != "FW20" && name != "FW12") {
+            console.log("items[i]", items[i]);
+            mapServer.addServer(items[i]);
           }
-
         }
-
-      })
+      });
     },
     bindEnter() {
       const msg = this.inputMsg;
@@ -173,7 +177,9 @@
         2
       );
       mapImg.addImageLayer();
-      var roleMsg1 = msgData.getAffairsData([{ type: "text", val: "鐩稿叧淇℃伅宸插湪鍦板浘灞曠ず" }]);
+      var roleMsg1 = msgData.getAffairsData([
+        { type: "text", val: "鐩稿叧淇℃伅宸插湪鍦板浘灞曠ず" },
+      ]);
       this.refashMsg(roleMsg1.list);
     },
     getMsg(type, msg) {
@@ -200,56 +206,54 @@
         2
       );
 
-      const formData = new FormData();
-      formData.append("message", res);
-      formData.append("lib_id", "No1");
-      formData.append("session_id", this.uuid.toString());
+      // const formData = new FormData();
+      // formData.append("message", res);
+      // formData.append("lib_id", "No1");
+      // formData.append("session_id", this.uuid.toString());
+      const formData = {
+        message: res,
+        lib_id: "No1",
+        session_id: this.uuid.toString(),
+      };
 
       var obj = {
-        "ai": "",
-        "create_time": msgData.getDate1(),
-        "human": res,
-        "sessionid": this.uuid,
-        "update_time": "",
-        "userid": 0
-      }
+        ai: "",
+        create_time: msgData.getDate1(),
+        human: res,
+        sessionid: this.uuid,
+        update_time: "",
+        userid: 0,
+      };
 
-      getAgentThistorySave(
-        obj
-      ).then(response => {
-
+      getAgentThistorySave(obj).then((response) => {
         if (response.code == 200) {
           obj.id = response.id;
           this.obj = obj;
         }
 
-        this.setAgentIntention(obj, formData)
-      })
-
-
-
-
+        this.setAgentIntention(obj, formData);
+      });
     },
     async setAgentIntention(obj, formData) {
       getAgentIntention(formData).then((response) => {
-
         if (response.code != 200) {
           var rolMsg = [
             {
               type: "text",
-              val: "鏈煡璇㈠埌鐩稿叧淇℃伅銆�"
-            }
+              val: "鏈煡璇㈠埌鐩稿叧淇℃伅銆�",
+            },
           ];
           this.refashMsg(rolMsg);
           return;
         }
-
 
         const type = response.type;
         if (type == "Map") {
           this.setMapfunc(response.content, obj);
         } else if (type == "Rag") {
           this.setMapRag(response, obj);
+        } else {
+          this.setMapfunc(response.content, obj);
         }
       });
     },
@@ -258,26 +262,30 @@
 
       switch (res.func) {
         case "queryRelationship":
-
           var roleMsg = null;
           if (res.data) {
-            mapSetFunc.init(res)
+            mapSetFunc.init(res);
             var a = `${res.msg}`;
             this.setUpdateHistoryInFor(obj, a);
             roleMsg = msgData.getMdData("markdown", a);
           } else {
             roleMsg = msgData.getAffairsData([{ type: "text", val: res.msg }]);
-
           }
 
           this.refashMsg(roleMsg.list);
           break;
         case "queryMeta":
-          var a = `${res.data}`;
+          // var a = `|鏁版嵁绫诲瀷 |鏁版嵁閲� |\n|------|------|\n|鍐涗簨鐩爣 |724|\n|`//`${res.data}`;
+          const subData = res.data
+            .filter((item) => item.subtype !== null)
+            .map((item) => `| ${item.subtype} | ${item.count} |`)
+            .join("\n");
+          var a = `| 鏁版嵁绫诲瀷 | 鏁版嵁閲� |\n|------|------|\n` + subData;
+          console.log("aaa", subData, a);
           this.setUpdateHistoryInFor(obj, a);
           var roleMsg = msgData.getMdData("markdown", a);
           this.refashMsg(roleMsg.list);
-          mapSetFunc.init(res)
+          mapSetFunc.init(res);
           break;
         case "combatSimulate":
           this.setMsgStart2();
@@ -287,11 +295,9 @@
           this.refashMsg(roleMsg1.list);
           break;
         case "batEnv":
-
           if (res.msg) {
             var a = `${res.msg}`;
             var roleMsg = msgData.getMdData("markdown", a);
-
 
             roleMsg.list[0].link = true;
 
@@ -303,15 +309,36 @@
 
           break;
         case "poiMap":
-        case "aroundPoi":
-          mapSetFunc.init(res)
+          mapSetFunc.init(res);
           this.setUpdateHistoryInFor(obj, res.msg);
-          var roleMsg = msgData.getAffairsData([{ type: "text", val: res.msg }]);
+          var roleMsg = msgData.getAffairsData([
+            { type: "text", val: "鍦板浘宸叉樉绀�" },
+          ]);
+          console.log("roleMsg----", roleMsg);
+          this.refashMsg(roleMsg.list);
+          break;
+        case "aroundPoi":
+          mapSetFunc.init(res);
+          this.setUpdateHistoryInFor(obj, res.msg);
+          var roleMsg = msgData.getAffairsData([
+            { type: "text", val: res.msg },
+          ]);
+          this.refashMsg(roleMsg.list);
+          break;
+        case "getParam":
+          mapSetFunc.init(res);
+          console.log('res.data.targetinfo',res);
+          this.setUpdateHistoryInFor(obj, res.msg);
+          var roleMsg = msgData.getAffairsData([
+            { type: "text", val: res.data[0].targetinfo },
+          ]);
           this.refashMsg(roleMsg.list);
           break;
         default:
           this.setUpdateHistoryInFor(obj, res.msg);
-          var roleMsg1 = msgData.getAffairsData([{ type: "text", val: res.msg }]);
+          var roleMsg1 = msgData.getAffairsData([
+            { type: "text", val: res.msg },
+          ]);
           this.refashMsg(roleMsg1.list);
           break;
       }
@@ -319,10 +346,9 @@
     setUpdateHistoryInFor(obj, message) {
       obj.ai = message;
       obj.update_time = msgData.getDate1();
-      getAgentThistoryUpdate(obj).then(response => {
+      getAgentThistoryUpdate(obj).then((response) => {
         console.log(response);
-
-      })
+      });
     },
     setMapRag(res, objRes) {
       const val = res.content.split("\n");
@@ -331,8 +357,8 @@
         if (val[i]) {
           obj.push({
             type: "text",
-            val: val[i]
-          })
+            val: val[i],
+          });
         }
       }
       var listData = [];
@@ -340,52 +366,46 @@
         var obj_file = res.fileSrource;
         for (var i = 0; i < obj_file.length; i++) {
           const file_name = obj_file[i].metadata.split("/");
-          const name = file_name[file_name.length - 1]
+          const name = file_name[file_name.length - 1];
           if (listData.length == 0) {
             listData.push({
               name: name,
-              val: [
-                obj_file[i].page_content
-              ]
-            })
+              val: [obj_file[i].page_content],
+            });
           } else {
             var boolen = false;
             for (var k in listData) {
               if (listData[k].name == name) {
                 boolen = true;
-                listData[k].val.push(obj_file[i].page_content)
+                listData[k].val.push(obj_file[i].page_content);
               }
             }
             if (boolen == false) {
               listData.push({
                 name: name,
-                val: [
-                  obj_file[i].page_content
-                ]
-              })
+                val: [obj_file[i].page_content],
+              });
             }
-
           }
         }
       }
       if (listData.length > 0) {
         obj.push({
           type: "fileSrource",
-          val: listData
-        })
+          val: listData,
+        });
       }
 
       var roleMsg = msgData.getAffairsData(obj);
 
       this.setUpdateHistoryInFor(objRes, JSON.stringify(roleMsg.list));
       this.refashMsg(roleMsg.list);
-
     },
     refashMsg(res) {
       this.loading = false;
       this.list[this.list.length - 1].list = res;
-    }
-  }
+    },
+  },
 };
 </script>
 <style scoped>

--
Gitblit v1.9.3