1 |
- import{_ as e,r as t,g as l,c as s,a as i,u as a,$ as n,n as o,b as d,d as r,e as p,f as c,w as x,F as f,i as h,h as u,j as g,o as m,k as y,l as b,m as _,p as w,q as D,t as k,s as C,v as z,x as v,y as E,z as j,A as I,B,C as N,D as A,E as M}from"./index-2PZN6pGH.js";import{_ as $,a as F}from"./uni-grid.DpCkTXPK.js";import{_ as T}from"./uni-tooltip.BooQ_fry.js";import{r as S,u as O,_ as q,a as P}from"./send.BLyP2Of5.js";const J=e({data:()=>({sendMessage:"",databaseInfo:[],dbIndex:null,tableNames:[],temp:{},sendDic:{},tables:[]}),onLoad(){t({url:"http://10.41.1.220:8067/get_client_id/",method:"POST",data:{},success:async e=>{console.log("我的全局id",e.data.client_id),l().globalData.client_id=e.data.client_id},fail:()=>{},complete:()=>{}})},methods:{sureAction(){this.sendDic=this.temp,this.$refs.popup.close()},sure(){this.temp.db_param=this.databaseInfo[this.dbIndex].db_param,this.temp.table_name=this.tableNames,this.$refs.table.close()},selectTable(e){const t=e.detail.index,l=this.databaseInfo[this.dbIndex].tables;if(this.tableNames.length>0){if(this.tableNames.includes(l[t])){let e=this.tableNames.filter((e=>e!==l[t]));this.tableNames=e,console.log(e)}else this.tableNames.push(l[t])}else this.tableNames.push(l[t])},selectDataBase(e){const t=e.detail.index;this.dbIndex=t,this.$refs.dp.close(),this.$refs.table.open("center")},openDataBase(){t({url:"http://10.41.1.220:8067/database/",method:"POST",data:{},success:async e=>{this.databaseInfo=e.data.databaseInfo,this.dbIndex=null,this.tableNames=[],this.$refs.dp.open("center")},fail:()=>{},complete:()=>{}})},fileChange(e){0==e.show&&(this.temp={})},tableChange(e){0==e.show&&(this.dbIndex=null,this.tableNames=[])},uploadFile(){s({count:1,extension:[".csv",".xlsx"],success:async e=>{i({success:async t=>{a({url:"http://10.41.1.220:8067/uploadfile/",filePath:e.tempFilePaths[0],name:"file",formData:{client_id:l().globalData.client_id},success:async e=>{const t=JSON.parse(e.data);this.temp.file_names=[],this.temp.file_names.push(t.file_path)},fail(e){console.log(JSON.stringify(e))}})}})}})},closeDB(){this.$refs.dp.close()},closeTable(){this.$refs.table.close()},close(){this.$refs.popup.close()},link(){this.$refs.popup.open()},enter(){this.send()},input(e){this.sendMessage=e.detail.value},blobToFile:(e,t)=>new File([e],t,{path:e,type:"text/csv",lastModified:Date.now()}),selectFile(){s({count:1,type:"file",success:e=>{const t=e.tempFiles[0],l=new FileReader;l.onload=e=>{const t=new Uint8Array(e.target.result),l=S(t,{type:"array"}),s=l.SheetNames[0],i=l.Sheets[s],a=O.sheet_to_json(i,{header:1});console.log(a)},l.readAsArrayBuffer(t)}})},async send(){var e,t;""!=this.sendMessage&&(this.sendDic.prompt=this.sendMessage,this.sendDic.history=[{role:"user",content:this.sendMessage,files:null==(e=this.sendDic.file_names)?void 0:e.map((e=>"http://10.41.1.220:8067"+e))}],this.sendDic.file_names=null==(t=this.sendDic.file_names)?void 0:t.map((e=>e.split("/").slice(-1)[0])),l().globalData.test.push(this.sendDic),l().globalData.selectIndex=l().globalData.test.length,n("updateDetail",{detail:"8"}),console.log(JSON.stringify(l().globalData.test)),o({url:"/pages/about/about?id="+l().globalData.selectIndex,success:e=>{},fail:()=>{},complete:()=>{}}))}}},[["render",function(e,t,l,s,i,a){const n=N,o=A,S=h,O=d(r("uni-icons"),u),J=d(r("uni-popup"),g),K=d(r("uni-grid-item"),$),L=d(r("uni-grid"),F),R=M,U=d(r("uni-tooltip"),T);return m(),p(f,null,[c(J,{ref:"popup","border-radius":"8px",type:"center",onChange:a.fileChange},{default:x((()=>[c(S,{style:{width:"698px",height:"518px","border-radius":"8px","background-color":"white",display:"flex","flex-direction":"column",padding:"24px"}},{default:x((()=>{var e,t;return[c(S,{style:{display:"flex","flex-direction":"row","justify-content":"space-between","align-items":"center","margin-bottom":"24px"}},{default:x((()=>[c(n,{style:{color:"#05192D","font-size":"20px","font-weight":"bold"}},{default:x((()=>[y("上传附件")])),_:1}),c(o,{src:b,style:{width:"16px",height:"16px"},onClick:a.close},null,8,["onClick"])])),_:1}),c(S,{style:{display:"flex","flex-direction":"row","align-items":"center","margin-bottom":"8px"}},{default:x((()=>[c(o,{src:_,style:{width:"24px",height:"24px","margin-right":"4px"}}),c(n,{style:{color:"#05192D","font-size":"18px","font-weight":"bold"}},{default:x((()=>[y("文件")])),_:1})])),_:1}),c(n,{style:{color:"#5D6A77","font-size":"14px","margin-bottom":"24px"}},{default:x((()=>[y("选择要分析的文件")])),_:1}),c(S,{onClick:a.uploadFile,style:{height:"72px",border:"1px dashed #E0E2E9","border-radius":"8px",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center","margin-bottom":"12px"}},{default:x((()=>[c(S,{style:{display:"flex","flex-direction":"row","margin-bottom":"8px"}},{default:x((()=>[c(n,{style:{color:"#5D6A77","font-size":"14px"}},{default:x((()=>[y("将文件拖曳到此处或")])),_:1}),c(n,{style:{color:"#B19083","font-size":"14px","font-weight":"bold"}},{default:x((()=>[y("点击上传")])),_:1})])),_:1}),c(S,{style:{display:"flex","flex-direction":"row"}},{default:x((()=>[c(n,{style:{color:"#5D6A77","font-size":"12px","background-color":"#C5CDD4",width:"37px",height:"18px","text-align":"center","border-radius":"6px","margin-right":"8px"}},{default:x((()=>[y(".csv")])),_:1}),c(n,{style:{color:"#5D6A77","font-size":"12px","background-color":"#C5CDD4",width:"40px",height:"18px","text-align":"center","border-radius":"6px"}},{default:x((()=>[y(".xlsx")])),_:1})])),_:1})])),_:1},8,["onClick"]),(null==(e=i.temp.file_names)?void 0:e.length)>0?(m(),w(S,{key:0,style:{display:"flex","flex-direction":"row","align-items":"center",height:"52px",width:"319px",border:"1px solid #E0E2E9","border-radius":"8px","justify-content":"space-between",padding:"0 24px","margin-bottom":"24px"}},{default:x((()=>[c(S,{style:{display:"flex","flex-direction":"row"}},{default:x((()=>[c(o,{src:D,style:{width:"20px",height:"20px","margin-right":"4px"}}),c(n,{style:{color:"#05192D","font-size":"14px"}},{default:x((()=>{var e;return[y(k(null==(e=i.temp.file_names[0])?void 0:e.split("/").slice(-1)[0]),1)]})),_:1})])),_:1}),c(o,{src:C,style:{width:"16px",height:"16px"}})])),_:1})):z("",!0),c(S,{style:{display:"flex","flex-direction":"row","align-items":"center","margin-bottom":"8px"}},{default:x((()=>[c(o,{src:_,style:{width:"24px",height:"24px","margin-right":"4px"}}),c(n,{style:{color:"#05192D","font-size":"18px","font-weight":"bold"}},{default:x((()=>[y("数据库")])),_:1})])),_:1}),c(n,{style:{color:"#5D6A77","font-size":"14px","margin-bottom":"24px"}},{default:x((()=>[y("选择要分析的数据库")])),_:1}),c(S,{onClick:a.openDataBase,style:{display:"flex","flex-direction":"row",height:"48px",border:"1px dashed #E0E2E9","border-radius":"8px","align-items":"center","justify-content":"center","margin-bottom":"12px"}},{default:x((()=>[c(O,{type:"plusempty",size:"18px",style:{"margin-right":"4px"},color:"#B19083"}),c(n,{style:{color:"#B19083","font-size":"14px","font-weight":"bold"}},{default:x((()=>[y("连接数据库")])),_:1})])),_:1},8,["onClick"]),null!=i.temp.db_param?(m(),w(S,{key:1,style:{display:"flex","flex-direction":"row","align-items":"center",height:"52px",width:"319px",border:"1px solid #E0E2E9","border-radius":"8px","justify-content":"space-between",padding:"0 24px","margin-bottom":"24px"}},{default:x((()=>[c(S,{style:{display:"flex","flex-direction":"row"}},{default:x((()=>[c(o,{src:v,style:{width:"20px",height:"20px","margin-right":"4px"}}),c(n,{style:{color:"#05192D","font-size":"14px"}},{default:x((()=>[y(k(i.temp.table_name.join(",")),1)])),_:1})])),_:1}),c(o,{src:C,style:{width:"16px",height:"16px"}})])),_:1})):z("",!0),(null==(t=i.temp.file_names)?void 0:t.length)>0||null!=i.temp.db_param?(m(),w(n,{key:2,style:{color:"white","font-size":"14px",width:"98px",height:"40px","background-color":"#B19083","align-items":"center","align-content":"center","text-align":"center","justify-content":"center","justify-items":"center","border-radius":"8px"},onClick:a.sureAction},{default:x((()=>[y("确定")])),_:1},8,["onClick"])):z("",!0)]})),_:1})])),_:1},8,["onChange"]),c(J,{ref:"dp","border-radius":"8px"},{default:x((()=>[c(S,{style:{width:"698px",height:"304px","border-radius":"8px","background-color":"white",display:"flex","flex-direction":"column","box-sizing":"border-box",padding:"24px"}},{default:x((()=>[c(S,{style:{display:"flex","flex-direction":"row","justify-content":"space-between","align-items":"center","margin-bottom":"8px"}},{default:x((()=>[c(n,{style:{color:"#05192D","font-size":"20px","font-weight":"bold"}},{default:x((()=>[y("连接数据库")])),_:1}),c(o,{src:b,style:{width:"16px",height:"16px"},onClick:a.closeDB},null,8,["onClick"])])),_:1}),c(n,{style:{color:"#5D6A77","font-size":"14px","margin-bottom":"24px"}},{default:x((()=>[y("选择要连接的数据库")])),_:1}),c(L,{column:2,showBorder:!1,square:!1,onChange:a.selectDataBase,style:{overflow:"auto"}},{default:x((()=>[(m(!0),p(f,null,E(i.databaseInfo,((e,t)=>(m(),w(K,{index:t,key:t,style:B([{"margin-right":t%2==0?"12px":0},{height:"52px",width:"319px","margin-bottom":"12px"}])},{default:x((()=>[c(S,{style:{display:"flex","flex-direction":"row","justify-content":"space-between","align-items":"center",padding:"0 24px",border:"1px solid #E0E2E9","border-radius":"8px",height:"100%"}},{default:x((()=>[c(n,{style:{color:"#05192D","font-size":"14px"}},{default:x((()=>[y(k(e.db_param),1)])),_:2},1024),c(o,{src:C,style:{width:"16px",height:"16px"}})])),_:2},1024)])),_:2},1032,["index","style"])))),128))])),_:1},8,["onChange"])])),_:1})])),_:1},512),c(J,{ref:"table","border-radius":"8px",onChange:a.tableChange},{default:x((()=>[c(S,{style:{width:"698px",height:"304px","border-radius":"8px","background-color":"white",display:"flex","flex-direction":"column","box-sizing":"border-box",padding:"24px"}},{default:x((()=>[c(S,{style:{display:"flex","flex-direction":"row","justify-content":"space-between","align-items":"center","margin-bottom":"8px"}},{default:x((()=>[c(n,{style:{color:"#05192D","font-size":"20px","font-weight":"bold"}},{default:x((()=>[y("选择表")])),_:1}),c(o,{src:b,style:{width:"16px",height:"16px"},onClick:a.closeTable},null,8,["onClick"])])),_:1}),c(n,{style:{color:"#5D6A77","font-size":"14px","margin-bottom":"24px"}},{default:x((()=>[y("选择要连接的表")])),_:1}),c(L,{column:2,showBorder:!1,square:!1,onChange:a.selectTable,style:{overflow:"auto"}},{default:x((()=>{var e;return[(m(!0),p(f,null,E(null==(e=i.databaseInfo[i.dbIndex])?void 0:e.tables,((e,t)=>(m(),w(K,{index:t,key:t,style:B([{"margin-right":t%2==0?"12px":0},{height:"52px",width:"319px","margin-bottom":"12px"}])},{default:x((()=>[c(S,{style:B([{border:i.tableNames.includes(e)?"1px solid #B19083":"1px solid #E0E2E9"},{display:"flex","flex-direction":"row","justify-content":"space-between","align-items":"center",padding:"0 24px","border-radius":"8px",height:"100%"}])},{default:x((()=>[c(n,{style:{color:"#05192D","font-size":"14px"}},{default:x((()=>[y(k(e),1)])),_:2},1024)])),_:2},1032,["style"])])),_:2},1032,["index","style"])))),128))]})),_:1},8,["onChange"]),i.tableNames.length>0?(m(),w(n,{key:0,style:{color:"white","font-size":"14px",width:"98px",height:"40px","background-color":"#B19083","align-items":"center","align-content":"center","text-align":"center","justify-content":"center","justify-items":"center","border-radius":"8px"},onClick:a.sure},{default:x((()=>[y("确定")])),_:1},8,["onClick"])):z("",!0)])),_:1})])),_:1},8,["onChange"]),c(S,{class:"body"},{default:x((()=>[c(n,{class:"welcome-title"},{default:x((()=>[y("无主题工作簿")])),_:1}),c(S,{class:"content-column"},{default:x((()=>[c(o,{class:"goodImage",src:"/assets/goodday-CdxYcOhl.png"}),c(n,{class:"goodText"},{default:x((()=>[y("让我们一起度过美好的一天!")])),_:1}),c(S,{class:"question-stack"},{default:x((()=>{var e;return[(null==(e=i.sendDic.file_names)?void 0:e.length)>0?(m(),w(S,{key:0,style:{display:"flex","flex-direction":"row",height:"42px","background-color":"#E0E1E9",width:"180px","align-items":"center","justify-content":"center","border-radius":"8px","margin-bottom":"12px"}},{default:x((()=>[c(o,{src:D,style:{width:"20px",height:"20px","margin-right":"4px"}}),c(n,{style:{color:"#05192D","font-size":"14px"}},{default:x((()=>{var e;return[y(k(null==(e=i.sendDic.file_names[0])?void 0:e.split("/").slice(-1)[0]),1)]})),_:1})])),_:1})):z("",!0),c(R,{class:"myTextarea",value:i.sendMessage,onInput:a.input,onKeydown:j(a.enter,["enter"]),placeholder:"请输入你想知道的问题答案...",maxlength:"-1","auto-height":"","placeholder-style":"color:#5D6A77;font-size: 14px;font-weight: 400;border: 1,solid,#B19083;"},null,8,["value","onInput","onKeydown"]),c(S,{style:{display:"flex","flex-direction":"row","align-items":"center","justify-content":"space-between"}},{default:x((()=>[c(U,null,{content:x((()=>[c(S,{style:{width:"200px"}},{default:x((()=>[y(" 支持上传文件(最多 50 个,每个 100 MB)接受 pdf、doc、xlsx、ppt、txt、图片等 ")])),_:1})])),default:x((()=>[c(o,{src:q,class:"linkImage",onClick:t[0]||(t[0]=e=>a.link())})])),_:1}),null!=i.sendDic.db_param?(m(),w(S,{key:0,style:{display:"flex","flex-direction":"row"}},{default:x((()=>[c(o,{src:v,style:{width:"20px",height:"20px","margin-right":"4px"}}),c(n,{style:{color:"#05192D","font-size":"14px"}},{default:x((()=>[y(k(i.sendDic.table_name.join(",")),1)])),_:1})])),_:1})):z("",!0),c(U,null,I({default:x((()=>[c(o,{style:B({"background-color":""==i.sendMessage?"#E0E1E9":"royalblue"}),src:P,class:"sendImage",onClick:a.send},null,8,["style","onClick"])])),_:2},[""==i.sendMessage?{name:"content",fn:x((()=>[c(S,{style:{width:"90px","text-align":"center"}},{default:x((()=>[y(" 请输入你的问题 ")])),_:1})])),key:"0"}:void 0]),1024)])),_:1})]})),_:1})])),_:1})])),_:1})],64)}],["__scopeId","data-v-26c37e3d"]]);export{J as default};
|