1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3c07cddb"],{2535:function(t,e,a){"use strict";a("6dd0")},"40a0":function(t,e,a){"use strict";a("88b5")},"6dd0":function(t,e,a){},"88b5":function(t,e,a){},c35d:function(t,e,a){},db6a:function(t,e,a){"use strict";a.d(e,"f",(function(){return o})),a.d(e,"b",(function(){return i})),a.d(e,"c",(function(){return l})),a.d(e,"e",(function(){return r})),a.d(e,"d",(function(){return s})),a.d(e,"g",(function(){return u})),a.d(e,"h",(function(){return c})),a.d(e,"i",(function(){return d})),a.d(e,"a",(function(){return m})),a.d(e,"j",(function(){return f}));var n=a("b775");function o(t){return Object(n["a"])({url:"/kbm/selectBucketInfo",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/minio/createBucket",method:"post",data:t})}function l(t){return Object(n["a"])({url:"/kbm/deleteBucket",method:"post",data:t})}function r(t){return Object(n["a"])({url:"/kbm/getFileInfo",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/kbm/deleteDocument",method:"post",data:t})}function u(t){return Object(n["a"])({url:"/kbm/getUrl",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/minio/post",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/kbm/updateName",method:"post",data:t})}function m(t){return Object(n["a"])({url:"/kbm/analysis",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/kbm/searchTaskInfo",method:"post",data:t})}},ed61:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"project-search"},[a("dataSearch",{on:{bindSetQuery:t.setQuery}}),a("dataList",{attrs:{queryForm:t.queryForm,allowEdit:t.checkAuth("/document/update"),allowDelete:t.checkAuth("/document/delete")}})],1)},o=[],i=a("5530"),l=a("2f62"),r=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"data-search"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:t.queryForm}},[a("el-form-item",{attrs:{label:"文件名:"}},[a("el-input",{attrs:{placeholder:"请填写文件名"},model:{value:t.queryForm.object_name,callback:function(e){t.$set(t.queryForm,"object_name",e)},expression:"queryForm.object_name"}})],1),a("el-form-item"),a("el-form-item",[a("el-popover",{attrs:{placement:"bottom",trigger:"click"}},[a("el-button",{on:{click:t.addDocument}},[t._v("本地文件")]),a("el-button",{on:{click:t.newFile}},[t._v("新建空文件")]),a("el-button",{staticClass:"el-icon-circle-plus-outline",attrs:{slot:"reference",type:"primary"},slot:"reference"},[t._v(" 新增文件")])],1)],1)],1),a("el-dialog",{attrs:{title:"创建知识库",visible:t.dialogVisible,width:"30%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("el-form",{ref:"creatRef",attrs:{model:t.creatForm,rules:t.creatRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"bucket_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:t.creatForm.bucket_name,callback:function(e){t.$set(t.creatForm,"bucket_name",e)},expression:"creatForm.bucket_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:t.handleClose}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:t.submitBuck}},[t._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"上传文件",visible:t.uploadVisible,width:"30%","before-close":t.handleUploadClose},on:{"update:visible":function(e){t.uploadVisible=e}}},[a("el-form",{ref:"uploadRef",attrs:{model:t.uploadForm,rules:t.uploadRules}},[a("el-form-item",[a("el-upload",{staticClass:"upload-demo",attrs:{drag:"",action:t.url+"/minio/post",data:{bucket_id:t.queryForm.bucket_id,user_id:t.queryForm.user_id},multiple:"","on-change":t.handleFileChange,"file-list":t.fileList,"on-success":t.handleAvatarSuccess}},[a("i",{staticClass:"el-icon-upload"}),a("div",{staticClass:"el-upload__text"},[t._v(" 将文件拖到此处,或"),a("em",[t._v("点击上传")])]),a("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[t._v(" 只能上传jpg/png文件,且不超过500kb ")])])],1)],1)],1)],1)},s=[],u=a("ade3"),c=(a("d81d"),a("ac1f"),a("00b4"),a("db6a")),d={props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,bucket_id:"",user_id:""}}}},data:function(){return{statusOptions:[{value:"",label:"请选择状态"},{value:5,label:"启用"},{value:6,label:"停用"}],dialogVisible:!1,categoryList:[],creatForm:{bucket_name:""},creatRules:{bucket_name:[{required:!0,message:"请输入知识库名称",trigger:"blur"}]},uploadVisible:!1,uploadRules:{},uploadForm:{},fileList:[],url:""}},mounted:function(){this.url="http://120.46.190.49:8000",this.queryForm.bucket_id=this.$route.query.id,this.queryForm.user_id=this.$store.state.user.id},methods:Object(u["a"])(Object(u["a"])({onCreate:function(t){this.dialogVisible=!0},onSubmit:function(){console.log(11),this.$emit("bindSetQuery",this.$props.queryForm)},addDocument:function(){this.uploadVisible=!0},newFile:function(){},handleClose:function(t){t()},submitBuck:function(){var t=this;this.$refs.creatRef.validate((function(e){e?createBucket(t.creatForm).then((function(e){200===e.status&&(t.dialogVisible=!1,t.onSubmit(),t.creatForm={})})):t.$message.error("请填写知识库名称")}))},handleUploadClose:function(t){t()},handleFileChange:function(t,e){this.fileList=e.map((function(t){return t.raw}))},handleRemove:function(t,e){this.fileList=e},handleAvatarSuccess:function(t,e){this.$emit("bindSetQuery",this.$props.queryForm),this.$message.success("添加成功!"),this.uploadVisible=!1},submitUpload:function(){console.log("Files to upload:",this.fileList),this.uploadVisible=!1,this.fileList=[]}},"handleUploadClose",(function(){this.uploadVisible=!1,this.fileList=[]})),"submitUpload",(function(){var t=this;this.fileList.map((function(e){Object(c["h"])({bucket_name:t.queryForm.bucket_name,file:e}).then((function(t){console.log(t)}))}))}))},m=d,f=(a("40a0"),a("2877")),b=Object(f["a"])(m,r,s,!1,null,null,null),p=b.exports,h=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"data-list",attrs:{"element-loading-text":"加载中..."}},[a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.dataList,"header-row-class-name":"headerBg","empty-text":"没有模板信息"}},[a("el-table-column",{attrs:{prop:"id",label:"ID",align:"center",width:"80"}}),a("el-table-column",{attrs:{prop:"name",label:"文件名称",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",{on:{click:function(a){return t.getName(e.row)}}},[t._v(t._s(e.row.name))])]}}])}),a("el-table-column",{attrs:{prop:"token_num",label:"分块数",align:"center"}}),a("el-table-column",{attrs:{prop:"create_time",label:"上传时间",align:"center"}}),a("el-table-column",{attrs:{prop:"createTime",label:"启用",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[5==e.row.status?a("div",[t._v("启用")]):t._e(),6==e.row.status?a("div",[t._v("停用")]):t._e()]}}])}),a("el-table-column",{attrs:{prop:"run",label:"解析状态",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[0==e.row.run?a("div",[t._v("未解析")]):t._e(),1==e.row.run?a("div",[t._v("解析中")]):t._e(),3==e.row.run?a("div",[t._v("成功")]):t._e(),4==e.row.run?a("div",[t._v("失败")]):t._e()]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center",width:"500"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"btns"},[t.allowEdit?a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(a){return t.analysis(e.row)}}},[t._v("解析")]):t._e(),t.allowEdit?a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(a){return t.Analytical(e.row)}}},[t._v("解析方法")]):t._e(),t.allowEdit?a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(a){return t.btnEdit(e.row)}}},[a("svg-icon",{attrs:{"icon-class":"edit"}}),t._v("修改文件名")],1):t._e(),t.allowEdit?a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(a){return t.btnDown(e.row.name)}}},[a("svg-icon",{attrs:{"icon-class":"edit"}}),t._v("下载")],1):t._e(),t.allowDelete?a("el-button",{attrs:{type:"danger",size:"small"},on:{click:function(a){return t.btnDelete(e.row.id)}}},[a("svg-icon",{attrs:{"icon-class":"delete"}}),t._v("删除")],1):t._e()],1)]}}])})],1),a("div",{staticClass:"page-info"},[a("el-pagination",{attrs:{currentPage:t.queryForm.page,"page-size":t.queryForm.pageSize,total:t.recordCount,"page-count":t.pageTotal,background:"",layout:"prev, pager, next"},on:{"current-change":t.ChangePage}})],1),a("el-dialog",{attrs:{title:"修改名称",visible:t.dialogVisible,width:"30%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("el-form",{ref:"wordRef",attrs:{model:t.wordForm,rules:t.wordRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"new_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:t.wordForm.new_name,callback:function(e){t.$set(t.wordForm,"new_name",e)},expression:"wordForm.new_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:t.handleClose}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:t.submitBuck}},[t._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"解析方法",visible:t.anaDialogVisible,width:"30%","before-close":t.handleAnalClose},on:{"update:visible":function(e){t.anaDialogVisible=e}}},[a("el-form",{ref:"analRef",attrs:{model:t.analForm,"label-position":"top",rules:t.analRules}},[a("el-form-item",{attrs:{label:"页码范围:",prop:"new_name"}},[a("el-input-number",{attrs:{"controls-position":"right",min:1},model:{value:t.analForm.start_page,callback:function(e){t.$set(t.analForm,"start_page",e)},expression:"analForm.start_page"}}),a("el-input-number",{staticStyle:{"margin-left":"10px"},attrs:{"controls-position":"right",min:1},model:{value:t.analForm.end_page,callback:function(e){t.$set(t.analForm,"end_page",e)},expression:"analForm.end_page"}})],1),a("el-form-item",{attrs:{label:"块token数"}},[a("div",{staticClass:"block"},[a("el-slider",{attrs:{max:2048,"show-input":""},model:{value:t.analForm.token_num,callback:function(e){t.$set(t.analForm,"token_num",e)},expression:"analForm.token_num"}})],1)])],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:t.handleAnalClose}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:t.submitAnal}},[t._v("确 定")])],1)],1)],1)},g=[],_=(a("b0c0"),a("d3b7"),a("3ca3"),a("841c"),a("ddb0"),a("2b3d"),a("bf19"),a("9861"),{props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,id:""}}},allowEdit:{type:Boolean,default:!1},allowDelete:{type:Boolean,default:!1}},watch:{queryForm:{handler:function(t){this.search()},deep:!0}},data:function(){return Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])(Object(u["a"])({loading:!1,dialogVisible:!1,currentDataId:0,recordCount:0,pageTotal:1,dataList:[],currentData:{}},"dialogVisible",!1),"wordForm",{document_id:"",new_name:""}),"wordRules",{new_name:[{required:!0,message:"请输入文件名称",trigger:"blur"}]}),"anaDialogVisible",!1),"analForm",{start_page:1,end_page:1e4,token_num:0}),"analRules",{})},mounted:function(){this.search()},methods:Object(u["a"])(Object(u["a"])(Object(u["a"])({getName:function(t){this.$router.push({path:"/knowledge/category/infoList",query:{id:6}})},analysis:function(t){Object(c["a"])({document_id:t.id,start_page:0,end_page:1e3,max_tokens:t.token_num}).then((function(t){}))},handleAnalClose:function(){this.anaDialogVisible=!1},submitAnal:function(){var t=this;this.dataList.map((function(e){t.analForm.id==e.id&&(e.start_page=t.analForm.start_page,e.end_page=t.analForm.end_page,e.token_num=t.analForm.token_num)}))},Analytical:function(t){this.analForm.id=t.id,this.analForm.token_num=t.token_num,this.anaDialogVisible=!0},editWidth:function(){return this.allowDelete&&this.allowEdit?200:this.allowDelete||this.allowEdit?120:100},onFocusVal:function(t){var e=this;e.currentDataId=t.target.dataset.id},onChangeVal:function(t){var e=this;e.currentDataId},btnDelete:function(t){var e=this,a={document_id:t};e.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(t){Object(c["d"])(a).then((function(t){200===t.status&&(e.$message.success(t.data),e.search())}))})).catch((function(){}))},searchData:function(){var t=this;t.dialogVisible=!1,t.search()},handleClose:function(t){t()},btnEdit:function(t){this.wordForm.new_name=t.name,this.wordForm.document_id=t.id,this.dialogVisible=!0},submitBuck:function(){var t=this;this.$refs.wordRef.validate((function(e){e?Object(c["i"])(t.wordForm).then((function(e){200===e.status&&(t.search(),t.dialogVisible=!1,t.wordForm={new_name:"",document_id:""})})):t.$message.error("请填写文档名称")}))},btnDown:function(t){var e=this;Object(c["g"])({name:t}).then((function(a){200===a.status?fetch(a.data.url).then((function(t){return t.blob()})).then((function(e){var a=window.URL.createObjectURL(e),n=document.createElement("a");n.href=a,n.download=t,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(a)}),100)})).catch((function(t){console.error("下载出错:",t),e.$message.error("下载失败,请稍后重试")})):e.$message.error("获取下载链接失败")})).catch((function(t){console.error("获取下载链接出错:",t),e.$message.error("获取下载链接失败,请稍后重试")}))}},"handleClose",(function(){var t=this;t.currentData={},t.dialogVisible=!1})),"search",(function(){var t=this,e=this;e.loading=!0,Object(c["e"])(e.queryForm).then((function(a){200===a.status&&(a.data.documents.map((function(e){e.start_page=t.analForm.start_page,e.end_page=t.analForm.end_page})),e.dataList=a.data.documents,e.pageTotal=a.data.pagination.total_count,e.loading=!1)})).catch((function(){e.loading=!1}))})),"ChangePage",(function(t){var e=this;e.queryForm.page=t,e.search()}))}),v=_,k=(a("2535"),Object(f["a"])(v,h,g,!1,null,null,null)),w=k.exports,y={components:{dataSearch:p,dataList:w},computed:Object(i["a"])({},Object(l["b"])(["roleInfo","authList"])),data:function(){return{queryForm:{page:1,pageSize:10,bucket_id:""}}},mounted:function(){this.queryForm.bucket_id=this.$route.query.id},methods:{checkAuth:function(t){return this.roleInfo.is_admin,!0},setQuery:function(t){this.queryForm=t}}},F=y,j=(a("fc83"),Object(f["a"])(F,n,o,!1,null,null,null));e["default"]=j.exports},fc83:function(t,e,a){"use strict";a("c35d")}}]);
|