chunk-0eed3357.19ecb195.js 41 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0eed3357"],{"07ac":function(e,t,a){var n=a("23e7"),o=a("6f53").values;n({target:"Object",stat:!0},{values:function(e){return o(e)}})},"23d4":function(e,t,a){"use strict";a("b974")},"6f53":function(e,t,a){var n=a("83ab"),o=a("df75"),i=a("fc6a"),r=a("d1e7").f,s=function(e){return function(t){var a,s=i(t),l=o(s),c=l.length,u=0,d=[];while(c>u)a=l[u++],n&&!r.call(s,a)||d.push(e?[a,s[a]]:s[a]);return d}};e.exports={entries:s(!0),values:s(!1)}},"7e84":function(e,t,a){"use strict";a("b4da")},b4da:function(e,t,a){},b974:function(e,t,a){},c4c4:function(e,t,a){},c50c:function(e,t,a){"use strict";a("c4c4")},ed61:function(e,t,a){"use strict";a.r(t);var n,o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"project-search"},[a("div",{staticClass:"file-categories"},[a("el-button",{attrs:{type:"primary"},on:{click:e.createNewFolder}},[a("i",{staticClass:"el-icon-plus"}),e._v(" 新建目录 ")]),a("p",[e._v(e._s(e.$route.query.name))]),a("el-tree",{ref:"folderTree",attrs:{data:e.folders,props:e.defaultProps,"default-expanded-keys":["0"],"node-key":"id","highlight-current":""},on:{"node-click":e.handleNodeClick},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.node,o=t.data;return a("span",{staticClass:"custom-tree-node"},[a("span",{staticClass:"tree_title"},[a("i",{staticClass:"el-icon-folder"}),a("span",{staticClass:"folder-name",attrs:{title:n.label}},[e._v(e._s(n.label))])]),"001"!==o.id?a("span",{class:e.getFileCountClass(o.id)},[e._v(e._s(o.document_count)+" files")]):e._e(),0!==o.id&&"001"!==o.id?a("span",{staticClass:"folder-actions"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"编辑",placement:"top"}},[a("i",{staticClass:"el-icon-edit",on:{click:function(t){return t.stopPropagation(),e.editFolder(o)}}})]),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除",placement:"top"}},[a("i",{staticClass:"el-icon-delete",on:{click:function(t){return t.stopPropagation(),e.deleteFolder(o.id)}}})])],1):e._e()])}}])})],1),a("div",{staticClass:"right"},[a("dataSearch",{on:{bindSetQuery:e.setQuery}}),a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"data-list",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"batch-actions",staticStyle:{margin:"10px 0"}},[a("el-button",{attrs:{type:"primary",disabled:!e.selectedRows.length},on:{click:e.batchAnalysis}},[e._v("批量解析")]),a("el-button",{attrs:{type:"primary",disabled:!e.selectedRows.length},on:{click:e.batchModifyFolder}},[e._v("批量修改目录")]),a("el-button",{attrs:{type:"primary",disabled:!e.selectedRows.length},on:{click:e.batchDelect}},[e._v("批量删除")])],1),a("el-table",{ref:"dataTable",staticStyle:{width:"100%","font-size":"12px"},attrs:{data:e.dataList,"header-row-class-name":"headerBg","empty-text":"暂无数据"},on:{"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),a("el-table-column",{attrs:{prop:"id",label:"ID",align:"center",width:"80"}}),a("el-table-column",{attrs:{prop:"name",label:"文件名称",sortable:"custom",width:"350"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",[e._v(e._s(t.row.name))])]}}])}),a("el-table-column",{attrs:{prop:"type",label:"文件类型",align:"center"}}),a("el-table-column",{attrs:{prop:"chunk_num",label:"分块数",align:"center"}}),a("el-table-column",{attrs:{prop:"create_time",label:"上传时间",align:"center",sortable:"custom",width:"140"}}),a("el-table-column",{attrs:{prop:"run",label:"解析状态",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[0==t.row.run?a("div",[e._v("未解析")]):e._e(),1==t.row.run?a("div",[e._v("解析中")]):e._e(),3==t.row.run?a("div",[e._v("成功")]):e._e(),4==t.row.run?a("div",[e._v("失败")]):e._e(),5==t.row.run?a("div",[e._v("待处理")]):e._e(),6==t.row.run?a("div",[e._v("文件异常")]):e._e()]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center",fixed:"right",width:"180"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"operations-container"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"预览",placement:"top"}},[e.checkAuth("/document/update")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-view"},on:{click:function(a){return e.getName(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"修改文件名",placement:"top"}},[e.checkAuth("/document/update")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-edit"},on:{click:function(a){return e.btnEdit(t.row)}}}):e._e()],1),a("el-popover",{attrs:{placement:"bottom",trigger:"click","popper-class":"operations-popover"},scopedSlots:e._u([{key:"reference",fn:function(){return[a("el-button",{staticClass:"operation-button",staticStyle:{"font-size":"15px","margin-left":"10px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-more"}})]},proxy:!0}],null,!0)},[a("div",{staticClass:"additional-operations"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:1==t.row.run||5==t.row.run?"已解析数:"+t.row.progress:"解析",placement:"top"}},[1!=t.row.run&&5!=t.row.run?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",icon:"el-icon-caret-right",circle:""},on:{click:function(a){return e.analysis(t.row)}}}):a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",icon:"el-icon-loading",circle:"",disabled:!0}})],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"解析方法",placement:"top"}},[e.checkAuth("/document/update")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-tickets"},on:{click:function(a){return e.Analytical(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"下载",placement:"top"}},[a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-download",loading:t.row.downloading},on:{click:function(a){return e.btnDown(t.row)}}})],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除",placement:"top"}},[e.checkAuth("/document/delete")?a("el-button",{staticStyle:{"font-size":"15px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-delete"},on:{click:function(a){return e.btnDelete(t.row.id)}}}):e._e()],1)],1)])],1)]}}])})],1),a("div",{staticClass:"page-info"},[a("el-pagination",{attrs:{currentPage:e.queryForm.page,"page-size":e.queryForm.pageSize,total:e.recordCount,"page-count":e.pageTotal,"page-sizes":[10,20,50,100],background:"",layout:"total,sizes, prev, pager, next"},on:{"current-change":e.ChangePage,"size-change":e.handleSizeChange}})],1),a("el-dialog",{attrs:{title:"修改名称",visible:e.dialogVisible,width:"30%","before-close":e.handleClose},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("el-form",{ref:"wordRef",attrs:{model:e.wordForm,rules:e.wordRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"new_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:e.wordForm.new_name,callback:function(t){e.$set(e.wordForm,"new_name",t)},expression:"wordForm.new_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBuck}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"解析方法",visible:e.anaDialogVisible,width:"30%","before-close":e.handleAnalClose},on:{"update:visible":function(t){e.anaDialogVisible=t}}},[a("el-form",{ref:"analRef",attrs:{model:e.analForm,"label-position":"top",rules:e.analRules}},[a("el-form-item",{attrs:{label:"页码范围:",prop:"new_name"}},[a("el-input-number",{attrs:{"controls-position":"right",min:1},model:{value:e.analForm.start_page,callback:function(t){e.$set(e.analForm,"start_page",t)},expression:"analForm.start_page"}}),a("el-input-number",{staticStyle:{"margin-left":"10px"},attrs:{"controls-position":"right",min:1},model:{value:e.analForm.end_page,callback:function(t){e.$set(e.analForm,"end_page",t)},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:e.analForm.token_num,callback:function(t){e.$set(e.analForm,"token_num",t)},expression:"analForm.token_num"}})],1)])],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:e.handleAnalClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitAnal}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"新建目录",visible:e.newFolderDialogVisible,width:"30%"},on:{"update:visible":function(t){e.newFolderDialogVisible=t}}},[a("el-form",{ref:"newFolderFormRef",attrs:{model:e.newFolderForm,rules:e.newFolderRules}},[a("el-form-item",{attrs:{label:"文件夹名称",prop:"name"}},[a("el-input",{model:{value:e.newFolderForm.name,callback:function(t){e.$set(e.newFolderForm,"name",t)},expression:"newFolderForm.name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.newFolderDialogVisible=!1}}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitNewFolder}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"批量修改目录",visible:e.batchModifyFolderDialogVisible,width:"30%"},on:{"update:visible":function(t){e.batchModifyFolderDialogVisible=t}}},[a("el-form",{ref:"batchModifyFolderFormRef",attrs:{model:e.batchModifyFolderForm,rules:e.batchModifyFolderRules}},[a("el-form-item",{attrs:{label:"选择目录",prop:"folderId"}},[a("el-select",{attrs:{placeholder:"请选择目录"},model:{value:e.batchModifyFolderForm.folderId,callback:function(t){e.$set(e.batchModifyFolderForm,"folderId",t)},expression:"batchModifyFolderForm.folderId"}},e._l(e.folders.filter((function(e){return 0!==e.id})),(function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.batchModifyFolderDialogVisible=!1}}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBatchModifyFolder}},[e._v("确 定")])],1)],1)],1)],1)])},i=[],r=a("ade3"),s=a("2909"),l=a("3835"),c=a("5530"),u=(a("99af"),a("4de4"),a("caad"),a("d81d"),a("13d5"),a("4e82"),a("b0c0"),a("e9c4"),a("a9e3"),a("d3b7"),a("07ac"),a("ac1f"),a("25f0"),a("2532"),a("3ca3"),a("841c"),a("159b"),a("ddb0"),a("2b3d"),a("bf19"),a("9861"),a("2f62")),d=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"data-search"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:e.queryForm}},[a("el-form-item",{attrs:{label:"文件名:"}},[a("el-input",{attrs:{placeholder:"请填写文件名"},model:{value:e.queryForm.object_name,callback:function(t){e.$set(e.queryForm,"object_name",t)},expression:"queryForm.object_name"}})],1),a("el-form-item",{attrs:{label:"解析状态:"}},[a("el-select",{staticClass:"m-2",attrs:{clearable:"",placeholder:"请选择状态",size:"large"},model:{value:e.queryForm.run,callback:function(t){e.$set(e.queryForm,"run",t)},expression:"queryForm.run"}},e._l(e.categoryList,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),a("el-form-item",{attrs:{label:"文件类型:"}},[a("el-select",{staticClass:"m-2",attrs:{clearable:"",placeholder:"请选择文件类型",size:"large"},model:{value:e.queryForm.type,callback:function(t){e.$set(e.queryForm,"type",t)},expression:"queryForm.type"}},e._l(e.typeList,(function(e){return a("el-option",{key:e,attrs:{label:e,value:e}})})),1)],1),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[a("svg-icon",{attrs:{"icon-class":"search"}}),e._v(" 搜索")],1)],1),a("el-form-item",[a("el-button",{staticClass:"el-icon-circle-plus-outline",attrs:{type:"primary"},on:{click:e.addDocument}},[e._v("新增文件")])],1)],1),a("el-dialog",{attrs:{title:"创建知识库",visible:e.dialogVisible,width:"30%","before-close":e.handleClose},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("el-form",{ref:"creatRef",attrs:{model:e.creatForm,rules:e.creatRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"bucket_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:e.creatForm.bucket_name,callback:function(t){e.$set(e.creatForm,"bucket_name",t)},expression:"creatForm.bucket_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBuck}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"上传文件",visible:e.uploadVisible,width:"30%","before-close":e.handleUploadClose},on:{"update:visible":function(t){e.uploadVisible=t}}},[a("el-form",{ref:"uploadRef",attrs:{model:e.uploadForm,rules:e.uploadRules}},[a("el-form-item",[a("el-upload",{staticClass:"upload-demo custom-upload",attrs:{drag:"",action:e.url+"/minio/post",data:{bucket_id:e.queryForm.bucket_id,user_id:e.queryForm.user_id,doc_type_id:0},multiple:"","on-change":e.handleFileChange,"file-list":e.fileList,"on-success":e.handleAvatarSuccess,"on-error":e.handleUploadError}},[a("i",{staticClass:"el-icon-upload"}),a("div",{staticClass:"el-upload__text"},[e._v(" 将文件拖到此处,或"),a("em",[e._v("点击上传")])])])],1)],1)],1)],1)},m=[],f=(a("00b4"),a("db6a")),h={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:[{value:"0",label:"未解析"},{value:"1",label:"解析中"},{value:"3",label:"成功"},{value:"4",label:"失败"},{value:"5",label:"待处理"}],creatForm:{bucket_name:""},creatRules:{bucket_name:[{required:!0,message:"请输入知识库名称",trigger:"blur"}]},uploadVisible:!1,uploadRules:{},uploadForm:{},fileList:[],url:"",typeList:[]}},mounted:function(){this.url="http://58.246.234.210:8084",this.queryForm.bucket_id=this.$route.query.id,this.queryForm.user_id=this.$store.state.user.id,this.getType()},methods:Object(r["a"])(Object(r["a"])({onCreate:function(e){this.dialogVisible=!0},onSubmit:function(){this.$emit("bindSetQuery",this.$props.queryForm)},addDocument:function(){this.uploadVisible=!0},newFile:function(){},handleClose:function(e){e()},submitBuck:function(){var e=this;this.$refs.creatRef.validate((function(t){t?createBucket(e.creatForm).then((function(t){200===t.status&&(e.dialogVisible=!1,e.onSubmit(),e.creatForm={})})):e.$message.error("请填写知识库名称")}))},handleUploadClose:function(e){e()},handleFileChange:function(e,t){var a=this;this.fileList=t.map((function(e){return e.uid||(e.uid=Date.now()+a.randomString()),e}))},randomString:function(){return Math.random().toString(36).substring(2,15)},handleRemove:function(e,t){this.fileList=t},handleAvatarSuccess:function(e,t,a){200==e.status?(this.$emit("bindSetQuery",this.$props.queryForm),this.$message.success("添加成功!"),this.uploadVisible=!1):(this.$message.warning(e.message),this.removeFile(a))},handleUploadError:function(e,t,a){this.$message.error("上传失败: "+e.message),this.removeFile(t)},removeFile:function(e){this.$refs.upload.handleRemove(e)}},"handleUploadClose",(function(){this.uploadVisible=!1,this.fileList=[]})),"getType",(function(){var e=this;Object(f["r"])().then((function(t){e.typeList=t.data}))}))},p=h,b=(a("23d4"),a("2877")),g=Object(b["a"])(p,d,m,!1,null,null,null),y=g.exports,_=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"data-list",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"batch-actions",staticStyle:{margin:"10px 0"}},[a("el-button",{attrs:{type:"primary",disabled:!e.selectedRows.length},on:{click:e.batchAnalysis}},[e._v("批量解析")])],1),a("el-table",{ref:"dataTable",staticStyle:{width:"100%"},attrs:{data:e.dataList,"header-row-class-name":"headerBg","empty-text":"没有模板信息"},on:{"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),a("el-table-column",{attrs:{prop:"id",label:"ID",align:"center",width:"80"}}),a("el-table-column",{attrs:{prop:"name",label:"文件名称",align:"center",sortable:"custom"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",[e._v(e._s(t.row.name))])]}}])}),a("el-table-column",{attrs:{prop:"type",label:"文件类型",align:"center"}}),a("el-table-column",{attrs:{prop:"chunk_num",label:"分块数",align:"center"}}),a("el-table-column",{attrs:{prop:"create_time",label:"上传时间",align:"center",sortable:"custom"}}),a("el-table-column",{attrs:{prop:"run",label:"解析状态",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[0==t.row.run?a("div",[e._v("未解析")]):e._e(),1==t.row.run?a("div",[e._v("解析中")]):e._e(),3==t.row.run?a("div",[e._v("成功")]):e._e(),4==t.row.run?a("div",[e._v("失败")]):e._e(),5==t.row.run?a("div",[e._v("待处理")]):e._e(),6==t.row.run?a("div",[e._v("文件异常")]):e._e()]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center",width:"330"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"btns"},[a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"预览",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-view"},on:{click:function(a){return e.getName(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"1"===t.row.run||"5"===t.row.run?"解析中":"解析",placement:"top"}},["1"!==t.row.run||"5"!==t.row.run?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",icon:"el-icon-caret-right",circle:""},on:{click:function(a){return e.analysis(t.row)}}}):a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",icon:"el-icon-loading",circle:"",disabled:!0}})],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"解析方法",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-tickets"},on:{click:function(a){return e.Analytical(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"修改文件名",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-edit"},on:{click:function(a){return e.btnEdit(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"下载",placement:"top"}},[e.allowEdit?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-download",loading:t.row.downloading},on:{click:function(a){return e.btnDown(t.row)}}}):e._e()],1),a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除",placement:"top"}},[e.allowDelete?a("el-button",{staticStyle:{"font-size":"20px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-delete"},on:{click:function(a){return e.btnDelete(t.row.id)}}}):e._e()],1)],1)]}}])})],1),a("div",{staticClass:"page-info"},[a("el-pagination",{attrs:{currentPage:e.queryForm.page,"page-size":e.queryForm.pageSize,total:e.recordCount,"page-count":e.pageTotal,"page-sizes":[10,20,50,100],background:"",layout:"sizes, prev, pager, next"},on:{"current-change":e.ChangePage,"size-change":e.handleSizeChange}})],1),a("el-dialog",{attrs:{title:"修改名称",visible:e.dialogVisible,width:"30%","before-close":e.handleClose},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("el-form",{ref:"wordRef",attrs:{model:e.wordForm,rules:e.wordRules}},[a("el-form-item",{attrs:{label:"文件名称:",prop:"new_name"}},[a("el-input",{attrs:{placeholder:"请输入文件名称"},model:{value:e.wordForm.new_name,callback:function(t){e.$set(e.wordForm,"new_name",t)},expression:"wordForm.new_name"}})],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitBuck}},[e._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"解析方法",visible:e.anaDialogVisible,width:"30%","before-close":e.handleAnalClose},on:{"update:visible":function(t){e.anaDialogVisible=t}}},[a("el-form",{ref:"analRef",attrs:{model:e.analForm,"label-position":"top",rules:e.analRules}},[a("el-form-item",{attrs:{label:"页码范围:",prop:"new_name"}},[a("el-input-number",{attrs:{"controls-position":"right",min:1},model:{value:e.analForm.start_page,callback:function(t){e.$set(e.analForm,"start_page",t)},expression:"analForm.start_page"}}),a("el-input-number",{staticStyle:{"margin-left":"10px"},attrs:{"controls-position":"right",min:1},model:{value:e.analForm.end_page,callback:function(t){e.$set(e.analForm,"end_page",t)},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:e.analForm.token_num,callback:function(t){e.$set(e.analForm,"token_num",t)},expression:"analForm.token_num"}})],1)])],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.handleAnalClose}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.submitAnal}},[e._v("确 定")])],1)],1)],1)},v=[],w={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(e){this.search()},deep:!0}},data:function(){return Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["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",{}),"selectedRows",[]),"sortColumn",""),"sortOrder",""),"analysisStatusCheckers",{})},mounted:function(){this.search()},beforeDestroy:function(){Object.values(this.analysisStatusCheckers).forEach(clearTimeout)},methods:Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])({handleSortChange:function(e){var t=e.prop,a=e.order;this.sortColumn=t,this.sortOrder=a,this.sortData()},sortData:function(){var e=this.sortColumn,t=this.sortOrder;e&&t?this.dataList.sort((function(a,n){var o=0;return"name"===e?o=a.name.localeCompare(n.name,"zh-CN"):"create_time"===e&&(o=new Date(a.create_time)-new Date(n.create_time)),"ascending"===t?o:-o})):this.search()},handleSelectionChange:function(e){this.selectedRows=e},batchAnalysis:function(){var e=this,t=this.selectedRows.map((function(e){return e.id}));0!==t.length?this.$confirm("确定要批量解析选中的文件吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.loading=!0,Object(f["e"])({ids:JSON.stringify(t)}).then((function(a){200===a.status?(e.$message.success("批量解析任务已提交"),e.updateAnalysisStatus(t),e.clearSelection()):e.$message.error("批量解析请求失败")})).catch((function(t){console.error("批量解析错误:",t),e.$message.error("批量解析过程中出现错误")})).finally((function(){e.loading=!1}))})).catch((function(){})):this.$message.warning("请选择要解析的文件")},updateAnalysisStatus:function(e){var t=this;this.dataList.forEach((function(a){e.includes(a.id)&&(a.run=1,t.startAnalysisStatusChecker(a))}))},clearSelection:function(){this.$refs.dataTable.clearSelection(),this.selectedRows=[]},getName:function(e){var t=document.createElement("a");t.href="#/infoList?id=".concat(e.id,"&type=").concat(e.type),t.target="_blank",t.click()},analysis:function(e){var t=this;1!==e.run&&5!==e.run&&(this.$set(e,"run",1),Object(f["b"])({document_id:e.id,start_page:e.start_page||0,end_page:e.end_page||1e3,max_tokens:e.token_num}).then((function(a){200===a.status?t.startAnalysisStatusChecker(e):(t.$message.error("解析请求失败"),t.$set(e,"run",0))})).catch((function(a){console.error("解析错误:",a),t.$message.error("解析过程中出现错误"),t.$set(e,"run",0)})))},startAnalysisStatusChecker:function(e){var t=this;this.analysisStatusCheckers[e.id]&&clearTimeout(this.analysisStatusCheckers[e.id]);var a=function a(){Object(f["q"])({document_id:e.id}).then((function(n){if(200===n.status){var o=Number(n.data.run);t.$set(e,"run",o),3===o?(t.$message.success("解析成功"),delete t.analysisStatusCheckers[e.id]):4===o?(t.$message.error("解析失败"),delete t.analysisStatusCheckers[e.id]):1!==o&&5!==o||(t.analysisStatusCheckers[e.id]=setTimeout(a,5e3+5e3*Math.random()))}else t.$message.error("获取解析状态失败"),t.$set(e,"run",0),delete t.analysisStatusCheckers[e.id]})).catch((function(a){console.error("获取解析状态错误:",a),t.$message.error("获取解析状态时出现错误"),t.$set(e,"run",0),delete t.analysisStatusCheckers[e.id]}))};a()},handleAnalClose:function(){this.anaDialogVisible=!1},submitAnal:function(){var e=this;this.dataList.map((function(t){e.analForm.id==t.id&&(t.start_page=e.analForm.start_page,t.end_page=e.analForm.end_page,t.token_num=e.analForm.token_num)})),this.anaDialogVisible=!1},Analytical:function(e){this.analForm.id=e.id,this.analForm.token_num=e.token_num,this.anaDialogVisible=!0},editWidth:function(){return this.allowDelete&&this.allowEdit?200:this.allowDelete||this.allowEdit?120:100},onFocusVal:function(e){var t=this;t.currentDataId=e.target.dataset.id},onChangeVal:function(e){var t=this;t.currentDataId},btnDelete:function(e){var t=this,a={document_id:e};t.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(e){Object(f["m"])(a).then((function(e){200===e.status&&(t.$message.success(e.data),t.search())}))})).catch((function(){}))},searchData:function(){var e=this;e.dialogVisible=!1,e.search()},handleClose:function(e){e()},btnEdit:function(e){this.wordForm.new_name=e.name,this.wordForm.document_id=e.id,this.dialogVisible=!0},submitBuck:function(){var e=this;this.$refs.wordRef.validate((function(t){t?Object(f["z"])(e.wordForm).then((function(t){200===t.status&&(e.search(),e.dialogVisible=!1,e.wordForm={new_name:"",document_id:""})})):e.$message.error("请填写文档名称")}))},btnDown:function(e){var t=this;this.$set(e,"downloading",!0),Object(f["y"])({document_id:e.id}).then((function(e){if(200===e.status)return fetch(e.data.url);t.$message.error("获取下载链接失败")})).then((function(e){return e.blob()})).then((function(t){var a=window.URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e.name,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(a)}),100)})).catch((function(e){console.error("下载出错:",e),t.$message.error("下载失败,请稍后重试")})).finally((function(){t.$set(e,"downloading",!1)}))}},"handleClose",(function(){var e=this;e.currentData={},e.dialogVisible=!1})),"search",(function(){var e=this;e.loading=!0,Object(f["p"])(e.queryForm).then((function(t){200===t.status&&(e.dataList=t.data.documents.map((function(t){return Object(c["a"])(Object(c["a"])({},t),{},{token_num:256,start_page:e.analForm.start_page,end_page:e.analForm.end_page})})),e.pageTotal=t.data.pagination.total_count,e.recordCount=t.data.pagination.total_count,e.queryForm.pageSize=t.data.pagination.total_size,e.loading=!1,e.dataList.forEach((function(t){console.log(t.run),"1"!==t.run&&"5"!==t.run||e.startAnalysisStatusChecker(t)})))})).catch((function(){e.loading=!1}))})),"ChangePage",(function(e){var t=this;t.queryForm.page=e,t.search()})),"handleSizeChange",(function(e){this.queryForm.pageSize=e,this.queryForm.page=1,this.search()}))},k=w,F=(a("c50c"),Object(b["a"])(k,_,v,!1,null,null,null)),C=F.exports,$={components:{dataSearch:y,dataList:C},computed:Object(c["a"])({},Object(u["b"])(["roleInfo","authList"])),data:function(){return{queryForm:{page:1,pageSize:10,bucket_id:"",doc_type_id:0},typeForm:{page:1,pageSize:9999,kb_id:""},folders:[{id:"001",name:"全部",document_count:0}],defaultProps:{children:"children",label:"name"},loading:!1,dialogVisible:!1,currentDataId:0,recordCount:0,pageTotal:1,dataList:[],currentData:{},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:{},selectedRows:[],sortColumn:"",sortOrder:"",analysisStatusCheckers:{},newFolderDialogVisible:!1,newFolderForm:{name:"",kb_id:"",status:5},newFolderRules:{name:[{required:!0,message:"请输入文件夹名称",trigger:"blur"}]},batchModifyFolderDialogVisible:!1,batchModifyFolderForm:{folderId:null},batchModifyFolderRules:{folderId:[{required:!0,message:"请选择目标目录",trigger:"change"}]}}},mounted:function(){var e=this;this.queryForm.bucket_id=this.$route.query.id,this.typeForm.kb_id=this.$route.query.id,this.$nextTick((function(){e.initializeTree()})),this.typeList(),this.search()},beforeDestroy:function(){Object.values(this.analysisStatusCheckers).forEach(clearTimeout)},methods:(n={handleCommand:function(e,t){switch(e){case"analysis":this.analysis(t);break;case"analyticalMethod":this.Analytical(t);break;case"download":this.btnDown(t);break;case"delete":this.btnDelete(t.id);break}},getFileCountClass:function(e){var t=0===e||"001"===e;return console.log("ID: ".concat(e,", Class: ").concat(t?"file-counts":"file-count")),t?"file-counts":"file-count"},batchModifyFolder:function(){0!==this.selectedRows.length?this.batchModifyFolderDialogVisible=!0:this.$message.warning("请选择要修改目录的文件")},submitBatchModifyFolder:function(){var e=this;this.$refs.batchModifyFolderFormRef.validate((function(t){if(t){var a=e.selectedRows.map((function(e){return e.id}));console.log(a),Object(f["f"])({ids:JSON.stringify(a),doc_type_id:e.batchModifyFolderForm.folderId}).then((function(t){200===t.status?(e.$message.success("批量修改目录成功"),e.batchModifyFolderDialogVisible=!1,e.search(),e.typeList(),e.clearSelection()):e.$message.error("批量修改目录失败")})).catch((function(t){console.error("批量修改目录时出错:",t),e.$message.error("批量修改目录时出错")}))}}))},editFolder:function(e){var t=this;this.$prompt("请输入新的文件夹名称","编辑文件夹",{confirmButtonText:"确定",cancelButtonText:"取消",inputValue:e.name,inputValidator:function(e){return!!e||"文件夹名称不能为空"}}).then((function(a){var n=a.value;if(n!==e.name){var o=Object(c["a"])(Object(c["a"])({},e),{},{name:n});Object(f["J"])(o).then((function(e){200===e.status?(t.$message.success("更新文件夹成功"),t.typeList()):t.$message.error("更新文件夹失败")})).catch((function(e){console.error("更新文件夹时出错:",e),t.$message.error("更新文件夹时出错")}))}})).catch((function(){}))},deleteFolder:function(e){var t=this;this.$confirm("确定要删除该文件夹吗?删除后无法恢复。","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(f["n"])({id:e}).then((function(e){200===e.status?(t.$message.success("删除文件夹成功"),t.typeList()):t.$message.error("删除文件夹失败")})).catch((function(e){console.error("删除文件夹时出错:",e),t.$message.error("删除文件夹时出错")}))})).catch((function(){}))},typeList:function(){var e=this;this.loading=!0,Promise.all([Object(f["E"])(this.typeForm),Object(f["D"])({kb_id:this.typeForm.kb_id,type_id:0})]).then((function(t){var a=Object(l["a"])(t,2),n=a[0],o=a[1];if(200===n.status&&200===o.status){var i=n.data.dataList.map((function(e){return Object(c["a"])(Object(c["a"])({},e),{},{id:0===e.id?"001":e.id.toString(),document_count:e.document_count||0})})),r=i.reduce((function(e,t){return e+t.document_count}),0),u=o.data||0;e.folders=[{id:"001",name:"全部",document_count:r+u}].concat(Object(s["a"])(i.filter((function(e){return"001"!==e.id&&0!==e.id}))),[{id:0,name:"其他",document_count:u}]),e.$nextTick((function(){e.initializeTree()}))}else e.$message.error("获取文件夹列表失败")})).catch((function(t){console.error("获取文件夹列表时出错:",t),e.$message.error("获取文件夹列表时出错")})).finally((function(){e.loading=!1}))},initializeTree:function(){var e=this;this.$nextTick((function(){e.$refs.folderTree&&(e.$refs.folderTree.setCurrentKey(0),e.handleNodeClick(e.folders[0]))}))},createNewFolder:function(){this.newFolderDialogVisible=!0},submitNewFolder:function(){var e=this;this.$refs.newFolderFormRef.validate((function(t){t&&(e.newFolderForm.kb_id=e.$route.query.id,Object(f["u"])(e.newFolderForm).then((function(t){200===t.status?(e.$message.success("创建文件夹成功"),e.newFolderDialogVisible=!1,e.$refs.newFolderFormRef.resetFields(),e.typeList()):e.$message.error("创建文件夹失败")})))}))}},Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(n,"initializeTree",(function(){var e=this;this.$nextTick((function(){e.$refs.folderTree&&(e.$refs.folderTree.setCurrentKey("001"),e.handleNodeClick(e.folders[0]))}))})),"checkAuth",(function(e){return 1===this.roleInfo.is_admin||this.authList.some((function(t){return 999===t.type&&t.path===e}))})),"setQuery",(function(e){this.queryForm=Object(c["a"])(Object(c["a"])({},this.queryForm),e),this.search()})),"handleNodeClick",(function(e){this.queryForm.doc_type_id="001"===e.id?"":e.id,this.queryForm.page=1,this.search()})),"handleSortChange",(function(e){var t=e.prop,a=e.order;this.sortColumn=t,this.sortOrder=a,this.sortData()})),"sortData",(function(){var e=this.sortColumn,t=this.sortOrder;e&&t?this.dataList.sort((function(a,n){var o=0;return"name"===e?o=a.name.localeCompare(n.name,"zh-CN"):"create_time"===e&&(o=new Date(a.create_time)-new Date(n.create_time)),"ascending"===t?o:-o})):this.search()})),"handleSelectionChange",(function(e){this.selectedRows=e})),"batchAnalysis",(function(){var e=this,t=this.selectedRows.map((function(e){return e.id}));0!==t.length?this.$confirm("确定要批量解析选中的文件吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.loading=!0,Object(f["c"])({document_ids:JSON.stringify(t)}).then((function(a){200===a.status?(e.$message.success("批量解析任务已提交"),e.updateAnalysisStatus(t),e.clearSelection()):e.$message.error("批量解析请求失败")})).catch((function(t){console.error("批量解析错误:",t),e.$message.error("批量解析过程中出现错误")})).finally((function(){e.loading=!1}))})).catch((function(){})):this.$message.warning("请选择要解析的文件")})),"batchDelect",(function(){var e=this,t=this.selectedRows.map((function(e){return e.id}));0!==t.length?this.$confirm("确定要批量删除选中的文件吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.loading=!0,Object(f["j"])({document_ids:JSON.stringify(t)}).then((function(t){200===t.status?(e.$message.success("批量删除已完成"),e.search()):e.$message.error("批量删除请求失败")})).catch((function(e){})).finally((function(){e.loading=!1}))})).catch((function(){})):this.$message.warning("请选择要删除的文件")})),"updateAnalysisStatus",(function(e){var t=this;this.dataList.forEach((function(a){e.includes(a.id)&&(a.run=1,t.startAnalysisStatusChecker(a))}))})),Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(n,"clearSelection",(function(){this.$refs.dataTable.clearSelection(),this.selectedRows=[]})),"getName",(function(e){var t=document.createElement("a");t.href="#/infoList?id=".concat(e.id,"&type=").concat(e.type.toLowerCase()),t.target="_blank",t.click()})),"analysis",(function(e){var t,a,n=this;if(1!=e.run&&5!=e.run){this.$set(e,"run",1);var o={document_ids:JSON.stringify([e.id]),start_page:null!==(t=e.start_page)&&void 0!==t?t:0,end_page:null!==(a=e.end_page)&&void 0!==a?a:1e3,max_tokens:e.token_num};Object(f["c"])(o).then((function(t){200===t.status?n.startAnalysisStatusChecker(e):(n.$message.error("解析请求失败"),n.$set(e,"run",0))})).catch((function(t){console.error("解析错误:",t),n.$message.error("解析过程中出现错误"),n.$set(e,"run",0)}))}})),"startAnalysisStatusChecker",(function(e){var t=this;this.analysisStatusCheckers[e.id]&&clearTimeout(this.analysisStatusCheckers[e.id]);var a=function a(){Object(f["t"])({document_id:e.id}).then((function(n){if(200===n.status){var o=Number(n.data.status),i=Number(n.data.total_tasks);t.$set(e,"run",o),t.$set(e,"progress",i),3===o?(t.$message.success("解析成功"),delete t.analysisStatusCheckers[e.id],t.refreshCurrentList()):4===o?(t.$message.error("解析失败"),delete t.analysisStatusCheckers[e.id]):1!==o&&5!==o||(t.analysisStatusCheckers[e.id]=setTimeout(a,15e3))}else t.$message.error("获取解析状态失败"),delete t.analysisStatusCheckers[e.id]})).catch((function(a){console.error("获取解析状态错误:",a),t.$message.error("获取解析状态时出现错误"),delete t.analysisStatusCheckers[e.id]}))};a()})),"refreshCurrentList",(function(){var e=this,t=this.queryForm.page,a=this.queryForm.pageSize;return this.search().then((function(){e.queryForm.page=t,e.queryForm.pageSize=a})).catch((function(t){console.error("刷新列表时出错:",t),e.$message.error("刷新列表失败,请稍后重试")}))})),"handleAnalClose",(function(){this.anaDialogVisible=!1})),"submitAnal",(function(){var e=this;this.dataList.map((function(t){e.analForm.id==t.id&&(t.start_page=e.analForm.start_page,t.end_page=e.analForm.end_page,t.token_num=e.analForm.token_num)})),this.anaDialogVisible=!1})),"Analytical",(function(e){this.analForm.id=e.id,this.analForm.token_num=e.token_num,this.anaDialogVisible=!0})),"editWidth",(function(){return this.allowDelete&&this.allowEdit?200:this.allowDelete||this.allowEdit?120:100})),"onFocusVal",(function(e){var t=this;t.currentDataId=e.target.dataset.id})),Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(Object(r["a"])(n,"onChangeVal",(function(e){var t=this;t.currentDataId})),"btnDelete",(function(e){var t=this,a={document_id:e};t.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(e){Object(f["m"])(a).then((function(e){200===e.status&&(t.$message.success(e.data),t.search())}))})).catch((function(){}))})),"searchData",(function(){var e=this;e.dialogVisible=!1,e.search()})),"handleClose",(function(e){e()})),"btnEdit",(function(e){this.wordForm.new_name=e.name,this.wordForm.document_id=e.id,this.dialogVisible=!0})),"submitBuck",(function(){var e=this;this.$refs.wordRef.validate((function(t){t?Object(f["z"])(e.wordForm).then((function(t){200===t.status&&(e.search(),e.dialogVisible=!1,e.wordForm={new_name:"",document_id:""})})):e.$message.error("请填写文档名称")}))})),"btnDown",(function(e){var t=this;this.$set(e,"downloading",!0),Object(f["y"])({document_id:e.id}).then((function(e){if(200===e.status)return fetch(e.data.url);t.$message.error("获取下载链接失败")})).then((function(e){return e.blob()})).then((function(t){var a=window.URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e.name,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(a)}),100)})).catch((function(e){console.error("下载出错:",e),t.$message.error("下载失败,请稍后重试")})).finally((function(){t.$set(e,"downloading",!1)}))})),"handleClose",(function(){var e=this;e.currentData={},e.dialogVisible=!1})),"search",(function(){var e=this;return e.loading=!0,new Promise((function(t,a){Object(f["p"])(e.queryForm).then((function(n){200===n.status?(e.dataList=n.data.documents.map((function(t){return Object(c["a"])(Object(c["a"])({},t),{},{token_num:256,start_page:e.analForm.start_page,end_page:e.analForm.end_page})})),e.pageTotal=n.data.pagination.total_count,e.recordCount=n.data.pagination.total_count,e.queryForm.pageSize=n.data.pagination.total_size,e.loading=!1,e.dataList.forEach((function(t){1!=t.run&&5!=t.run||e.startAnalysisStatusChecker(t)})),t()):a(new Error("Invalid response status"))})).catch((function(t){e.loading=!1,a(t)}))}))})),"ChangePage",(function(e){var t=this;t.queryForm.page=e,t.search()})),Object(r["a"])(n,"handleSizeChange",(function(e){this.queryForm.pageSize=e,this.queryForm.page=1,this.search()})))},S=$,O=(a("7e84"),Object(b["a"])(S,o,i,!1,null,"24e3ae6a",null));t["default"]=O.exports}}]);