1 line
5.2 KiB
JavaScript
1 line
5.2 KiB
JavaScript
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1e34fa91"],{"57cd":function(t,e,s){},7452:function(t,e,s){"use strict";s("57cd")},9406:function(t,e,s){"use strict";s.r(e);var o=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"chatpdf"},[s("div",{staticClass:"chatpdfBox"},[s("div",{staticClass:"chatpdfLine"},[s("div",{staticClass:"chatpdfLineScroll"},[s("h1",[t._v("欢迎使用知识库AI")]),s("h2",[t._v("由 AI 支持的私有数据机器人")]),t._l(t.msgList,(function(e,o){return s("div",{staticClass:"chatpdfRow ",class:{chatpdfAsk:"ask"==e.type}},[s("div",{staticClass:"chatpdfContent",domProps:{innerHTML:t._s(t.html(e.content))}})])}))],2)]),s("div",{staticClass:"chatpdfArea"},[s("button",{on:{click:t.clearHistory}},[s("svg",{staticClass:"icon",attrs:{t:"1682398861245",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"1371",width:"20",height:"20"}},[s("path",{attrs:{d:"M883.2 403.2l-147.2-44.8 57.6-224c0-6.4 0-19.2-6.4-25.6-6.4-6.4-12.8-12.8-19.2-12.8L627.2 57.6c-6.4 0-19.2 0-25.6 0C595.2 70.4 588.8 76.8 588.8 83.2L524.8 300.8 358.4 256c-6.4 0-19.2 0-25.6 0S320 275.2 320 281.6l-89.6 320C211.2 684.8 128 768 128 768c-6.4 6.4-12.8 19.2-6.4 32 0 12.8 12.8 19.2 25.6 25.6l524.8 140.8c0 0 6.4 0 6.4 0 6.4 0 19.2-6.4 25.6-12.8 6.4-6.4 83.2-89.6 115.2-179.2 32-83.2 89.6-326.4 89.6-332.8C908.8 422.4 896 409.6 883.2 403.2zM755.2 748.8c-25.6 57.6-70.4 115.2-89.6 147.2l-70.4-19.2c32-38.4 70.4-96 89.6-160 6.4-19.2-6.4-32-25.6-38.4-19.2-6.4-32 6.4-38.4 25.6-19.2 70.4-76.8 134.4-96 153.6l-57.6-12.8c32-38.4 70.4-96 83.2-153.6 6.4-19.2-6.4-32-25.6-38.4-19.2-6.4-32 6.4-38.4 25.6-19.2 64-70.4 128-89.6 153.6l-64-19.2c32-38.4 70.4-96 89.6-153.6 6.4-19.2-6.4-32-25.6-38.4C384 608 364.8 620.8 364.8 633.6c-19.2 64-70.4 128-96 153.6l-57.6-19.2c32-38.4 70.4-96 83.2-153.6l76.8-294.4 166.4 44.8c6.4 0 19.2 0 25.6 0C569.6 364.8 576 358.4 582.4 352L640 128l83.2 19.2-57.6 224c-6.4 19.2 6.4 32 19.2 38.4L832 454.4C819.2 524.8 780.8 691.2 755.2 748.8z","p-id":"1372",fill:"#ffffff"}}),s("path",{attrs:{d:"M364.8 473.6C364.8 492.8 371.2 505.6 390.4 512l339.2 96c0 0 6.4 0 6.4 0 12.8 0 25.6-6.4 32-25.6 6.4-19.2-6.4-32-19.2-38.4L409.6 448C390.4 448 371.2 454.4 364.8 473.6z","p-id":"1373",fill:"#ffffff"}})])]),s("textarea",{directives:[{name:"model",rawName:"v-model",value:t.askContent,expression:"askContent"}],domProps:{value:t.askContent},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:(e.preventDefault(),t.sendAsk(e))},input:function(e){e.target.composing||(t.askContent=e.target.value)}}})])])])},i=[],l=s("a78e"),n=s.n(l),c=s("d4cd"),a=s.n(c),r=s("1487"),h=s.n(r),d=(s("6e2e"),s("bc3a")),p=s.n(d),g={name:"Dashboard",data(){return{apiPost:"http://127.0.0.1:8083",collects:[],collect:"test",askContent:"",msgList:[{type:"ask",content:"自建私有数据知识库 · 与知识库AI聊天"},{type:"answer",content:"我是知识库机器人,一个专门响应人类指令的大模型"}]}},methods:{sendAsk(){if(""==this.askContent)return;let t={type:"ask",content:this.askContent};this.msgList.push(t);let e=JSON.stringify(this.msgList);localStorage.setItem("data_"+this.collect,e),this.scrollBottom(),this.getReplyFromApi()},selectCollect(t){this.collect=t,this.msgList=[],this.getHistory()},getCollects(){let t=this;fetch(this.apiPost+"/collects",{method:"get"}).then(t=>t.json()).then(e=>{console.log(e),t.collects=e.result.collections})},getReplyFromApi(){let t=this,e={type:"answer",content:"正在为你生成答案..."};t.msgList.push(e);p.a.get(`${this.apiPost}/${this.collect}/searchStream`,{params:{keywords:this.askContent,system:"假设你是一个文档,你必须根据提供的知识信息回答问题"},headers:{"Content-Type":"text/html"},onDownloadProgress:t=>{console.log(t);let e=t.target.responseText;this.msgList[this.msgList.length-1].content=e,this.scrollBottom();let s=JSON.stringify(this.msgList);localStorage.setItem("data_"+this.collect,s)}}).then(t=>{console.log(t);let e=t.data;this.msgList[this.msgList.length-1].conten
|