From 3dc17dbcb1fb1d64c469deed1518d1817846b452 Mon Sep 17 00:00:00 2001
From: yxl <584911253@qq.com>
Date: 星期三, 19 二月 2025 09:49:50 +0800
Subject: [PATCH] commit

---
 src/views/chartView/index.vue |  158 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 101 insertions(+), 57 deletions(-)

diff --git a/src/views/chartView/index.vue b/src/views/chartView/index.vue
index f8c4d64..f4f4ec2 100644
--- a/src/views/chartView/index.vue
+++ b/src/views/chartView/index.vue
@@ -108,12 +108,6 @@
         this.setRagMoreList(res);
       }
     });
-    // axios.get("http://192.168.11.89:12315/Markdown.md").then((response) => {
-    //     if (response.status == 200) {
-    //       console.log(response);
-    //       this.setMarkDownInfo(response.data);
-    //     }
-    //   });
   },
   methods: {
     createSocket() {
@@ -149,7 +143,7 @@
       const item = {
         sourceType: "Tileset",
         name: "MilitaryFacilities",
-        url: "/data-api/gisserver/c3dserver/sedb_DESKTOP-15DOTHJ_SEM4550/tileset.json",
+        url: config.modelUrl,
       };
       setTimeout(() => {
         mapServer.addServer(item);
@@ -251,52 +245,31 @@
       this.$store.state.setListColor = [];
       this.$store.state.showLenged = false;
       this.$store.state.showRelationBox = false;
-
-      // const formData = new FormData();
-      // formData.append("message", res);
-      // formData.append("lib_id", "No1");
-      // formData.append("session_id", this.uuid.toString());
       const formData = {
         message: res.replace(/\s+/g, ""),
         lib_id: "No1",
         session_id: this.uuid.toString(),
       };
 
-      if (formData.message.indexOf("@map") > -1) {
-        var obj = {
-          ai: "",
-          create_time: msgData.getDate1(),
-          human: res,
-          sessionid: this.uuid,
-          update_time: "",
-          userid: 0,
-        };
-        getAgentThistorySave(obj).then((response) => {
-          if (response.code == 200) {
-            obj.id = response.id;
-            this.obj = obj;
-          }
+      var obj = {
+        ai: "",
+        create_time: msgData.getDate1(),
+        human: res,
+        sessionid: this.uuid,
+        update_time: "",
+        userid: 0,
+      };
+      getAgentThistorySave(obj).then((response) => {
+        if (response.code == 200) {
+          obj.id = response.id;
+          this.obj = obj;
+        }
+        if (formData.message.indexOf("@map") > -1) {
           this.setAgentIntention(obj, formData);
-        });
-      } else {
-        this.setRagAgentIntention(formData);
-      }
-
-      // var obj = {
-      //   ai: "",
-      //   create_time: msgData.getDate1(),
-      //   human: res,
-      //   sessionid: this.uuid,
-      //   update_time: "",
-      //   userid: 0,
-      // };
-      // getAgentThistorySave(obj).then((response) => {
-      //   if (response.code == 200) {
-      //     obj.id = response.id;
-      //     this.obj = obj;
-      //   }
-      //   this.setAgentIntention(obj, formData);
-      // });
+        } else {
+          this.setRagAgentIntention(obj, formData);
+        }
+      });
     },
     //鍦板浘鐩稿叧闂瓟
     async setAgentIntention(obj, formData) {
@@ -397,7 +370,7 @@
       //   });
     },
     //鏅�氬璇濋棶绛�
-    async setRagAgentIntention(formData) {
+    async setRagAgentIntention(obj, formData) {
       try {
         // 鍙戦�佽姹�
         const params = new URLSearchParams(formData);
@@ -425,13 +398,16 @@
         // 灏嗘祦涓殑瀛楄妭鏁版嵁瑙g爜涓烘枃鏈瓧绗︿覆
         const textDecoder = new TextDecoder();
         let result = true;
-        let sendMsg = true;
+        let thinkMsg = false;
         let sqlValue = "";
+        let afterText = "";
         while (result) {
           // done琛ㄧず娴佹槸鍚﹀凡缁忓畬鎴愯鍙�  value鍖呭惈璇诲彇鍒扮殑鏁版嵁鍧�
           const { done, value } = await reader.read();
           if (done) {
             result = false;
+            this.setUpdateHistoryInFor(obj, sqlValue);
+            console.log(sqlValue, "sqlValue-----");
             break;
           }
           let resText = textDecoder.decode(value);
@@ -439,25 +415,80 @@
           //鍖呭惈</think>缁х画杈撳嚭
           console.log(resText, "杩斿洖鐨勬暟鎹�");
           if (resText.indexOf("<think>") > -1) {
-            sendMsg = false;
-          }
-          if (resText.indexOf("</think>") > -1) {
-            sendMsg = true;
-            let position = resText.indexOf('</think>');
-            resText = resText.substring(position + "</think>".length);
-          }
-          if (sendMsg) {
+            resText = resText.replace(/<think>/, "");
+            thinkMsg = true;
             sqlValue += resText;
             var rolMsg = [
               {
                 type: "stream",
+                thinkMsg: thinkMsg,
                 val: marked(sqlValue),
               },
             ];
             this.refashMsg(rolMsg);
+          } else if (resText.indexOf("</think>") > -1) {
+            let position = resText.indexOf("</think>");
+            //</think>涔嬪墠鐨勫唴瀹�
+            const beforeText = resText.substring(0, position);
+            //鍒锋柊
+            sqlValue += beforeText;
+            var rolMsg = [
+              {
+                type: "stream",
+                thinkMsg: thinkMsg,
+                val: marked(sqlValue),
+              },
+            ];
+            this.refashMsg(rolMsg);
+            thinkMsg = false;
+            // </think>涔嬪悗鐨勫唴瀹�
+            const afterT = resText.substring(position + "</think>".length);
+            //鍒锋柊
+            if (afterT) {
+              afterText += afterT;
+              var rolMsg = [
+                {
+                  type: "stream",
+                  thinkMsg: true,
+                  val: marked(sqlValue),
+                },
+                {
+                  type: "stream",
+                  thinkMsg: false,
+                  val: marked(afterText),
+                },
+              ];
+              this.refashMsg(rolMsg);
+            }
+          } else {
+            if (thinkMsg) {
+              sqlValue += resText;
+              var rolMsg = [
+                {
+                  type: "stream",
+                  thinkMsg: thinkMsg,
+                  val: marked(sqlValue),
+                },
+              ];
+              this.refashMsg(rolMsg);
+            } else {
+              afterText += resText;
+              var rolMsg = [
+                {
+                  type: "stream",
+                  thinkMsg: true,
+                  val: marked(sqlValue),
+                },
+                {
+                  type: "stream",
+                  thinkMsg: false,
+                  val: marked(afterText),
+                },
+              ];
+              this.refashMsg(rolMsg);
+            }
           }
         }
-        // console.log(sqlValue, "杈撳嚭鎵�鏈夎繑鍥炴暟鎹�");
       } catch (err) {
         var rolMsg = [
           {
@@ -468,6 +499,7 @@
         this.refashMsg(rolMsg);
       }
     },
+
     setMapfunc(res, obj) {
       this.$store.state.showLenged = false;
       switch (res.func) {
@@ -637,6 +669,18 @@
           this.setUpdateHistoryInFor(obj, res.msg);
           this.refashMsg(roleMsg.list);
           break;
+        case "getTAIWAN":
+          mapSetFunc.init(res);
+          console.log("res.data.targetinfo", res);
+          const resInfo = res.data
+            .map((item) => `| ${item.name} | ${item.targetinfo} |`)
+            .join("\n");
+          var attr = `| 鍚嶇О | 灞炴�т俊鎭� |\n|------|------|\n` + resInfo;
+          console.log("aaa", attr);
+          var roleMsg = msgData.getMdData("markdown", attr);
+          this.setUpdateHistoryInFor(obj, res.msg);
+          this.refashMsg(roleMsg.list);
+          break;
         case "attackentity":
           mapSetFunc.init(res);
           this.setUpdateHistoryInFor(obj, res.msg);

--
Gitblit v1.9.3