@acedatacloud/nexior 3.32.2 → 3.32.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-CGEKiu-Z.js → Auth-DYFA1Zzt.js} +1 -1
- package/dist/assets/{BotPlaceholder-DryhpfyI.js → BotPlaceholder-BJhJ0msN.js} +1 -1
- package/dist/assets/{Callback-DtvVEe4m.js → Callback-BNPpP1tB.js} +1 -1
- package/dist/assets/{Console-DWlB6py-.js → Console-DT0S3aVY.js} +1 -1
- package/dist/assets/{Conversation-Ct5n2GmN.js → Conversation-D5pRsQC3.js} +1 -1
- package/dist/assets/{CopyToClipboard-D1FwD7Ay.js → CopyToClipboard-BLbqw9nl.js} +1 -1
- package/dist/assets/{Detail-shClIebZ.css → Detail-CS_pI74b.css} +1 -1
- package/dist/assets/Detail-DseOq2S9.js +2 -0
- package/dist/assets/{EditArray-DaBF2vWk.js → EditArray-qHlQF7rP.js} +1 -1
- package/dist/assets/{Extra-EfdGVpDK.js → Extra-Dw2CrEZu.js} +1 -1
- package/dist/assets/{FilePreview-VFJ-XdCT.js → FilePreview-BjsX8WfW.js} +1 -1
- package/dist/assets/{History-BP4yRlfz.js → History-Bnd72qti.js} +1 -1
- package/dist/assets/{ImagePreview-DR_hrXkE.js → ImagePreview-D-H4d4jU.js} +1 -1
- package/dist/assets/{ImageWrapper-MeuTnPga.js → ImageWrapper-BRaL0q-A.js} +1 -1
- package/dist/assets/{Index-D08kqvUN.js → Index-7kHRJX1f.js} +1 -1
- package/dist/assets/{Index-DlDmvyyT.js → Index-B5Cj9iRW.js} +1 -1
- package/dist/assets/{Index-SCuA_jIE.js → Index-BzyzGFCk.js} +1 -1
- package/dist/assets/{Index-BXTrrxMx.js → Index-C3AYvYo0.js} +1 -1
- package/dist/assets/{Index-BfOpBSRn.js → Index-CKL7pA88.js} +1 -1
- package/dist/assets/{Index-CHZeRvTi.js → Index-CM2P7KVf.js} +1 -1
- package/dist/assets/{Index-DE2mD85S.js → Index-COqvi-TP.js} +1 -1
- package/dist/assets/{Index-eRqcMP25.js → Index-CVrpBoqE.js} +1 -1
- package/dist/assets/{Index-DzHqE2qx.js → Index-CfxkOk_2.js} +1 -1
- package/dist/assets/{Index-BazAhLwA.js → Index-CtGQ26YS.js} +1 -1
- package/dist/assets/{Index-s2ebLR20.js → Index-DLeWH4dR.js} +1 -1
- package/dist/assets/{Index-wpZJ_a8u.js → Index-DbrCdp2X.js} +1 -1
- package/dist/assets/{Index-C9Vq_plI.js → Index-DicdfjBU.js} +1 -1
- package/dist/assets/{Index-Dj4NZQMj.js → Index-DjrwHYI0.js} +1 -1
- package/dist/assets/{Index-BSvLdhfj.js → Index-DzvDLu21.js} +1 -1
- package/dist/assets/{Index-BqqJHpnH.js → Index-NGjnc38V.js} +1 -1
- package/dist/assets/{Index-BKd2bB-B.js → Index-XGOkY1zY.js} +1 -1
- package/dist/assets/{Index-C_6uySr1.js → Index-Yb45BxJz.js} +1 -1
- package/dist/assets/{Index-BkhzvHYz.js → Index-l7Xs56vt.js} +1 -1
- package/dist/assets/{Index-BHuxHDG6.js → Index-wP_Lyyil.js} +1 -1
- package/dist/assets/{Invitees-BKX54iCK.js → Invitees-Dn0E8qJC.js} +1 -1
- package/dist/assets/{List-Bqz6y2BW.js → List-BV_IzyX2.js} +1 -1
- package/dist/assets/{List-CwxtJavB.js → List-DzBdFw8I.js} +1 -1
- package/dist/assets/{List-B0jEPtRD.js → List-NozEP18m.js} +1 -1
- package/dist/assets/{Main-DwQecZzJ.js → Main-CD9T2N3l.js} +1 -1
- package/dist/assets/{Navigator-CwNZQUMg.css → Navigator-BFuQQRKd.css} +1 -1
- package/dist/assets/{Navigator-BKT2mxOy.js → Navigator-BNJXI3hc.js} +1 -1
- package/dist/assets/{NoTasks-BYsoXaVq.js → NoTasks-Cm0AqqsF.js} +1 -1
- package/dist/assets/{Pagination-C3DyJji5.js → Pagination-C47FX5oY.js} +1 -1
- package/dist/assets/{ScrollList-DHgQC1_v.js → ScrollList-DRWz9jW6.js} +1 -1
- package/dist/assets/{Status-HltKSvqh.js → Status-FhPzRnWL.js} +1 -1
- package/dist/assets/{Subscribe-CJ_hRiPV.js → Subscribe-21L-6Z4O.js} +1 -1
- package/dist/assets/{TransportWebHID-Y-VgY_nP.js → TransportWebHID-B_3EAMYS.js} +1 -1
- package/dist/assets/{VideoPlayer-D4wmigXn.js → VideoPlayer-C8wcdJbG.js} +1 -1
- package/dist/assets/avatar-BpcmM_BW.js +1 -0
- package/dist/assets/{avatar-CfYRMFXV.css → avatar-DIo0dZw4.css} +1 -1
- package/dist/assets/{bignumber-CPDvezU8.js → bignumber-ILNjViFu.js} +1 -1
- package/dist/assets/{distribution-CRcyt7eH.js → distribution-DmCB36oc.js} +1 -1
- package/dist/assets/{index-JvPlJRt4.js → index-8EKPvmnj.js} +1 -1
- package/dist/assets/index-BRGDNp-C.js +1 -0
- package/dist/assets/{index-BO0SEINI.js → index-BoGx3CmB.js} +1 -1
- package/dist/assets/{index-DD9XxBI7.js → index-CKKGs5h1.js} +1 -1
- package/dist/assets/{index-Bkear63z.css → index-Cbt_RUrY.css} +1 -1
- package/dist/assets/{index-Bo0zQxxu.js → index-CyO8tXO2.js} +1 -1
- package/dist/assets/{index-cYgcbC7L.js → index-D2TydFHF.js} +1 -1
- package/dist/assets/{index-_FPvQLSk.js → index-D9sJC6gW.js} +1 -1
- package/dist/assets/{index-BkuLNx2-.js → index-Eolh8-ZS.js} +4 -4
- package/dist/assets/{index.es-7RSklBi_.js → index.es-ByZsSMmo.js} +1 -1
- package/dist/assets/{order-DKWuqMWf.js → order-BCSpOmEp.js} +1 -1
- package/dist/assets/{price-Q1mTRsEK.js → price-B3IiQ6GV.js} +1 -1
- package/dist/assets/{solana-wallets-BB1etQkQ.js → solana-wallets-BlAPmkC0.js} +2 -2
- package/dist/assets/{solanaEmbed.esm-B3TXfg-6.js → solanaEmbed.esm-DMhNKlrp.js} +5 -5
- package/dist/assets/{string_decoder-sJVrg_-v.js → string_decoder-D3sR9f7y.js} +1 -1
- package/dist/assets/{vendor-web3-XrA95VRY.js → vendor-web3-DH4JU5BG.js} +251 -251
- package/dist/assets/{web-V68mHKbX.js → web-Bq9K0ccN.js} +1 -1
- package/dist/assets/{web-D9-VdGMd.js → web-DPMzAm_p.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/Detail-C4CjoEt1.js +0 -2
- package/dist/assets/avatar-DX-DNBWM.js +0 -1
- package/dist/assets/index-B7OQ5In8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-7RSklBi_.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-BkuLNx2-.js";import{I as W,S as X}from"./ScrollList-DHgQC1_v.js";import{I as Y}from"./ImagePreview-DR_hrXkE.js";import{A as Z}from"./Status-HltKSvqh.js";import{C as x}from"./CopyToClipboard-D1FwD7Ay.js";import{l as ee}from"./pagination-CihAE3FS.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-XrA95VRY.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-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},oe={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};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-202b355b"]]),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-848739f6"]]),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-d1196e0c"]]),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-ByZsSMmo.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-Eolh8-ZS.js";import{I as W,S as X}from"./ScrollList-DRWz9jW6.js";import{I as Y}from"./ImagePreview-D-H4d4jU.js";import{A as Z}from"./Status-FhPzRnWL.js";import{C as x}from"./CopyToClipboard-BLbqw9nl.js";import{l as ee}from"./pagination-CihAE3FS.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-DH4JU5BG.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-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},oe={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};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-202b355b"]]),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-848739f6"]]),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-d1196e0c"]]),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 +1 @@
|
|
|
1
|
-
import{F as L}from"./index.es-7RSklBi_.js";import{l as R,S as B,N as I,O as C,U as q,V as F,t as N,u as x,s as z,p as X,G as Q,j as Y}from"./vendor-element-plus-B4FTqxj4.js";import{d as _,C as r,G as l,T as o,E as P,K as d,ai as s,D as a,R as c,S as V,ag as S,J as w,M as T,Y as H,Q as k,O as y}from"./vendor-vue-1w_NBnjl.js";import{_ as h,bS as J,bT as K,bU as W,bV as Z,bW as ee,bX as te,aj as se,bY as oe,aB as ne,ay as D}from"./index-BkuLNx2-.js";import{I as A,S as ae}from"./ScrollList-DHgQC1_v.js";import{I as le}from"./ImagePreview-DR_hrXkE.js";import{C as ie,N as re}from"./NoTasks-BYsoXaVq.js";import{a as ce}from"./price-Q1mTRsEK.js";import{C as pe}from"./CopyToClipboard-D1FwD7Ay.js";import{V as de}from"./VideoPlayer-D4wmigXn.js";import{B as ue}from"./BotPlaceholder-DryhpfyI.js";import{l as me}from"./pagination-CihAE3FS.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-XrA95VRY.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-Dj5bcX0v.js";import"./vue-plyr-QZFBikSk.js";const ve=_({name:"LayoutPixverse",components:{ElDrawer:B,ElButton:R,FontAwesomeIcon:L},data(){return{drawer:!1}}}),fe={class:"main flex flex-row flex-1"},_e={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},he={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function $e(e,t,u,m,$,g){const i=s("font-awesome-icon"),p=s("el-button"),n=s("el-drawer");return a(),r("div",fe,[l("div",_e,[P(e.$slots,"config",{},void 0,!0)]),l("div",he,[P(e.$slots,"result",{},void 0,!0)]),o(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=f=>e.drawer=!0)},{default:d(()=>[o(i,{icon:"fa-solid fa-magic"})]),_:1}),o(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=f=>e.drawer=f),direction:"ltr","with-header":!1,size:"350px"},{default:d(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ge=h(ve,[["render",$e],["__scopeId","data-v-30cb83f9"]]),be=_({name:"ModelSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=J)}}),ye={class:"field"},ke={class:"title font-bold"};function we(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",ye,[l("h2",ke,c(e.$t("pixverse.name.model")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ve=h(be,[["render",we],["__scopeId","data-v-e8f337ca"]]),Se=_({name:"QualitySelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=K)}}),xe={class:"field"},Ee={class:"title font-bold"};function Te(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",xe,[l("h2",Ee,c(e.$t("pixverse.name.quality")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=h(Se,[["render",Te],["__scopeId","data-v-64aeaae9"]]),Ce=_({name:"MotionSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=W)}}),Le={class:"field"},Re={class:"title font-bold"};function Ue(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",Le,[l("h2",Re,c(e.$t("pixverse.name.motion")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Pe=h(Ce,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=_({name:"StyleSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=Z)}}),De={class:"field"},Ge={class:"title font-bold"};function je(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",De,[l("h2",Ge,c(e.$t("pixverse.name.style")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Me=h(Ae,[["render",je],["__scopeId","data-v-64e17b3c"]]),Oe=_({name:"SeedSelector",components:{ElSlider:F,InfoIcon:A,ElInputNumber:q},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Be={class:"flex justify-between"},qe={class:"flex justify-start items-center"},Fe={class:"text-sm font-bold"},Ne={class:"flex justify-end items-center"},ze={class:"w-full"};function Xe(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input-number"),n=s("el-slider");return a(),r("div",null,[l("div",Be,[l("div",qe,[l("span",Fe,c(e.$t("pixverse.name.seed")),1),o(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",Ne,[o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ze,[o(n,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=f=>e.value=f),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Qe=h(Oe,[["render",Xe]]),Ye=_({name:"DurationSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=ee)}}),He={class:"field"},Je={class:"title font-bold"};function Ke(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",He,[l("h2",Je,c(e.$t("pixverse.name.duration")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const We=h(Ye,[["render",Ke],["__scopeId","data-v-065c77ef"]]),Ze=_({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=te)}}),et={class:"text-sm font-bold mb-2 block"},tt={class:"items"},st=["onClick"],ot={class:"name"};function nt(e,t,u,m,$,g){return a(),r("div",null,[l("span",et,c(e.$t("pixverse.name.aspectRatio")),1),l("div",tt,[(a(!0),r(V,null,S(e.options,(i,p)=>(a(),r("div",{key:p,class:T({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:T(["preview",i.label])},[l("div",{class:"rect",style:H({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",ot,c(i.label),1)],10,st))),128))])])}const at=h(Ze,[["render",nt],["__scopeId","data-v-24b0db3d"]]),lt=_({name:"StartImage",components:{ElUpload:N,ElButton:R,InfoIcon:A,FontAwesomeIcon:L,ImagePreview:le},emits:["change"],data(){return{fileList:[],uploadUrl:se()+"/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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){x.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){x.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),it={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function dt(e,t,u,m,$,g){const i=s("info-icon"),p=s("image-preview"),n=s("font-awesome-icon"),f=s("el-button"),b=s("el-upload");return a(),r("div",it,[l("div",rt,[l("div",ct,[l("span",pt,c(e.$t("pixverse.name.startImage")),1),o(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:v})=>[v.url&&v.percentage!==void 0?(a(),w(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:d(()=>[o(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[o(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ut=h(lt,[["render",dt],["__scopeId","data-v-666104e4"]]),mt="",vt=_({name:"PromptInput",components:{ElInput:z,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},ht={class:"title font-bold"};function $t(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input");return a(),r("div",ft,[l("div",_t,[l("h2",ht,c(e.$t("pixverse.name.prompt")),1),o(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),o(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const gt=h(vt,[["render",$t],["__scopeId","data-v-2f675ca4"]]),bt=_({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:L,PromptInput:gt,ModelSelector:Ve,QualitySelector:Ie,MotionSelector:Pe,StyleSelector:Me,DurationSelector:We,StartImage:ut,SeedSelector:Qe,RatioSelector:at,Consumption:ie},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ce(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),yt={class:"flex flex-col h-full"},kt={class:"flex-1 overflow-y-auto p-5"},wt={class:"flex flex-col items-center justify-center px-5 pb-5"};function Vt(e,t,u,m,$,g){const i=s("prompt-input"),p=s("model-selector"),n=s("style-selector"),f=s("ratio-selector"),b=s("motion-selector"),v=s("quality-selector"),E=s("start-image"),U=s("seed-selector"),G=s("duration-selector"),j=s("consumption"),M=s("font-awesome-icon"),O=s("el-button");return a(),r("div",yt,[l("div",kt,[o(i,{class:"mb-4"}),o(p,{class:"mb-4"}),o(n,{class:"mb-4"}),o(f,{class:"mb-4"}),o(b,{class:"mb-4"}),o(v,{class:"mb-4"}),o(E,{class:"mb-2"}),o(U,{class:"mb-4"}),o(G,{class:"mb-4"})]),l("div",wt,[o(j,{value:e.consumption,service:e.service},null,8,["value","service"]),o(O,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[o(M,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const St=h(bt,[["render",Vt]]),xt=_({name:"TaskPreview",components:{ElImage:Y,CopyToClipboard:pe,FontAwesomeIcon:L,ElAlert:Q,VideoPlayer:de,ElTooltip:X,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Et={class:"preview"},Tt={class:"left"},It={class:"main"},Ct={class:"bot"},Lt={class:"datetime"},Rt={class:"info"},Ut={key:0,class:"prompt mt-2"},Pt={key:0},At={key:1},Dt={key:0,class:T({content:!0,failed:!0})},Gt={key:0,class:"mb-4"},jt={key:1,class:T({operations:!0,"mt-2":!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:T({content:!0})},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function zt(e,t,u,m,$,g){const i=s("el-image"),p=s("video-player"),n=s("el-button"),f=s("el-tooltip"),b=s("font-awesome-icon"),v=s("copy-to-clipboard"),E=s("el-alert");return a(),r("div",Et,[l("div",Tt,[o(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",It,[l("div",Ct,[k(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Lt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Rt,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[k(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Pt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Dt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Gt,[o(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",jt,[o(f,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:d(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),w(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=U=>e.onDownload(U,e.modelValue?.response?.data[0]?.video_url))},{default:d(()=>[k(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),o(E,{closable:!1,class:"mt-2 success"},{default:d(()=>[l("p",Mt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",Ot,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Bt,[o(E,{closable:!1,class:"info"},{template:d(()=>[o(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failure")),1)]),default:d(()=>[l("p",qt,[o(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),o(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",Ft,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",Nt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),o(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const Xt=h(xt,[["render",zt],["__scopeId","data-v-c2ee4e73"]]),Qt=_({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:re,BotPlaceholder:ue,ScrollList:ae},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Yt={key:0},Ht={key:2,class:"w-full h-full flex items-center justify-center"};function Jt(e,t,u,m,$,g){const i=s("bot-placeholder"),p=s("task-preview"),n=s("scroll-list"),f=s("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Yt,[o(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),w(n,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=b=>e.$emit("reach-top"))},{default:d(()=>[(a(!0),r(V,null,S(e.tasks?.items,(b,v)=>(a(),w(p,{key:v,"model-value":b},null,8,["model-value"]))),128))]),_:1},8,["loading"])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Ht,[o(f)])):y("",!0)],64)}const Kt=h(Qt,[["render",Jt]]),Wt="https://webhook.acedata.cloud/pixverse",Zt=_({name:"PixverseIndex",components:{ConfigPanel:St,Layout:ge,RecentPanel:Kt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===D.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===D.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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 me({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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},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:u,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("pixverse/getTasks",{limit:t,createdAtMin:u,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:Wt},t=this.credential?.token;if(!t){console.error("no token specified");return}x.info(this.$t("pixverse.message.startingTask")),oe.generate(e,{token:t}).then(()=>{x.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===ne?x.error(this.$t("pixverse.message.usedUp")):x.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function es(e,t,u,m,$,g){const i=s("config-panel"),p=s("recent-panel"),n=s("layout");return a(),w(n,null,{config:d(()=>[o(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:d(()=>[o(p,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const $s=h(Zt,[["render",es]]);export{$s as default};
|
|
1
|
+
import{F as L}from"./index.es-ByZsSMmo.js";import{l as R,S as B,N as I,O as C,U as q,V as F,t as N,u as x,s as z,p as X,G as Q,j as Y}from"./vendor-element-plus-B4FTqxj4.js";import{d as _,C as r,G as l,T as o,E as P,K as d,ai as s,D as a,R as c,S as V,ag as S,J as w,M as T,Y as H,Q as k,O as y}from"./vendor-vue-1w_NBnjl.js";import{_ as h,bS as J,bT as K,bU as W,bV as Z,bW as ee,bX as te,aj as se,bY as oe,aB as ne,ay as D}from"./index-Eolh8-ZS.js";import{I as A,S as ae}from"./ScrollList-DRWz9jW6.js";import{I as le}from"./ImagePreview-D-H4d4jU.js";import{C as ie,N as re}from"./NoTasks-Cm0AqqsF.js";import{a as ce}from"./price-B3IiQ6GV.js";import{C as pe}from"./CopyToClipboard-BLbqw9nl.js";import{V as de}from"./VideoPlayer-C8wcdJbG.js";import{B as ue}from"./BotPlaceholder-BJhJ0msN.js";import{l as me}from"./pagination-CihAE3FS.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-DH4JU5BG.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-Dj5bcX0v.js";import"./vue-plyr-QZFBikSk.js";const ve=_({name:"LayoutPixverse",components:{ElDrawer:B,ElButton:R,FontAwesomeIcon:L},data(){return{drawer:!1}}}),fe={class:"main flex flex-row flex-1"},_e={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},he={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function $e(e,t,u,m,$,g){const i=s("font-awesome-icon"),p=s("el-button"),n=s("el-drawer");return a(),r("div",fe,[l("div",_e,[P(e.$slots,"config",{},void 0,!0)]),l("div",he,[P(e.$slots,"result",{},void 0,!0)]),o(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=f=>e.drawer=!0)},{default:d(()=>[o(i,{icon:"fa-solid fa-magic"})]),_:1}),o(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=f=>e.drawer=f),direction:"ltr","with-header":!1,size:"350px"},{default:d(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ge=h(ve,[["render",$e],["__scopeId","data-v-30cb83f9"]]),be=_({name:"ModelSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=J)}}),ye={class:"field"},ke={class:"title font-bold"};function we(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",ye,[l("h2",ke,c(e.$t("pixverse.name.model")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ve=h(be,[["render",we],["__scopeId","data-v-e8f337ca"]]),Se=_({name:"QualitySelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=K)}}),xe={class:"field"},Ee={class:"title font-bold"};function Te(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",xe,[l("h2",Ee,c(e.$t("pixverse.name.quality")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=h(Se,[["render",Te],["__scopeId","data-v-64aeaae9"]]),Ce=_({name:"MotionSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=W)}}),Le={class:"field"},Re={class:"title font-bold"};function Ue(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",Le,[l("h2",Re,c(e.$t("pixverse.name.motion")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Pe=h(Ce,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=_({name:"StyleSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=Z)}}),De={class:"field"},Ge={class:"title font-bold"};function je(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",De,[l("h2",Ge,c(e.$t("pixverse.name.style")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Me=h(Ae,[["render",je],["__scopeId","data-v-64e17b3c"]]),Oe=_({name:"SeedSelector",components:{ElSlider:F,InfoIcon:A,ElInputNumber:q},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Be={class:"flex justify-between"},qe={class:"flex justify-start items-center"},Fe={class:"text-sm font-bold"},Ne={class:"flex justify-end items-center"},ze={class:"w-full"};function Xe(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input-number"),n=s("el-slider");return a(),r("div",null,[l("div",Be,[l("div",qe,[l("span",Fe,c(e.$t("pixverse.name.seed")),1),o(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",Ne,[o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ze,[o(n,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=f=>e.value=f),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Qe=h(Oe,[["render",Xe]]),Ye=_({name:"DurationSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=ee)}}),He={class:"field"},Je={class:"title font-bold"};function Ke(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",He,[l("h2",Je,c(e.$t("pixverse.name.duration")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const We=h(Ye,[["render",Ke],["__scopeId","data-v-065c77ef"]]),Ze=_({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=te)}}),et={class:"text-sm font-bold mb-2 block"},tt={class:"items"},st=["onClick"],ot={class:"name"};function nt(e,t,u,m,$,g){return a(),r("div",null,[l("span",et,c(e.$t("pixverse.name.aspectRatio")),1),l("div",tt,[(a(!0),r(V,null,S(e.options,(i,p)=>(a(),r("div",{key:p,class:T({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:T(["preview",i.label])},[l("div",{class:"rect",style:H({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",ot,c(i.label),1)],10,st))),128))])])}const at=h(Ze,[["render",nt],["__scopeId","data-v-24b0db3d"]]),lt=_({name:"StartImage",components:{ElUpload:N,ElButton:R,InfoIcon:A,FontAwesomeIcon:L,ImagePreview:le},emits:["change"],data(){return{fileList:[],uploadUrl:se()+"/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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){x.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){x.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),it={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function dt(e,t,u,m,$,g){const i=s("info-icon"),p=s("image-preview"),n=s("font-awesome-icon"),f=s("el-button"),b=s("el-upload");return a(),r("div",it,[l("div",rt,[l("div",ct,[l("span",pt,c(e.$t("pixverse.name.startImage")),1),o(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:v})=>[v.url&&v.percentage!==void 0?(a(),w(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:d(()=>[o(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[o(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ut=h(lt,[["render",dt],["__scopeId","data-v-666104e4"]]),mt="",vt=_({name:"PromptInput",components:{ElInput:z,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},ht={class:"title font-bold"};function $t(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input");return a(),r("div",ft,[l("div",_t,[l("h2",ht,c(e.$t("pixverse.name.prompt")),1),o(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),o(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const gt=h(vt,[["render",$t],["__scopeId","data-v-2f675ca4"]]),bt=_({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:L,PromptInput:gt,ModelSelector:Ve,QualitySelector:Ie,MotionSelector:Pe,StyleSelector:Me,DurationSelector:We,StartImage:ut,SeedSelector:Qe,RatioSelector:at,Consumption:ie},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ce(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),yt={class:"flex flex-col h-full"},kt={class:"flex-1 overflow-y-auto p-5"},wt={class:"flex flex-col items-center justify-center px-5 pb-5"};function Vt(e,t,u,m,$,g){const i=s("prompt-input"),p=s("model-selector"),n=s("style-selector"),f=s("ratio-selector"),b=s("motion-selector"),v=s("quality-selector"),E=s("start-image"),U=s("seed-selector"),G=s("duration-selector"),j=s("consumption"),M=s("font-awesome-icon"),O=s("el-button");return a(),r("div",yt,[l("div",kt,[o(i,{class:"mb-4"}),o(p,{class:"mb-4"}),o(n,{class:"mb-4"}),o(f,{class:"mb-4"}),o(b,{class:"mb-4"}),o(v,{class:"mb-4"}),o(E,{class:"mb-2"}),o(U,{class:"mb-4"}),o(G,{class:"mb-4"})]),l("div",wt,[o(j,{value:e.consumption,service:e.service},null,8,["value","service"]),o(O,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[o(M,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const St=h(bt,[["render",Vt]]),xt=_({name:"TaskPreview",components:{ElImage:Y,CopyToClipboard:pe,FontAwesomeIcon:L,ElAlert:Q,VideoPlayer:de,ElTooltip:X,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Et={class:"preview"},Tt={class:"left"},It={class:"main"},Ct={class:"bot"},Lt={class:"datetime"},Rt={class:"info"},Ut={key:0,class:"prompt mt-2"},Pt={key:0},At={key:1},Dt={key:0,class:T({content:!0,failed:!0})},Gt={key:0,class:"mb-4"},jt={key:1,class:T({operations:!0,"mt-2":!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:T({content:!0})},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function zt(e,t,u,m,$,g){const i=s("el-image"),p=s("video-player"),n=s("el-button"),f=s("el-tooltip"),b=s("font-awesome-icon"),v=s("copy-to-clipboard"),E=s("el-alert");return a(),r("div",Et,[l("div",Tt,[o(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",It,[l("div",Ct,[k(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Lt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Rt,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[k(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Pt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Dt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Gt,[o(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",jt,[o(f,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:d(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),w(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=U=>e.onDownload(U,e.modelValue?.response?.data[0]?.video_url))},{default:d(()=>[k(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),o(E,{closable:!1,class:"mt-2 success"},{default:d(()=>[l("p",Mt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",Ot,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Bt,[o(E,{closable:!1,class:"info"},{template:d(()=>[o(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failure")),1)]),default:d(()=>[l("p",qt,[o(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),o(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",Ft,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",Nt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),o(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const Xt=h(xt,[["render",zt],["__scopeId","data-v-c2ee4e73"]]),Qt=_({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:re,BotPlaceholder:ue,ScrollList:ae},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Yt={key:0},Ht={key:2,class:"w-full h-full flex items-center justify-center"};function Jt(e,t,u,m,$,g){const i=s("bot-placeholder"),p=s("task-preview"),n=s("scroll-list"),f=s("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Yt,[o(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),w(n,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=b=>e.$emit("reach-top"))},{default:d(()=>[(a(!0),r(V,null,S(e.tasks?.items,(b,v)=>(a(),w(p,{key:v,"model-value":b},null,8,["model-value"]))),128))]),_:1},8,["loading"])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Ht,[o(f)])):y("",!0)],64)}const Kt=h(Qt,[["render",Jt]]),Wt="https://webhook.acedata.cloud/pixverse",Zt=_({name:"PixverseIndex",components:{ConfigPanel:St,Layout:ge,RecentPanel:Kt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===D.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===D.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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 me({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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},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:u,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("pixverse/getTasks",{limit:t,createdAtMin:u,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:Wt},t=this.credential?.token;if(!t){console.error("no token specified");return}x.info(this.$t("pixverse.message.startingTask")),oe.generate(e,{token:t}).then(()=>{x.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===ne?x.error(this.$t("pixverse.message.usedUp")):x.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function es(e,t,u,m,$,g){const i=s("config-panel"),p=s("recent-panel"),n=s("layout");return a(),w(n,null,{config:d(()=>[o(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:d(()=>[o(p,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const $s=h(Zt,[["render",es]]);export{$s as default};
|