From fde8e3bedaf5f883f38c3a0ec33d3c6a8748d1c9 Mon Sep 17 00:00:00 2001 From: suerprisePlus <15810472099@163.com> Date: 星期五, 21 六月 2024 18:02:44 +0800 Subject: [PATCH] wfs 范围查询 --- src/views/chartView/index.vue | 107 ++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 84 insertions(+), 23 deletions(-) diff --git a/src/views/chartView/index.vue b/src/views/chartView/index.vue index ddf0cee..5ccfc60 100644 --- a/src/views/chartView/index.vue +++ b/src/views/chartView/index.vue @@ -1,12 +1,7 @@ <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> @@ -17,7 +12,9 @@ import msgData from "../../assets/js/msg/msgData"; import store from "../../store"; import bus from "./../../assets/js/bus.js"; -import { getAIMessage } from "../../api/api.js"; +import { getAIMessage, getV1Fastgpt } from "../../api/api.js"; +import mapInfo from "../../assets/js/map/mapInfo.js"; +import axios from "axios"; export default { name: "jwChat", @@ -67,6 +64,7 @@ clearInterval(window.timer); window.timer = null; } + // this.setLoading(); setTimeout(() => { this.setMsgStart("鎮ㄥソ"); }, config.loadTime); @@ -75,34 +73,84 @@ this.setMapInfo(res); } }); + bus.$on("setInsertMarkDown", (res) => { + if (res) { + this.setMarkDownInfo(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: { bindEnter() { const msg = this.inputMsg; if (!msg) return; this.getMsg("role", msg); + this.setLoading(); setTimeout(() => { - // this.loading = true; this.setMsgStart(msg); - // const loader = msgData.getLoader(); - // this.list.push(loader); }, 200); }, async setMsgStart(res) { - const data = await getAIMessage(res); - // var msg = aiData.aiMsg[0] - this.getMsg("ai", data); - if (res == "hi") { - this.$nextTick(() => { - setTimeout(() => { - this.$store.state.erroInfoMessage = { - title: "璀﹀憡锛氳彶寰嬪鑻忔瘮鍏嬫咕鍖哄煙妫�娴嬪嚭寮傚父鍐涗簨鐩爣锛�", - val: "寮傚父浠e彿锛�4r5as5s001" - }; - }, 5000); - }); + if (res == "涓夌淮瀹炴櫙") { + this.setV1Fastgpt(res) + } else { + const data = await getAIMessage(res); + if (data.status == 200) { + if (data.content) { + this.getMsg("ai", data.content); + } else { + this.getMsg("ai", ""); + } + if (data.name) { + this.$store.state.setScreenFlag = true; + this.$nextTick(() => { + setTimeout(() => { + mapInfo.init(data.name); + }, 1000); + }); + } + } } + }, + async setV1Fastgpt(res) { + const data = await getV1Fastgpt(res); + const obj = data.split(/[\n]/) + const list_a = []; + obj.filter(item => { + if (item.indexOf("data: ") > -1) { + if (item.indexOf('nodeId') > -1) { + } else if(item.indexOf("content")>-1){ + const a = JSON.parse(item.split('data: ')) + console.log(a); + // if (a.choices[0].content) { + // console.log(a.choices[0].content); + // } + + + + } + + } + }) + // console.log(list_a) + // const a = val_data[0].split('data: '); + // const b = JSON.parse(a[1]); + // console.log(b) + // const c = b[1].historyPreview.length - 1; + // const d = b[1].historyPreview[c].value + // this.getMsg("ai", d); + }, + setMarkDownInfo(res) { + + var roleMsg = msgData.getRole("markDown", res); + this.list.push(roleMsg.msg); + // }, setMapInfo(res) { var msg = ""; @@ -110,10 +158,17 @@ msg = "<div>寮傚父鏌ヨ</div>" + res.value; } this.getMsg("role", msg); + this.setMsgStart(res.value); }, getMsg(type, msg) { var roleMsg = msgData.getRole(type, msg); - this.list.push(roleMsg.msg); + if (this.loading) { + this.loading = false; + const length = this.list.length - 1; + this.list[length].text = roleMsg.msg.text; + } else { + this.list.push(roleMsg.msg); + } }, setShowMsg() { if (this.msgData.text) { @@ -140,6 +195,11 @@ this.list.push(val); } + }, + setLoading() { + const loader = msgData.getLoader(); + this.list.push(loader); + this.loading = true; }, getLoadingFlag() { if (this.list.length == 0) { @@ -202,6 +262,7 @@ line-height: 30px; border-bottom: 1px solid #c1c1c1; } + @keyframes siz { from { width: 0; -- Gitblit v1.9.3