| | |
| | | <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>
|
| | |
| | | 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",
|
| | |
|
| | |
| | | }
|
| | | // this.setLoading();
|
| | | setTimeout(() => {
|
| | | // this.setMsgStart("您好");
|
| | | this.setMsgStart("您好");
|
| | | }, config.loadTime);
|
| | | bus.$on("mapInfo", (res) => {
|
| | | if (res) {
|
| | | 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() {
|
| | |
| | | }, 200);
|
| | | },
|
| | | async setMsgStart(res) {
|
| | | const data = await getAIMessage(res);
|
| | | const message = data.order;
|
| | | if (data.order.args && data.order.args.place) {
|
| | | message = data.order.args.place;
|
| | |
|
| | | 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);
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|
| | | this.getMsg("ai", message);
|
| | | if (data.order.name) {
|
| | | mapInfo.init(data.order.name);
|
| | | }
|
| | | |
| | | },
|
| | | 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 = "";
|
| | |
| | | line-height: 30px;
|
| | | border-bottom: 1px solid #c1c1c1;
|
| | | }
|
| | |
|
| | | @keyframes siz {
|
| | | from {
|
| | | width: 0;
|