suerprisePlus
2024-06-21 fde8e3bedaf5f883f38c3a0ec33d3c6a8748d1c9
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,8 +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",
@@ -70,13 +66,24 @@
    }
    // 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() {
@@ -89,16 +96,61 @@
      }, 200);
    },
    async setMsgStart(res) {
      if (res == "三维实景") {
        this.setV1Fastgpt(res)
      } else {
      const data = await getAIMessage(res);
      const message = data.order;
      if (data.order.args && data.order.args.place) {
        message = data.order.args.place;
        if (data.status == 200) {
          if (data.content) {
            this.getMsg("ai", data.content);
          } else {
            this.getMsg("ai", "");
      }
      this.getMsg("ai", message);
      if (data.order.name) {
        mapInfo.init(data.order.name);
          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 = "";
@@ -210,6 +262,7 @@
  line-height: 30px;
  border-bottom: 1px solid #c1c1c1;
}
@keyframes siz {
  from {
    width: 0;