Selaa lähdekoodia

ai语音大模型添加知识问答

maxiaoxiao 10 kuukautta sitten
vanhempi
commit
bb4b1dfe85

+ 2 - 2
src/api/aiModel.js

@@ -1,8 +1,8 @@
-export function GetMsg(msg) {
+export function GetMsg(data) {
     return axios({
         method: "POST",
         url: `${window.aiURI}/msg`,
-        data: JSON.stringify({ msg }),
+        data: JSON.stringify(data),
         headers: {
             "Content-Type": "application/json",
         },

+ 3 - 1
src/components/TerrainAnalysis/TerrainCutFillAnalysis/TerrainCutFillAnalysisNew.vue

@@ -126,6 +126,7 @@ export default {
       });
       if (res.success) {
         this.$refs.range.reset();
+        if (!res.data) this.$message.error("抱歉!不在分析范围内");
         this.cutData = res.data;
 
         Object.keys(this.cutData).forEach((key) => {
@@ -241,7 +242,7 @@ export default {
 <style lang="scss" scoped>
 .cut_fill_box {
   width: 100%;
-  height: 550px;
+  height: 580px;
   padding: 20px;
   box-sizing: border-box;
   position: relative;
@@ -255,6 +256,7 @@ export default {
   }
   .range {
     width: 90% !important;
+    text-align: left;
   }
   .sdatadiv {
     text-align: left;

+ 1 - 5
src/components/mapView/range.vue

@@ -20,7 +20,7 @@
         <el-button size="mini" @click="clearAll">清除</el-button>
       </div>
     </div>
-    <div v-if="type != 'cutfill'">
+    <div>
       <span v-if="model.xzmj != 0">{{ model.xzmj }} 亩</span>
       <el-tooltip
         v-if="fileList.length > 0"
@@ -267,10 +267,6 @@ export default {
           // var parse = require("wellknown"); //引入wellknow
           const wktPolygon = parse.stringify(geojsonPolygon);
           // console.log("WKT Polygon:", wktPolygon);
-          if (this.$props.type == "cutfill") {
-            this.model.geom = wktPolygon;
-            return;
-          }
 
           const formdata = new FormData();
           // formdata.append("file", file.raw);

+ 39 - 5
src/views/aiModel/index.vue

@@ -5,7 +5,7 @@
       <i class="el-icon-close cursor" @click="closeMsg"></i>
     </div>
     <div class="counsel-chats" ref="scrollRef">
-      <div class="counsel-left flex">
+      <div class="counsel-left flex" v-if="nowType == 'selectLand'">
         <div class="header-img">
           <img src="/static/images/aiModel/kefu.png" />
         </div>
@@ -14,7 +14,7 @@
           <span class="high" @click="sendDefault">{{ defaultMsg }}</span>
         </div>
       </div>
-      <!--右侧-->
+      <!--会话内容-->
       <div v-for="(item, index) in questionList" :key="index">
         <!--右侧-->
         <div class="counsel-right flex" v-if="item.type == 0">
@@ -54,7 +54,18 @@
         </div>
       </div>
     </div>
-
+    <div class="consel-types">
+      <div
+        v-for="(titem, i) in types"
+        :key="i"
+        class="typeitem cursor"
+        :class="{ heigType: nowType == titem.value }"
+        @click="nowType = titem.value"
+      >
+        <i :class="titem.icon"></i>
+        {{ titem.label }}
+      </div>
+    </div>
     <div class="voice" v-if="spdisabled">
       <div>正在识别</div>
       <div class="noise"></div>
@@ -98,6 +109,11 @@ export default {
         "我要在抱坡区进行选址,用地面积30到50亩,选择居住用地,距离幼儿园200米,距离医院300米,距离火葬场大于5000米",
       sendContent: "",
       spdisabled: false,
+      nowType: "selectLand",
+      types: [
+        { label: "智能选址", value: "selectLand", icon: "el-icon-s-home" },
+        { label: "知识问答", value: "answer", icon: "el-icon-chat-line-round" },
+      ],
     };
   },
   created() {},
@@ -207,7 +223,7 @@ export default {
     },
     sendToBackend(msg, mindex) {
       this.questionList[mindex].mstatus = 0;
-      GetMsg(msg)
+      GetMsg({ msg, type: this.nowType })
         .then((mres) => {
           if (mres.status == 200) {
             this.questionList[mindex].mstatus = 2;
@@ -215,6 +231,8 @@ export default {
               if (mres.data.type == "selectLand") {
                 this.questionList.push({ content: "分析中...请稍等" });
                 this.AddFzxz(mres.data.data, mres.data.type);
+              } else {
+                this.questionList.push({ content: mres.data.data });
               }
             } else {
               this.questionList.push({
@@ -319,7 +337,7 @@ export default {
   }
 
   .counsel-chats {
-    height: calc(100% - 150px);
+    height: calc(100% - 190px);
     overflow-x: hidden;
     overflow-y: auto;
     .header-img {
@@ -393,6 +411,22 @@ export default {
     // color: #fff;
   }
 }
+.consel-types {
+  position: absolute;
+  bottom: 100px;
+  width: calc(100% - 20px);
+  display: flex;
+  .typeitem {
+    border: 1px solid #ffffff;
+    border-radius: 8px;
+    padding: 5px 10px;
+    margin-right: 20px;
+  }
+  .heigType {
+    border-color: #f0c472;
+    color: #f0c472;
+  }
+}
 .voice {
   width: 75%;
   // height: 100px;