| | |
| | | // apiUrl: "http://103.135.160.14:5381/",0
|
| | | // apiUrl: location.origin,
|
| | | // apiUrl: "http://192.168.11.194",
|
| | | apiUrl:"http://103.135.160.14:7800",
|
| | | // apiUrl:"http://103.135.160.14:7800",
|
| | | apiUrl:"/dev-api",
|
| | | apiRagUrl:"/rag-api",
|
| | | imgUrl: webHost + "/image/",
|
| | |
| | | modelLayer:"MilitaryFacilities",//"FW21",
|
| | | // modelUrl:"/data-api/gisserver/c3dserver/sedb_DESKTOP-D8L6U7M_NNSEM/tileset.json",//"模型地址",
|
| | | modelUrl:"/data-api/gisserver/c3dserver/sedb_DESKTOP-15DOTHJ_SEM4550/tileset.json",
|
| | | // terrainUrl:"",
|
| | | terrainUrl:"https://tiles1.geovisearth.com/base/v1/terrain?token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405",
|
| | | modelBase: {
|
| | | url: "http://106.120.22.26:8013",
|
| | |
| | | </div>
|
| | | <div v-else-if="res.type == 'stream'">
|
| | | <div
|
| | | v-if="res.thinkMsg"
|
| | | v-html="res.val"
|
| | | class="think-markdown"
|
| | | ></div>
|
| | | <div
|
| | | v-else
|
| | | v-html="res.val"
|
| | | class="markdown-container"
|
| | | ></div>
|
| | |
| | | .markdown-container {
|
| | | padding: 10px;
|
| | | white-space: pre-wrap;
|
| | | color: #fff;
|
| | | font-size: 16px;
|
| | | }
|
| | | .think-markdown {
|
| | | font-size: 13px;
|
| | | color: #ccc;
|
| | | border-left: 1px solid #ccc;
|
| | | padding-left: 5px;
|
| | | }
|
| | | </style>
|
| | | <style scoped>
|
| | |
| | | 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() {
|
| | |
| | | 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",
|
| | |
| | | this.setRagAgentIntention(obj, 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);
|
| | | // });
|
| | | },
|
| | | //地图相关问答
|
| | | async setAgentIntention(obj, formData) {
|
| | |
| | | // 将流中的字节数据解码为文本字符串
|
| | | 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();
|
| | |
| | | //包含</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 = [
|
| | | {
|
| | |
| | | this.refashMsg(rolMsg);
|
| | | }
|
| | | },
|
| | |
|
| | | setMapfunc(res, obj) {
|
| | | this.$store.state.showLenged = false;
|
| | | switch (res.func) {
|