@acedatacloud/nexior 3.30.3 → 3.30.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Auth-C4dVHIKO.js → Auth-kGCys-gn.js} +1 -1
- package/dist/assets/{BotPlaceholder-Blzus1Ba.js → BotPlaceholder-DghltQML.js} +1 -1
- package/dist/assets/{Callback-CTYxeo8Z.js → Callback-DWSKlIl4.js} +1 -1
- package/dist/assets/{Console-BbGWMKKZ.js → Console-_IS1qii3.js} +1 -1
- package/dist/assets/{Conversation-DiVMGW94.js → Conversation-DuQtYVf4.js} +1 -1
- package/dist/assets/{CopyToClipboard-CmHXEPMr.js → CopyToClipboard-CEtp94k8.js} +1 -1
- package/dist/assets/{Detail-VDnCOUUU.js → Detail-t2hlFwRn.js} +2 -2
- package/dist/assets/{EditArray-OA-NVBZO.js → EditArray-cZSRSfyf.js} +1 -1
- package/dist/assets/{Extra-BY28y3mx.js → Extra-CbORdop1.js} +1 -1
- package/dist/assets/{FilePreview-DQpvzXs_.js → FilePreview-Cs6OrAfv.js} +1 -1
- package/dist/assets/{History-B1pKVuTR.js → History-gexbX9Zv.js} +1 -1
- package/dist/assets/{ImagePreview-DpdyaY-J.js → ImagePreview--cM1y0-F.js} +1 -1
- package/dist/assets/{ImageWrapper-D-q49c6z.js → ImageWrapper-CQl1PxLF.js} +1 -1
- package/dist/assets/{Index-D7GnQkM4.js → Index-Acpzatzh.js} +1 -1
- package/dist/assets/{Index-guHNQauE.js → Index-B0a5arSf.js} +1 -1
- package/dist/assets/Index-BCpgwdRH.js +1 -0
- package/dist/assets/{Index-Ba9yXMzu.js → Index-BJHZd94h.js} +1 -1
- package/dist/assets/{Index-Dia7Vi_r.js → Index-BNmeEQ_3.js} +1 -1
- package/dist/assets/{Index-DgsKsh3B.js → Index-Bb5DDJPy.js} +1 -1
- package/dist/assets/{Index-CCcF6hZ9.js → Index-BjRYYdFX.js} +1 -1
- package/dist/assets/{Index-O0SBFGmH.js → Index-BrxMTx-Y.js} +1 -1
- package/dist/assets/{Index-myIt_TK4.js → Index-C57ALtjZ.js} +1 -1
- package/dist/assets/{Index-C7LHJpMK.js → Index-C60cc38l.js} +1 -1
- package/dist/assets/{Index-dyBrOVOM.js → Index-C7BtYXwv.js} +1 -1
- package/dist/assets/{Index-D2oTY94j.js → Index-CfVhUM4U.js} +1 -1
- package/dist/assets/Index-D5sduOkc.js +1 -0
- package/dist/assets/{Index-xfpPqB6k.js → Index-D8nMB7dN.js} +1 -1
- package/dist/assets/Index-DXRd2oDS.css +1 -0
- package/dist/assets/Index-DY0jBLbu.css +1 -0
- package/dist/assets/{Index-DZT53ftk.js → Index-DZ-DbWl-.js} +1 -1
- package/dist/assets/{Index-BJGORTT2.js → Index-HQInAAfi.js} +1 -1
- package/dist/assets/{Index-DUJTbNQH.js → Index-aB38D9pu.js} +1 -1
- package/dist/assets/{Index-_Jl_BYAz.js → Index-lMyEH6f1.js} +1 -1
- package/dist/assets/{Index-D1Rz1tfd.js → Index-u8wK3QUd.js} +1 -1
- package/dist/assets/{Index-sDMWgguk.js → Index-zpannX8x.js} +1 -1
- package/dist/assets/{Invitees-DkWxP4e3.js → Invitees-CYP2iQv2.js} +1 -1
- package/dist/assets/{List-BxIMcYD8.js → List-CAfyfgl5.js} +1 -1
- package/dist/assets/{List-BqzG7ehZ.js → List-CdFnDuaR.js} +1 -1
- package/dist/assets/{List-CEq_u8D0.js → List-DSRVmKTe.js} +1 -1
- package/dist/assets/{Main-CQsNTqVL.js → Main-BIRiKmiG.js} +1 -1
- package/dist/assets/{Navigator-BrdQZd1b.js → Navigator-CjErsr21.js} +1 -1
- package/dist/assets/{NoTasks-BiOsXlaq.js → NoTasks-CSLShB84.js} +1 -1
- package/dist/assets/{Pagination-BbqydTat.js → Pagination-Dw29mJpo.js} +1 -1
- package/dist/assets/{ScrollList-DPLKBqBd.js → ScrollList-6wsUvcj6.js} +1 -1
- package/dist/assets/{Status-UWszJlPM.js → Status-CLz-FCw7.js} +1 -1
- package/dist/assets/{Subscribe-DUBYadQ1.js → Subscribe-CV4VHuLD.js} +1 -1
- package/dist/assets/{TransportWebHID-BEAZzcY0.js → TransportWebHID-CzVKn3HZ.js} +1 -1
- package/dist/assets/{VideoPlayer-DWTQSZjy.js → VideoPlayer-DMQFBZXN.js} +1 -1
- package/dist/assets/avatar-CN1uA8Po.js +1 -0
- package/dist/assets/avatar-Cfr3XS98.css +1 -0
- package/dist/assets/{bignumber-C1xKUtxX.js → bignumber-BLJFVpCv.js} +1 -1
- package/dist/assets/common-81UClLTs.js +1 -0
- package/dist/assets/common-J82jiJjj.js +1 -0
- package/dist/assets/{distribution-CJuee8y2.js → distribution-Bn30t-dJ.js} +1 -1
- package/dist/assets/{index-CJFrXZHu.css → index-BC2cccGJ.css} +1 -1
- package/dist/assets/{index-jeGnfJ_l.js → index-BtWLfZip.js} +1 -1
- package/dist/assets/{index-FyDryJF8.js → index-CCYW3AUY.js} +5 -5
- package/dist/assets/{index-DLiWuf1u.js → index-CZva-t16.js} +1 -1
- package/dist/assets/{index-D-6_CPHX.js → index-D5QRd2Da.js} +1 -1
- package/dist/assets/{index-D_w37A4E.js → index-DE_Wy0Gu.js} +1 -1
- package/dist/assets/{index-BfyfYtZm.js → index-DGZsu5Ph.js} +1 -1
- package/dist/assets/{index-C49kyaKg.js → index-DxHsOOmw.js} +1 -1
- package/dist/assets/{index-C1rwxuCG.js → index-qzP26Lh5.js} +1 -1
- package/dist/assets/{index.es-L8lIAtWn.js → index.es-mIRAKQ1A.js} +1 -1
- package/dist/assets/{order-DUXA8yqM.js → order-DrwwxsRb.js} +1 -1
- package/dist/assets/{price-BRDkc6EK.js → price-hx3Y1R4a.js} +1 -1
- package/dist/assets/{solana-wallets-o-Zvvwmq.js → solana-wallets-Cb3-7F7O.js} +2 -2
- package/dist/assets/{solanaEmbed.esm-B2cUJHFV.js → solanaEmbed.esm-DHLMHDSC.js} +1 -1
- package/dist/assets/{string_decoder-BJaILowq.js → string_decoder-BDwfFX0y.js} +1 -1
- package/dist/assets/{vendor-web3-BWcfcUXi.js → vendor-web3-CZJ1DcWo.js} +4 -4
- package/dist/assets/{web-TogH-A1y.js → web-CwxjKiW2.js} +1 -1
- package/dist/assets/{web-D_YOPR7Z.js → web-DEeVFGiX.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/Index-BCkGN8zE.css +0 -1
- package/dist/assets/Index-DZMphueF.js +0 -1
- package/dist/assets/Index-Ds2oO7k1.js +0 -1
- package/dist/assets/Index-LTWS2Usl.css +0 -1
- package/dist/assets/avatar-D84fE3q6.js +0 -1
- package/dist/assets/common-Cg7wDjqw.js +0 -1
- package/dist/assets/common-DFpFqR7d.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-L8lIAtWn.js";import{l as A,S as L,t as U,u as w,F as D,D as j,j as P,W as z,X as B,G as M,Y as O,K as q}from"./vendor-element-plus-B4FTqxj4.js";import{d as v,C as l,G as r,T as s,E as R,K as d,ai as o,D as a,R as i,Q as _,S as T,ag as I,J as S,M as V,c as F,O as $}from"./vendor-vue-1w_NBnjl.js";import{_ as b,aj as N,c3 as H,aB as K,ar as J,ax as Q,ay as E}from"./index-FyDryJF8.js";import{I as W,S as X}from"./ScrollList-DPLKBqBd.js";import{I as Y}from"./ImagePreview-DpdyaY-J.js";import{A as Z}from"./Status-UWszJlPM.js";import{C as x}from"./CopyToClipboard-CmHXEPMr.js";import{l as ee}from"./pagination-CihAE3FS.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-BWcfcUXi.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-Dj5bcX0v.js";const se=v({name:"LayoutHeadshots",components:{ElDrawer:L,ElButton:A,FontAwesomeIcon:C},data(){return{drawer:!1}}}),te={class:"main flex flex-row flex-1"},ae={class:"config w-[300px] h-full overflow-y-scroll bg-[var(--app-sidebar-bg)]"},oe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ne(e,t,m,h,k,y){const p=o("font-awesome-icon"),u=o("el-button"),n=o("el-drawer");return a(),l("div",te,[r("div",ae,[R(e.$slots,"config",{},void 0,!0)]),r("div",oe,[R(e.$slots,"result",{},void 0,!0)]),s(u,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:d(()=>[s(p,{icon:"fa-solid fa-gear"})]),_:1}),s(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),"with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=b(se,[["render",ne],["__scopeId","data-v-853c77bc"]]),le=v({name:"ImageUrlsInput",components:{ElUpload:U,ElButton:A,InfoIcon:W,ImagePreview:Y,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){w.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){w.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),re={class:"field"},ce={class:"title font-bold"},de={class:"upload-wrapper"};function pe(e,t,m,h,k,y){const p=o("image-preview"),u=o("font-awesome-icon"),n=o("el-button"),c=o("el-upload"),g=o("info-icon");return a(),l("div",re,[r("h2",ce,i(e.$t("headshots.name.endImageUrls")),1),r("div",de,[s(c,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:2,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:f})=>[s(p,{url:f.url||f.response?.file_url,name:f.name,percentage:f.percentage,onRemove:G=>e.fileList.splice(e.fileList.indexOf(f),1)},null,8,["url","name","percentage","onRemove"])]),default:d(()=>[s(n,{size:"small",type:"primary",round:""},{default:d(()=>[s(u,{icon:"fa-solid fa-upload",class:"mr-1"}),_(" "+i(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),s(g,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const me=b(le,[["render",pe],["__scopeId","data-v-1690629a"]]),he="fast",ue=v({name:"ModeSelector",components:{ElRadioButton:j,ElRadioGroup:D},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=he)}}),ge={class:"field"},fe={class:"title font-bold"};function _e(e,t,m,h,k,y){const p=o("el-radio-button"),u=o("el-radio-group");return a(),l("div",ge,[r("h2",fe,i(e.$t("headshots.name.mode")),1),s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),size:"small",class:"mode"},{default:d(()=>[(a(!0),l(T,null,I(e.options,n=>(a(),S(p,{key:n.value,label:n.value},{default:d(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const $e=b(ue,[["render",_e],["__scopeId","data-v-a2a0d5fa"]]),ve=v({name:"StylizeSelector",components:{ElTabs:B,ElTabPane:z,ElImage:P},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),be={class:"field"},ke=["onClick"],ye={class:"name"};function we(e,t,m,h,k,y){const p=o("el-image"),u=o("el-tab-pane"),n=o("el-tabs");return a(),l("div",be,[s(n,{modelValue:e.tab,"onUpdate:modelValue":t[0]||(t[0]=c=>e.tab=c)},{default:d(()=>[(a(!0),l(T,null,I(e.elements,(c,g)=>(a(),S(u,{key:g,label:c.displayName,name:g,class:"pane"},{default:d(()=>[(a(!0),l(T,null,I(c.items,(f,G)=>(a(),l("div",{key:G,class:V({item:!0,active:e.value===f.value}),onClick:_s=>e.onToggle(f.value)},[s(p,{src:f.image,fit:"fill",class:"preview"},null,8,["src"]),r("span",ye,i(f.label),1)],10,ke))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const Te=b(ve,[["render",we],["__scopeId","data-v-be4bd25d"]]),Ie=v({name:"PresetPanel",components:{ModeSelector:$e,ImageUrlsInput:me,ElButton:A,FontAwesomeIcon:C,ElementsSelector:Te},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Se={class:"panel"},Ve={class:"config"},Ee={class:"actions"};function Ce(e,t,m,h,k,y){const p=o("elements-selector"),u=o("mode-selector"),n=o("image-urls-input"),c=o("font-awesome-icon"),g=o("el-button");return a(),l("div",Se,[r("div",Ve,[s(p,{class:"mb-4"}),s(u,{class:"mb-4"}),s(n,{class:"mb-4"}),r("div",Ee,[s(g,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(c,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Re=b(Ie,[["render",Ce],["__scopeId","data-v-78172a54"]]),Ae=v({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:F(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ge={class:"image-gallery"},Pe=["src"],Le=["onClick"];function Ue(e,t,m,h,k,y){return a(),l("div",Ge,[(a(!0),l(T,null,I(e.images,(p,u)=>(a(),l("div",{key:u,class:"image-container"},[r("img",{src:p.image_url,alt:"Image"},null,8,Pe),p.image_url?(a(),l("button",{key:0,class:"view-button",onClick:n=>e.viewImage(p.image_url)},i(e.$t("headshots.button.viewImage")),9,Le)):$("",!0)]))),128))])}const De=b(Ae,[["render",Ue],["__scopeId","data-v-42f0a7be"]]),je=v({name:"TaskPreview",components:{ElImage:P,CopyToClipboard:x,FontAwesomeIcon:C,ElAlert:M,ImageGallery:De},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onReload(e){const t=e.target,m=new URL(t.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;t.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),ze={class:"preview"},Be={class:"left"},Me={class:"main"},Oe={class:"bot"},qe={class:"datetime"},Fe={class:"info"},Ne={key:0,class:"prompt mt-2"},He={key:0},Ke={key:1},Je={key:0,class:V({content:!0,failed:!0})},Qe={class:"image-wrapper"},We={class:"description"},Xe={key:1,class:V({content:!0})},Ye={class:"description"},Ze={class:"description"},xe={class:"description"},es={key:2,class:V({content:!0})},ss={class:"description"},ts={key:3,class:V({content:!0})},as={class:"description"};function os(e,t,m,h,k,y){const p=o("el-image"),u=o("image-gallery"),n=o("font-awesome-icon"),c=o("copy-to-clipboard"),g=o("el-alert");return a(),l("div",ze,[r("div",Be,[s(p,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),r("div",Me,[r("div",Oe,[_(i(e.$t("headshots.name.headshotsBot"))+" ",1),r("span",qe,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",Fe,[e.modelValue?.request?.template?(a(),l("p",Ne,[_(i(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?$("",!0):(a(),l("span",He," - ("+i(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(a(),l("span",Ke," - ("+i(e.$t("headshots.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(a(),l("div",Je,[r("div",Qe,[s(u,{"model-value":e.modelValue},null,8,["model-value"])]),s(g,{closable:!1,class:"mt-2 success"},{default:d(()=>[r("p",We,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(a(),l("div",Xe,[s(g,{closable:!1,class:"failure"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",Ye,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",Ze,[s(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),s(c,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),r("p",xe,[s(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("headshots.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),s(c,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?$("",!0):(a(),l("div",es,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",ss,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(a(),l("div",ts,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",as,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])])}const ns=b(je,[["render",os],["__scopeId","data-v-6787ed56"]]),is=v({name:"RecentPanel",components:{TaskPreview:ns,ElSkeleton:q,ElSkeletonItem:O,ScrollList:X},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ls={key:0,class:"tasks"},rs={class:"left"},cs={class:"main"},ds={key:1,class:"tasks"},ps={key:2,class:"description"};function ms(e,t,m,h,k,y){const p=o("el-skeleton-item"),u=o("el-skeleton"),n=o("task-preview"),c=o("scroll-list");return a(),S(c,{ref:"scrollList",class:"panel recent",loading:e.loading,onReachTop:t[0]||(t[0]=g=>e.$emit("reach-top"))},{default:d(()=>[e.tasks?.items===void 0?(a(),l("div",ls,[(a(),l(T,null,I(3,g=>r("div",{key:g,class:"task placeholder"},[r("div",rs,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",cs,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),l("div",ds,[(a(!0),l(T,null,I(e.tasks?.items,(g,f)=>(a(),S(n,{key:f,"model-value":g,class:"preview"},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(a(),l("p",ps,i(e.$t("headshots.message.noTasks")),1)):$("",!0)]),_:1},8,["loading"])}const hs=b(is,[["render",ms],["__scopeId","data-v-ffd55c16"]]),us="https://webhook.acedata.cloud/headshots",gs=v({name:"HeadshotsIndex",components:{ConfigPanel:Re,Layout:ie,ApplicationStatus:Z,RecentPanel:hs},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===E.Request||this.fetchingTasks},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===E.Request},needApply(){return this.$store.state.headshots.status.getApplications===E.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ee({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){J.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Q&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",t,"createdAtMin",m,"createdAtMax",h),this.fetchingTasks=!0;try{await this.$store.dispatch("headshots/getTasks",{limit:t,createdAtMin:m,createdAtMax:h})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){const e={...this.config,callback_url:us},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("headshots.message.startingTask")),H.generate(e,{token:t}).then(()=>{w.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===K?w.error(this.$t("headshots.message.usedUp")):w.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fs(e,t,m,h,k,y){const p=o("config-panel"),u=o("application-status"),n=o("recent-panel"),c=o("layout");return a(),S(c,null,{config:d(()=>[s(p,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:d(()=>[s(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:t[0]||(t[0]=g=>e.$store.dispatch("headshots/setApplication",g))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(n,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const As=b(gs,[["render",fs],["__scopeId","data-v-6cafffbd"]]);export{As as default};
|
|
1
|
+
import{F as C}from"./index.es-mIRAKQ1A.js";import{l as A,S as L,t as U,u as w,F as D,D as j,j as P,W as z,X as B,G as M,Y as O,K as q}from"./vendor-element-plus-B4FTqxj4.js";import{d as v,C as l,G as r,T as s,E as R,K as d,ai as o,D as a,R as i,Q as _,S as T,ag as I,J as S,M as V,c as F,O as $}from"./vendor-vue-1w_NBnjl.js";import{_ as b,aj as N,c3 as H,aB as K,ar as J,ax as Q,ay as E}from"./index-CCYW3AUY.js";import{I as W,S as X}from"./ScrollList-6wsUvcj6.js";import{I as Y}from"./ImagePreview--cM1y0-F.js";import{A as Z}from"./Status-CLz-FCw7.js";import{C as x}from"./CopyToClipboard-CEtp94k8.js";import{l as ee}from"./pagination-CihAE3FS.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-CZJ1DcWo.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-Dj5bcX0v.js";const se=v({name:"LayoutHeadshots",components:{ElDrawer:L,ElButton:A,FontAwesomeIcon:C},data(){return{drawer:!1}}}),te={class:"main flex flex-row flex-1"},ae={class:"config w-[300px] h-full overflow-y-scroll bg-[var(--app-sidebar-bg)]"},oe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ne(e,t,m,h,k,y){const p=o("font-awesome-icon"),u=o("el-button"),n=o("el-drawer");return a(),l("div",te,[r("div",ae,[R(e.$slots,"config",{},void 0,!0)]),r("div",oe,[R(e.$slots,"result",{},void 0,!0)]),s(u,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:d(()=>[s(p,{icon:"fa-solid fa-gear"})]),_:1}),s(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),"with-header":!1,size:"340px",class:"drawer"},{default:d(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=b(se,[["render",ne],["__scopeId","data-v-853c77bc"]]),le=v({name:"ImageUrlsInput",components:{ElUpload:U,ElButton:A,InfoIcon:W,ImagePreview:Y,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){w.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){w.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),re={class:"field"},ce={class:"title font-bold"},de={class:"upload-wrapper"};function pe(e,t,m,h,k,y){const p=o("image-preview"),u=o("font-awesome-icon"),n=o("el-button"),c=o("el-upload"),g=o("info-icon");return a(),l("div",re,[r("h2",ce,i(e.$t("headshots.name.endImageUrls")),1),r("div",de,[s(c,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:2,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:f})=>[s(p,{url:f.url||f.response?.file_url,name:f.name,percentage:f.percentage,onRemove:G=>e.fileList.splice(e.fileList.indexOf(f),1)},null,8,["url","name","percentage","onRemove"])]),default:d(()=>[s(n,{size:"small",type:"primary",round:""},{default:d(()=>[s(u,{icon:"fa-solid fa-upload",class:"mr-1"}),_(" "+i(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),s(g,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const me=b(le,[["render",pe],["__scopeId","data-v-1690629a"]]),he="fast",ue=v({name:"ModeSelector",components:{ElRadioButton:j,ElRadioGroup:D},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=he)}}),ge={class:"field"},fe={class:"title font-bold"};function _e(e,t,m,h,k,y){const p=o("el-radio-button"),u=o("el-radio-group");return a(),l("div",ge,[r("h2",fe,i(e.$t("headshots.name.mode")),1),s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),size:"small",class:"mode"},{default:d(()=>[(a(!0),l(T,null,I(e.options,n=>(a(),S(p,{key:n.value,label:n.value},{default:d(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const $e=b(ue,[["render",_e],["__scopeId","data-v-a2a0d5fa"]]),ve=v({name:"StylizeSelector",components:{ElTabs:B,ElTabPane:z,ElImage:P},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),be={class:"field"},ke=["onClick"],ye={class:"name"};function we(e,t,m,h,k,y){const p=o("el-image"),u=o("el-tab-pane"),n=o("el-tabs");return a(),l("div",be,[s(n,{modelValue:e.tab,"onUpdate:modelValue":t[0]||(t[0]=c=>e.tab=c)},{default:d(()=>[(a(!0),l(T,null,I(e.elements,(c,g)=>(a(),S(u,{key:g,label:c.displayName,name:g,class:"pane"},{default:d(()=>[(a(!0),l(T,null,I(c.items,(f,G)=>(a(),l("div",{key:G,class:V({item:!0,active:e.value===f.value}),onClick:_s=>e.onToggle(f.value)},[s(p,{src:f.image,fit:"fill",class:"preview"},null,8,["src"]),r("span",ye,i(f.label),1)],10,ke))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const Te=b(ve,[["render",we],["__scopeId","data-v-be4bd25d"]]),Ie=v({name:"PresetPanel",components:{ModeSelector:$e,ImageUrlsInput:me,ElButton:A,FontAwesomeIcon:C,ElementsSelector:Te},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Se={class:"panel"},Ve={class:"config"},Ee={class:"actions"};function Ce(e,t,m,h,k,y){const p=o("elements-selector"),u=o("mode-selector"),n=o("image-urls-input"),c=o("font-awesome-icon"),g=o("el-button");return a(),l("div",Se,[r("div",Ve,[s(p,{class:"mb-4"}),s(u,{class:"mb-4"}),s(n,{class:"mb-4"}),r("div",Ee,[s(g,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[s(c,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Re=b(Ie,[["render",Ce],["__scopeId","data-v-78172a54"]]),Ae=v({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:F(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ge={class:"image-gallery"},Pe=["src"],Le=["onClick"];function Ue(e,t,m,h,k,y){return a(),l("div",Ge,[(a(!0),l(T,null,I(e.images,(p,u)=>(a(),l("div",{key:u,class:"image-container"},[r("img",{src:p.image_url,alt:"Image"},null,8,Pe),p.image_url?(a(),l("button",{key:0,class:"view-button",onClick:n=>e.viewImage(p.image_url)},i(e.$t("headshots.button.viewImage")),9,Le)):$("",!0)]))),128))])}const De=b(Ae,[["render",Ue],["__scopeId","data-v-42f0a7be"]]),je=v({name:"TaskPreview",components:{ElImage:P,CopyToClipboard:x,FontAwesomeIcon:C,ElAlert:M,ImageGallery:De},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onReload(e){const t=e.target,m=new URL(t.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;t.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),ze={class:"preview"},Be={class:"left"},Me={class:"main"},Oe={class:"bot"},qe={class:"datetime"},Fe={class:"info"},Ne={key:0,class:"prompt mt-2"},He={key:0},Ke={key:1},Je={key:0,class:V({content:!0,failed:!0})},Qe={class:"image-wrapper"},We={class:"description"},Xe={key:1,class:V({content:!0})},Ye={class:"description"},Ze={class:"description"},xe={class:"description"},es={key:2,class:V({content:!0})},ss={class:"description"},ts={key:3,class:V({content:!0})},as={class:"description"};function os(e,t,m,h,k,y){const p=o("el-image"),u=o("image-gallery"),n=o("font-awesome-icon"),c=o("copy-to-clipboard"),g=o("el-alert");return a(),l("div",ze,[r("div",Be,[s(p,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),r("div",Me,[r("div",Oe,[_(i(e.$t("headshots.name.headshotsBot"))+" ",1),r("span",qe,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",Fe,[e.modelValue?.request?.template?(a(),l("p",Ne,[_(i(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?$("",!0):(a(),l("span",He," - ("+i(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(a(),l("span",Ke," - ("+i(e.$t("headshots.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(a(),l("div",Je,[r("div",Qe,[s(u,{"model-value":e.modelValue},null,8,["model-value"])]),s(g,{closable:!1,class:"mt-2 success"},{default:d(()=>[r("p",We,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(a(),l("div",Xe,[s(g,{closable:!1,class:"failure"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",Ye,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",Ze,[s(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),s(c,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),r("p",xe,[s(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("headshots.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),s(c,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?$("",!0):(a(),l("div",es,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",ss,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(a(),l("div",ts,[s(g,{closable:!1,class:"info"},{template:d(()=>[s(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("headshots.name.failure")),1)]),default:d(()=>[r("p",as,[s(n,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("headshots.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),s(c,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])])}const ns=b(je,[["render",os],["__scopeId","data-v-6787ed56"]]),is=v({name:"RecentPanel",components:{TaskPreview:ns,ElSkeleton:q,ElSkeletonItem:O,ScrollList:X},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ls={key:0,class:"tasks"},rs={class:"left"},cs={class:"main"},ds={key:1,class:"tasks"},ps={key:2,class:"description"};function ms(e,t,m,h,k,y){const p=o("el-skeleton-item"),u=o("el-skeleton"),n=o("task-preview"),c=o("scroll-list");return a(),S(c,{ref:"scrollList",class:"panel recent",loading:e.loading,onReachTop:t[0]||(t[0]=g=>e.$emit("reach-top"))},{default:d(()=>[e.tasks?.items===void 0?(a(),l("div",ls,[(a(),l(T,null,I(3,g=>r("div",{key:g,class:"task placeholder"},[r("div",rs,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",cs,[s(u,{animated:""},{template:d(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),l("div",ds,[(a(!0),l(T,null,I(e.tasks?.items,(g,f)=>(a(),S(n,{key:f,"model-value":g,class:"preview"},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(a(),l("p",ps,i(e.$t("headshots.message.noTasks")),1)):$("",!0)]),_:1},8,["loading"])}const hs=b(is,[["render",ms],["__scopeId","data-v-ffd55c16"]]),us="https://webhook.acedata.cloud/headshots",gs=v({name:"HeadshotsIndex",components:{ConfigPanel:Re,Layout:ie,ApplicationStatus:Z,RecentPanel:hs},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===E.Request||this.fetchingTasks},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===E.Request},needApply(){return this.$store.state.headshots.status.getApplications===E.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ee({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){J.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Q&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",t,"createdAtMin",m,"createdAtMax",h),this.fetchingTasks=!0;try{await this.$store.dispatch("headshots/getTasks",{limit:t,createdAtMin:m,createdAtMax:h})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){const e={...this.config,callback_url:us},t=this.credential?.token;if(!t){console.error("no token specified");return}w.info(this.$t("headshots.message.startingTask")),H.generate(e,{token:t}).then(()=>{w.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===K?w.error(this.$t("headshots.message.usedUp")):w.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fs(e,t,m,h,k,y){const p=o("config-panel"),u=o("application-status"),n=o("recent-panel"),c=o("layout");return a(),S(c,null,{config:d(()=>[s(p,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:d(()=>[s(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:t[0]||(t[0]=g=>e.$store.dispatch("headshots/setApplication",g))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(n,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const As=b(gs,[["render",fs],["__scopeId","data-v-6cafffbd"]]);export{As as default};
|