@acedatacloud/nexior 3.19.0 → 3.19.2
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-Bw1DOhJF.js → Auth-C-IuIG-B.js} +1 -1
- package/dist/assets/{BotPlaceholder-C_vy0qCQ.js → BotPlaceholder-BWFhmlAo.js} +1 -1
- package/dist/assets/{Callback-Cqk0rKBN.js → Callback-EUksYGmT.js} +1 -1
- package/dist/assets/{Console-qoC957to.js → Console-CCoikoR8.js} +1 -1
- package/dist/assets/{Conversation-MQNI8qlX.css → Conversation-CjRJo_oi.css} +1 -1
- package/dist/assets/{Conversation-uMvDRIJR.js → Conversation-D5F7bNRk.js} +3 -3
- package/dist/assets/{CopyToClipboard-CU-Bssp8.js → CopyToClipboard-BCGRlwJJ.js} +1 -1
- package/dist/assets/{Detail-cO4DPSNq.js → Detail-Dpi6TrM0.js} +1 -1
- package/dist/assets/{EditArray-C43_QVaw.js → EditArray-CNffMlZs.js} +1 -1
- package/dist/assets/{Extra-PdVV78Il.js → Extra-DO4acRM1.js} +1 -1
- package/dist/assets/{FilePreview-9n711Ra6.js → FilePreview-fVU_bWwG.js} +1 -1
- package/dist/assets/{History-B0qXtfS_.js → History-C9FxNW-l.js} +1 -1
- package/dist/assets/{ImagePreview-D6FjLfQO.js → ImagePreview-TA4gKfP6.js} +1 -1
- package/dist/assets/{ImageWrapper-DzYTbbFD.js → ImageWrapper-DiWDwTYN.js} +1 -1
- package/dist/assets/{Index-s-n_Jcpk.js → Index-B1xNRnzS.js} +1 -1
- package/dist/assets/{Index-B_5LccCK.js → Index-Bd8eGbDS.js} +1 -1
- package/dist/assets/{Index-DR--TL10.js → Index-BkOh3bne.js} +1 -1
- package/dist/assets/{Index-C5_lGkBZ.js → Index-BnFlUjW_.js} +1 -1
- package/dist/assets/{Index-CCxY1jnd.js → Index-Bx68JxDv.js} +1 -1
- package/dist/assets/{Index-C19C6xgu.js → Index-CDiKWMtk.js} +1 -1
- package/dist/assets/{Index-CLGNbukd.js → Index-CLLP-0_j.js} +1 -1
- package/dist/assets/{Index-C7Ncg6Qj.js → Index-CYZH4K_O.js} +1 -1
- package/dist/assets/{Index-C2_2zuSy.js → Index-CiCrJcLB.js} +1 -1
- package/dist/assets/{Index-Cg05F_5Q.js → Index-CmPTK3LL.js} +1 -1
- package/dist/assets/{Index-Bvgj_uOE.js → Index-D1NzhXpH.js} +1 -1
- package/dist/assets/{Index-Cs62YC8R.js → Index-D2We28NW.js} +1 -1
- package/dist/assets/{Index-tiwIgnaL.js → Index-DXMsU8Cz.js} +1 -1
- package/dist/assets/{Index-3q0rHE7m.js → Index-DclWXX-T.js} +1 -1
- package/dist/assets/{Index-PESGbhdr.js → Index-qn1KRXz8.js} +1 -1
- package/dist/assets/{InfoIcon-YhCcbV8z.js → InfoIcon-BJAJcb5a.js} +1 -1
- package/dist/assets/{Invitees-C2K1S9qq.js → Invitees-BPgw8JIs.js} +1 -1
- package/dist/assets/{List-jjkNRvFz.js → List-BAZxY2QY.js} +1 -1
- package/dist/assets/{List-DKz9i_BC.js → List-BRdMCfwC.js} +1 -1
- package/dist/assets/{List-DL89ylII.js → List-BdH_9_rT.js} +1 -1
- package/dist/assets/{Login-B2vP1VD7.js → Login-nlVKPBYj.js} +1 -1
- package/dist/assets/{Main-5-DxlbAw.js → Main-BFjhKPUF.js} +1 -1
- package/dist/assets/{Navigator-Dj-FFsqC.js → Navigator-BEzvNdn6.js} +1 -1
- package/dist/assets/{NoTasks-ex5PKih3.js → NoTasks-oiStcbHf.js} +1 -1
- package/dist/assets/{Pagination-DeEC_sGQ.js → Pagination-1fwMfKLT.js} +1 -1
- package/dist/assets/{Status-BmL-zn_q.js → Status-kXBbvBuV.js} +1 -1
- package/dist/assets/{Subscribe-BH-RryJn.js → Subscribe-pO6AF-vC.js} +1 -1
- package/dist/assets/{VideoPlayer-C0am2_1Y.js → VideoPlayer-CYaGmv09.js} +1 -1
- package/dist/assets/{_baseClone-BDmNDGGK.js → _baseClone-kJ5Pgx6e.js} +1 -1
- package/dist/assets/{_baseIteratee-LczmVVcS.js → _baseIteratee-35aC5hBk.js} +1 -1
- package/dist/assets/{_initCloneObject-CJq550xS.js → _initCloneObject-djD3gYlF.js} +1 -1
- package/dist/assets/{castArray-pZCaAVDW.js → castArray-TlECDAqv.js} +1 -1
- package/dist/assets/{debounce-Bzi7Cd91.js → debounce-DTzFlSYq.js} +1 -1
- package/dist/assets/{distribution-BcejgPw4.js → distribution-BNAm6hj-.js} +1 -1
- package/dist/assets/{dropdown-BG6nYAE4.js → dropdown-zSfjtIjT.js} +1 -1
- package/dist/assets/{index-DyxxJgEB.js → index-B7ak1Sj_.js} +1 -1
- package/dist/assets/{index-DiDFukvb.js → index-B85SWIvk.js} +1 -1
- package/dist/assets/{index-bImFSswd.js → index-BR0vba1Y.js} +1 -1
- package/dist/assets/{index-kbbIEoS7.js → index-BV4o_bfz.js} +1 -1
- package/dist/assets/{index-XAOdMJRW.js → index-Bgk8tZFf.js} +1 -1
- package/dist/assets/{index-H7zk7enZ.js → index-BqAthpig.js} +1 -1
- package/dist/assets/{index-BgQ-O6aa.js → index-BqzuTEwO.js} +1 -1
- package/dist/assets/{index-I4cHhAfY.js → index-Bth-8JIu.js} +1 -1
- package/dist/assets/{index-CNg43fsi.js → index-BzyEWvnL.js} +1 -1
- package/dist/assets/{index-DkUww0O6.js → index-C3GYDBc-.js} +1 -1
- package/dist/assets/{index-DTe9fRn-.js → index-C4ssJdBR.js} +2 -2
- package/dist/assets/{index-DCYB3TDh.js → index-C4trafQk.js} +1 -1
- package/dist/assets/{index-DjlWqdX5.js → index-CCjGuukj.js} +1 -1
- package/dist/assets/{index-0ZIggTSP.js → index-CPE0C_s4.js} +1 -1
- package/dist/assets/{index-DPoEMPUV.js → index-CP_56dlf.js} +1 -1
- package/dist/assets/{index-C5k9PNqL.js → index-CqTGsJay.js} +1 -1
- package/dist/assets/{index-CDCMsrCt.js → index-CzVzQVmI.js} +1 -1
- package/dist/assets/{index-DLyu6NQP.js → index-DEAamx_H.js} +1 -1
- package/dist/assets/{index-CuoHzlXN.js → index-DIwFcazb.js} +1 -1
- package/dist/assets/{index-CJ3Mnfei.css → index-DUrKxJFe.css} +1 -1
- package/dist/assets/{index-isAF6YJy.js → index-DislasB7.js} +1 -1
- package/dist/assets/{index-DkpfqXBZ.js → index-DpSdtysU.js} +1 -1
- package/dist/assets/{index-P6nOuLhh.js → index-DqySUAY6.js} +1 -1
- package/dist/assets/{index-DvXCzKR2.js → index-Drn8vYFB.js} +1 -1
- package/dist/assets/{index-DaEk4vUe.js → index-J4WBpiv9.js} +1 -1
- package/dist/assets/{index-DxTeNsnH.js → index-gFYmOD1F.js} +1 -1
- package/dist/assets/{index-N-T3RtWX.js → index-qJunmjSC.js} +1 -1
- package/dist/assets/{index-CdMzZF3s.js → index-tOFv-Cd9.js} +1 -1
- package/dist/assets/{index-Bp0DDosh.js → index-tdgIYwZh.js} +1 -1
- package/dist/assets/{index-MMWJF36O.js → index-zBoOr1pW.js} +1 -1
- package/dist/assets/{index.es-CJbKM0CV.js → index.es-EtbmiVQe.js} +1 -1
- package/dist/assets/{isEqual-CH8EZj5t.js → isEqual-BqBcCRrU.js} +1 -1
- package/dist/assets/{isPlainObject-zVqjHzMk.js → isPlainObject-BLPi94hV.js} +1 -1
- package/dist/assets/{order-DNAFc_Ok.js → order-BLvyPp28.js} +1 -1
- package/dist/assets/{price-C04dX6gR.js → price-DPmHeT6D.js} +1 -1
- package/dist/assets/{strings-CNF1iAZ6.js → strings-cAoZbHaH.js} +1 -1
- package/dist/assets/{typescript-BioIzq79.js → typescript-D14l1a1y.js} +1 -1
- package/dist/assets/{use-form-item-CtZlpzU6.js → use-form-item-CGJaz8fH.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-CJbKM0CV.js";import{E as T}from"./index-C5k9PNqL.js";import{E as q}from"./index-CNg43fsi.js";import{d as v,h as k,b as r,t as a,k as t,r as G,j as u,l as o,o as n,et as K,x as i,F as I,v as L,i as y,eu as H,ev as J,ew as Q,n as S,f as W,c7 as M,D as _,y as $,ex as X,ey as Y,ds as Z,dn as x}from"./index-DTe9fRn-.js";import{E as R,a as P}from"./index-DCYB3TDh.js";import{I as U}from"./InfoIcon-YhCcbV8z.js";import{I as N}from"./ImagePreview-D6FjLfQO.js";import{E as F}from"./index-DxTeNsnH.js";import{E as V}from"./index-H7zk7enZ.js";import{C as ee,N as te}from"./NoTasks-ex5PKih3.js";import{E as oe,a as se}from"./index-CuoHzlXN.js";import{E as O}from"./index-I4cHhAfY.js";import{a as ne}from"./price-C04dX6gR.js";import{C as le}from"./CopyToClipboard-CU-Bssp8.js";import{V as ae}from"./VideoPlayer-C0am2_1Y.js";import{E as ie}from"./index-DjlWqdX5.js";import{E as re}from"./index-N-T3RtWX.js";import{E as ce}from"./index-Bp0DDosh.js";import{B as de}from"./BotPlaceholder-C_vy0qCQ.js";import"./use-form-item-CtZlpzU6.js";import"./index-r5W6hzzQ.js";import"./index-DLyu6NQP.js";import"./typescript-BioIzq79.js";import"./index-DaEk4vUe.js";import"./strings-CNF1iAZ6.js";import"./castArray-pZCaAVDW.js";import"./isEqual-CH8EZj5t.js";import"./_initCloneObject-CJq550xS.js";import"./debounce-Bzi7Cd91.js";import"./_baseIteratee-LczmVVcS.js";import"./index-BgQ-O6aa.js";import"./index-DPoEMPUV.js";import"./_baseClone-BDmNDGGK.js";import"./index-MMWJF36O.js";import"./vue-plyr-QZFBikSk.js";import"./index-DyxxJgEB.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),r("div",ue,[a("div",me,[G(e.$slots,"config",{},void 0,!0)]),a("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-fae64b48"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[a("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[a("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[a("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,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?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[a("span",Ge,i(e.$t("kling.name.ratio")),1),a("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:l=>e.value=c.value},[a("div",{class:S(["preview",c.label])},[a("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),a("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[a("div",Oe,[a("div",Be,[a("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),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:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[a("div",Qe,[a("div",We,[a("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),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:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function lt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),r("div",null,[a("div",et,[a("div",tt,[a("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),a("div",nt,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const at=k(xe,[["render",lt]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[a("div",dt,[a("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[a("div",ht,[a("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:at,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[a("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),a("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:ae,ElTooltip:ie,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={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:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),l=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[a("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Lt,[a("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),a("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),l=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(l)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function lo(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const zo=k(no,[["render",lo]]);export{zo as default};
|
|
1
|
+
import{F as C}from"./index.es-EtbmiVQe.js";import{E as T}from"./index-CqTGsJay.js";import{E as q}from"./index-BzyEWvnL.js";import{d as v,h as k,b as r,t as a,k as t,r as G,j as u,l as o,o as n,et as K,x as i,F as I,v as L,i as y,eu as H,ev as J,ew as Q,n as S,f as W,c7 as M,D as _,y as $,ex as X,ey as Y,ds as Z,dn as x}from"./index-C4ssJdBR.js";import{E as R,a as P}from"./index-C4trafQk.js";import{I as U}from"./InfoIcon-BJAJcb5a.js";import{I as N}from"./ImagePreview-TA4gKfP6.js";import{E as F}from"./index-gFYmOD1F.js";import{E as V}from"./index-BqAthpig.js";import{C as ee,N as te}from"./NoTasks-oiStcbHf.js";import{E as oe,a as se}from"./index-DIwFcazb.js";import{E as O}from"./index-Bth-8JIu.js";import{a as ne}from"./price-DPmHeT6D.js";import{C as le}from"./CopyToClipboard-BCGRlwJJ.js";import{V as ae}from"./VideoPlayer-CYaGmv09.js";import{E as ie}from"./index-CCjGuukj.js";import{E as re}from"./index-qJunmjSC.js";import{E as ce}from"./index-tdgIYwZh.js";import{B as de}from"./BotPlaceholder-BWFhmlAo.js";import"./use-form-item-CGJaz8fH.js";import"./index-r5W6hzzQ.js";import"./index-DEAamx_H.js";import"./typescript-D14l1a1y.js";import"./index-J4WBpiv9.js";import"./strings-cAoZbHaH.js";import"./castArray-TlECDAqv.js";import"./isEqual-BqBcCRrU.js";import"./_initCloneObject-djD3gYlF.js";import"./debounce-DTzFlSYq.js";import"./_baseIteratee-35aC5hBk.js";import"./index-BqzuTEwO.js";import"./index-CP_56dlf.js";import"./_baseClone-kJ5Pgx6e.js";import"./index-zBoOr1pW.js";import"./vue-plyr-QZFBikSk.js";import"./index-B7ak1Sj_.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),r("div",ue,[a("div",me,[G(e.$slots,"config",{},void 0,!0)]),a("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-fae64b48"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[a("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[a("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[a("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,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?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[a("span",Ge,i(e.$t("kling.name.ratio")),1),a("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:l=>e.value=c.value},[a("div",{class:S(["preview",c.label])},[a("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),a("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[a("div",Oe,[a("div",Be,[a("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),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:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/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?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[a("div",Qe,[a("div",We,[a("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),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:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function lt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),r("div",null,[a("div",et,[a("div",tt,[a("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),a("div",nt,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const at=k(xe,[["render",lt]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[a("div",dt,[a("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[a("div",ht,[a("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:at,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[a("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),a("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:ae,ElTooltip:ie,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={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:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),l=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[a("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Lt,[a("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),a("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),l=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(l)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function lo(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const zo=k(no,[["render",lo]]);export{zo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as G}from"./index.es-CJbKM0CV.js";import{E as R}from"./index-C5k9PNqL.js";import{E as z}from"./index-CNg43fsi.js";import{d as $,h as g,b as r,t as l,k as t,r as L,j as u,l as s,o as n,ez as M,x as a,F as A,v as U,i as y,eA as q,eB as N,eC as H,n as T,f as J,y as f,c7 as K,D as h,J as E,K as S,eD as Q,ds as W,dn as X}from"./index-DTe9fRn-.js";import{E as D,a as O}from"./index-DCYB3TDh.js";import{I as j}from"./InfoIcon-YhCcbV8z.js";import{E as Y}from"./index-DkUww0O6.js";import{V as P}from"./VideoPlayer-C0am2_1Y.js";import{I as Z}from"./ImagePreview-D6FjLfQO.js";import{E as x}from"./index-DxTeNsnH.js";import{E as I}from"./index-H7zk7enZ.js";import{C as ee,N as te}from"./NoTasks-ex5PKih3.js";import{E as oe}from"./index-I4cHhAfY.js";import{a as se}from"./price-C04dX6gR.js";import{C as ne}from"./CopyToClipboard-CU-Bssp8.js";import{E as ae}from"./index-DjlWqdX5.js";import{E as le}from"./index-N-T3RtWX.js";import{E as ie}from"./index-Bp0DDosh.js";import{B as re}from"./BotPlaceholder-C_vy0qCQ.js";import"./use-form-item-CtZlpzU6.js";import"./index-r5W6hzzQ.js";import"./index-DLyu6NQP.js";import"./typescript-BioIzq79.js";import"./index-DaEk4vUe.js";import"./strings-CNF1iAZ6.js";import"./castArray-pZCaAVDW.js";import"./isEqual-CH8EZj5t.js";import"./_initCloneObject-CJq550xS.js";import"./debounce-Bzi7Cd91.js";import"./_baseIteratee-LczmVVcS.js";import"./index-BgQ-O6aa.js";import"./vue-plyr-QZFBikSk.js";import"./index-DPoEMPUV.js";import"./_baseClone-BDmNDGGK.js";import"./index-MMWJF36O.js";import"./index-DyxxJgEB.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:z,ElButton:R,FontAwesomeIcon:G},data(){return{drawer:!1}}}),de={class:"main flex flex-row flex-1"},ue={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},pe={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,m,v,b,w){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",de,[l("div",ue,[L(e.$slots,"config",{},void 0,!0)]),l("div",pe,[L(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=k=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=k=>e.drawer=k),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[L(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=g(ce,[["render",me],["__scopeId","data-v-cfe3cae3"]]),ve=$({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=M)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",_e,[l("h2",he,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=g(ve,[["render",$e],["__scopeId","data-v-ef445fc5"]]),be=$({name:"ActionSelector",components:{ElSelect:O,ElOption:D},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=q)}}),we={class:"field"},ke={class:"title font-bold"},ye={class:"float-left"};function Ve(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",we,[l("h2",ke,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",ye,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(be,[["render",Ve],["__scopeId","data-v-ba5abc8a"]]),Se=$({name:"TranslationSelector",components:{ElSwitch:Y,InfoIcon:j},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ce={class:"flex justify-start items-center"},Ae={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Re(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ie,[l("div",Te,[l("div",Ce,[l("span",Ae,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Ue=g(Se,[["render",Re]]),Le=$({name:"AspectRatioSelector",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.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=H)}}),je={class:"text-sm font-bold mb-2 block"},De={class:"items"},Oe=["onClick"],Pe={class:"name"};function Fe(e,o,m,v,b,w){return n(),r("div",null,[l("span",je,a(e.$t("veo.name.ratio")),1),l("div",De,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:T({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:T(["preview",c.label])},[l("div",{class:"rect",style:J({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Pe,a(c.label),1)],10,Oe))),128))])])}const Be=g(Le,[["render",Fe],["__scopeId","data-v-688d3e9d"]]),ze=$({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),Me={class:"relative"},qe={class:"flex mb-2"},Ne={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",Me,[l("div",qe,[l("span",Ne,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const Je=g(ze,[["render",He]]),Ke=$({name:"StartEndImage",components:{ElUpload:x,ElButton:R,InfoIcon:j,FontAwesomeIcon:G,ImagePreview:Z},emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/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?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){I.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Qe={class:"relative"},We={class:"flex justify-between"},Xe={class:"flex justify-start items-center"},Ye={class:"text-sm font-bold"};function Ze(e,o,m,v,b,w){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),k=s("el-button"),_=s("el-upload");return n(),r("div",Qe,[l("div",We,[l("div",Xe,[l("span",Ye,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(_,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,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:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(k,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const xe=g(Ke,[["render",Ze],["__scopeId","data-v-43d971b7"]]),et="",tt=$({name:"PromptInput",components:{ElInput:oe,InfoIcon:j},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=et)}}),ot={class:"field"},st={class:"box"},nt={class:"title font-bold"};function at(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-input");return n(),r("div",ot,[l("div",st,[l("h2",nt,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const lt=g(tt,[["render",at],["__scopeId","data-v-9189572a"]]),it=$({name:"ConfigPanel",components:{ElButton:R,Consumption:ee,FontAwesomeIcon:G,PromptInput:lt,ModelSelector:ge,StartEndImage:xe,ActionSelector:Ee,VideoFromInput:Je,TranslationSelector:Ue,AspectRatioSelector:Be},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return se(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),rt={class:"flex flex-col h-full"},ct={class:"flex-1 overflow-y-auto p-[15px]"},dt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ut(e,o,m,v,b,w){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),k=s("aspect-ratio-selector"),_=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),F=s("font-awesome-icon"),B=s("el-button");return n(),r("div",rt,[l("div",ct,[E(t(c,{class:"mb-4"},null,512),[[S,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),E(t(i,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(k,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(_,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(p,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(V,{class:"mb-2"},null,512),[[S,e.config?.action==="image2video"]])]),l("div",dt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(F,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const pt=g(it,[["render",ut]]),mt=$({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:ne,FontAwesomeIcon:G,ElAlert:le,VideoPlayer:P,ElTooltip:ae,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ft={class:"preview"},vt={class:"left"},_t={class:"main"},ht={class:"bot"},$t={class:"datetime"},gt={class:"info"},bt={key:0,class:"prompt mt-2"},wt={key:0},kt={key:1},yt={key:0,class:T({content:!0,failed:!0})},Vt={key:0,class:"mb-4"},Et={key:1,class:T({operations:!0,"mt-2":!0})},St={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Tt={key:1,class:T({content:!0})},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:2,class:T({content:!0})},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,o,m,v,b,w){const c=s("el-image"),d=s("video-player"),i=s("el-button"),k=s("el-tooltip"),_=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ft,[l("div",vt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",_t,[l("div",ht,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",$t,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",gt,[e.modelValue?.request?.prompt?(n(),r("p",bt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(n(),r("span",wt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",kt," - ("+a(e.$t("veo.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",yt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Vt,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response.success?(n(),r("div",Et,[t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):f("",!0)]),_:1},8,["content"]),t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):f("",!0)]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",St,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",It,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Tt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ct,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",At,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Gt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Rt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ut,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0)])])}const Dt=g(mt,[["render",jt],["__scopeId","data-v-5372c9d1"]]),Ot=$({name:"RecentPanel",components:{TaskPreview:Dt,NoTasks:te,BotPlaceholder:re},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Pt={key:0},Ft={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function zt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Pt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Ft,[(n(!0),r(A,null,U(e.tasks?.items,(k,_)=>(n(),y(d,{key:_,"model-value":k},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[t(i)])):f("",!0)],64)}const Mt=g(Ot,[["render",zt]]),qt="https://webhook.acedata.cloud/veo",Nt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:Mt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===X.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:v}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",v),await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:v})},async onGenerate(){const e={...this.config,callback_url:qt},o=this.credential?.token;if(!o){console.error("no token specified");return}I.info(this.$t("veo.message.startingTask")),Q.generate(e,{token:o}).then(()=>{I.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===W?I.error(this.$t("veo.message.usedUp")):I.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ht(e,o,m,v,b,w){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Co=g(Nt,[["render",Ht]]);export{Co as default};
|
|
1
|
+
import{F as G}from"./index.es-EtbmiVQe.js";import{E as R}from"./index-CqTGsJay.js";import{E as z}from"./index-BzyEWvnL.js";import{d as $,h as g,b as r,t as l,k as t,r as L,j as u,l as s,o as n,ez as M,x as a,F as A,v as U,i as y,eA as q,eB as N,eC as H,n as T,f as J,y as f,c7 as K,D as h,J as E,K as S,eD as Q,ds as W,dn as X}from"./index-C4ssJdBR.js";import{E as D,a as O}from"./index-C4trafQk.js";import{I as j}from"./InfoIcon-BJAJcb5a.js";import{E as Y}from"./index-C3GYDBc-.js";import{V as P}from"./VideoPlayer-CYaGmv09.js";import{I as Z}from"./ImagePreview-TA4gKfP6.js";import{E as x}from"./index-gFYmOD1F.js";import{E as I}from"./index-BqAthpig.js";import{C as ee,N as te}from"./NoTasks-oiStcbHf.js";import{E as oe}from"./index-Bth-8JIu.js";import{a as se}from"./price-DPmHeT6D.js";import{C as ne}from"./CopyToClipboard-BCGRlwJJ.js";import{E as ae}from"./index-CCjGuukj.js";import{E as le}from"./index-qJunmjSC.js";import{E as ie}from"./index-tdgIYwZh.js";import{B as re}from"./BotPlaceholder-BWFhmlAo.js";import"./use-form-item-CGJaz8fH.js";import"./index-r5W6hzzQ.js";import"./index-DEAamx_H.js";import"./typescript-D14l1a1y.js";import"./index-J4WBpiv9.js";import"./strings-cAoZbHaH.js";import"./castArray-TlECDAqv.js";import"./isEqual-BqBcCRrU.js";import"./_initCloneObject-djD3gYlF.js";import"./debounce-DTzFlSYq.js";import"./_baseIteratee-35aC5hBk.js";import"./index-BqzuTEwO.js";import"./vue-plyr-QZFBikSk.js";import"./index-CP_56dlf.js";import"./_baseClone-kJ5Pgx6e.js";import"./index-zBoOr1pW.js";import"./index-B7ak1Sj_.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:z,ElButton:R,FontAwesomeIcon:G},data(){return{drawer:!1}}}),de={class:"main flex flex-row flex-1"},ue={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},pe={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,m,v,b,w){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",de,[l("div",ue,[L(e.$slots,"config",{},void 0,!0)]),l("div",pe,[L(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=k=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=k=>e.drawer=k),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[L(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=g(ce,[["render",me],["__scopeId","data-v-cfe3cae3"]]),ve=$({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=M)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",_e,[l("h2",he,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=g(ve,[["render",$e],["__scopeId","data-v-ef445fc5"]]),be=$({name:"ActionSelector",components:{ElSelect:O,ElOption:D},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=q)}}),we={class:"field"},ke={class:"title font-bold"},ye={class:"float-left"};function Ve(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",we,[l("h2",ke,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",ye,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(be,[["render",Ve],["__scopeId","data-v-ba5abc8a"]]),Se=$({name:"TranslationSelector",components:{ElSwitch:Y,InfoIcon:j},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ce={class:"flex justify-start items-center"},Ae={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Re(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ie,[l("div",Te,[l("div",Ce,[l("span",Ae,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Ue=g(Se,[["render",Re]]),Le=$({name:"AspectRatioSelector",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.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=H)}}),je={class:"text-sm font-bold mb-2 block"},De={class:"items"},Oe=["onClick"],Pe={class:"name"};function Fe(e,o,m,v,b,w){return n(),r("div",null,[l("span",je,a(e.$t("veo.name.ratio")),1),l("div",De,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:T({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:T(["preview",c.label])},[l("div",{class:"rect",style:J({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Pe,a(c.label),1)],10,Oe))),128))])])}const Be=g(Le,[["render",Fe],["__scopeId","data-v-688d3e9d"]]),ze=$({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),Me={class:"relative"},qe={class:"flex mb-2"},Ne={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",Me,[l("div",qe,[l("span",Ne,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const Je=g(ze,[["render",He]]),Ke=$({name:"StartEndImage",components:{ElUpload:x,ElButton:R,InfoIcon:j,FontAwesomeIcon:G,ImagePreview:Z},emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/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?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){I.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Qe={class:"relative"},We={class:"flex justify-between"},Xe={class:"flex justify-start items-center"},Ye={class:"text-sm font-bold"};function Ze(e,o,m,v,b,w){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),k=s("el-button"),_=s("el-upload");return n(),r("div",Qe,[l("div",We,[l("div",Xe,[l("span",Ye,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(_,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,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:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(k,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const xe=g(Ke,[["render",Ze],["__scopeId","data-v-43d971b7"]]),et="",tt=$({name:"PromptInput",components:{ElInput:oe,InfoIcon:j},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=et)}}),ot={class:"field"},st={class:"box"},nt={class:"title font-bold"};function at(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-input");return n(),r("div",ot,[l("div",st,[l("h2",nt,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const lt=g(tt,[["render",at],["__scopeId","data-v-9189572a"]]),it=$({name:"ConfigPanel",components:{ElButton:R,Consumption:ee,FontAwesomeIcon:G,PromptInput:lt,ModelSelector:ge,StartEndImage:xe,ActionSelector:Ee,VideoFromInput:Je,TranslationSelector:Ue,AspectRatioSelector:Be},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return se(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),rt={class:"flex flex-col h-full"},ct={class:"flex-1 overflow-y-auto p-[15px]"},dt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ut(e,o,m,v,b,w){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),k=s("aspect-ratio-selector"),_=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),F=s("font-awesome-icon"),B=s("el-button");return n(),r("div",rt,[l("div",ct,[E(t(c,{class:"mb-4"},null,512),[[S,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),E(t(i,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(k,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(_,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(p,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(V,{class:"mb-2"},null,512),[[S,e.config?.action==="image2video"]])]),l("div",dt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(F,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const pt=g(it,[["render",ut]]),mt=$({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:ne,FontAwesomeIcon:G,ElAlert:le,VideoPlayer:P,ElTooltip:ae,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ft={class:"preview"},vt={class:"left"},_t={class:"main"},ht={class:"bot"},$t={class:"datetime"},gt={class:"info"},bt={key:0,class:"prompt mt-2"},wt={key:0},kt={key:1},yt={key:0,class:T({content:!0,failed:!0})},Vt={key:0,class:"mb-4"},Et={key:1,class:T({operations:!0,"mt-2":!0})},St={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Tt={key:1,class:T({content:!0})},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:2,class:T({content:!0})},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,o,m,v,b,w){const c=s("el-image"),d=s("video-player"),i=s("el-button"),k=s("el-tooltip"),_=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ft,[l("div",vt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",_t,[l("div",ht,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",$t,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",gt,[e.modelValue?.request?.prompt?(n(),r("p",bt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(n(),r("span",wt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",kt," - ("+a(e.$t("veo.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",yt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Vt,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response.success?(n(),r("div",Et,[t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):f("",!0)]),_:1},8,["content"]),t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):f("",!0)]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",St,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",It,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Tt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ct,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",At,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Gt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Rt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ut,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0)])])}const Dt=g(mt,[["render",jt],["__scopeId","data-v-5372c9d1"]]),Ot=$({name:"RecentPanel",components:{TaskPreview:Dt,NoTasks:te,BotPlaceholder:re},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Pt={key:0},Ft={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function zt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Pt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Ft,[(n(!0),r(A,null,U(e.tasks?.items,(k,_)=>(n(),y(d,{key:_,"model-value":k},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[t(i)])):f("",!0)],64)}const Mt=g(Ot,[["render",zt]]),qt="https://webhook.acedata.cloud/veo",Nt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:Mt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===X.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:v}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",v),await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:v})},async onGenerate(){const e={...this.config,callback_url:qt},o=this.credential?.token;if(!o){console.error("no token specified");return}I.info(this.$t("veo.message.startingTask")),Q.generate(e,{token:o}).then(()=>{I.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===W?I.error(this.$t("veo.message.usedUp")):I.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ht(e,o,m,v,b,w){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Co=g(Nt,[["render",Ht]]);export{Co as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as I}from"./index.es-CJbKM0CV.js";import{E as S}from"./index-C5k9PNqL.js";import{E as P}from"./index-CNg43fsi.js";import{d as $,h as g,b as i,t as l,k as t,r as U,j as f,l as s,o as a,eL as R,x as r,F as V,v as T,i as y,eM as D,eN as F,c7 as O,D as h,y as x,n as C,eO as B,ds as M,dn as N}from"./index-DTe9fRn-.js";import{E as L,a as G}from"./index-DCYB3TDh.js";import{I as A}from"./InfoIcon-YhCcbV8z.js";import{E as q,a as z}from"./index-CuoHzlXN.js";import{I as X}from"./ImagePreview-D6FjLfQO.js";import{E as H}from"./index-DxTeNsnH.js";import{E as k}from"./index-H7zk7enZ.js";import{E as K}from"./index-I4cHhAfY.js";import{C as W,N as J}from"./NoTasks-ex5PKih3.js";import{a as Q}from"./price-C04dX6gR.js";import{C as Y}from"./CopyToClipboard-CU-Bssp8.js";import{I as Z}from"./ImageWrapper-DzYTbbFD.js";import{E as ee}from"./index-N-T3RtWX.js";import{E as te}from"./index-Bp0DDosh.js";import{B as oe}from"./BotPlaceholder-C_vy0qCQ.js";import"./use-form-item-CtZlpzU6.js";import"./index-r5W6hzzQ.js";import"./index-DjlWqdX5.js";import"./index-DaEk4vUe.js";import"./typescript-BioIzq79.js";import"./index-DLyu6NQP.js";import"./strings-CNF1iAZ6.js";import"./castArray-pZCaAVDW.js";import"./isEqual-CH8EZj5t.js";import"./_initCloneObject-CJq550xS.js";import"./debounce-Bzi7Cd91.js";import"./_baseIteratee-LczmVVcS.js";import"./index-BgQ-O6aa.js";import"./index-DPoEMPUV.js";import"./_baseClone-BDmNDGGK.js";import"./index-MMWJF36O.js";import"./index-DyxxJgEB.js";const se=$({name:"LayoutFlux",components:{ElDrawer:P,ElButton:S,FontAwesomeIcon:I},data(){return{drawer:!1}}}),ne={class:"main flex flex-row flex-1"},le={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ae={class:"result h-full p-[15px] flex-1 flex flex-col"};function re(e,o,m,p,v,b){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),i("div",ne,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",ae,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=d=>e.drawer=!0)},{default:f(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=g(se,[["render",re],["__scopeId","data-v-468dfa4e"]]),ce=$({name:"ModelSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=R)}}),ue={class:"field"},de={class:"title font-bold"};function pe(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ue,[l("h2",de,r(e.$t("flux.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const me=g(ce,[["render",pe],["__scopeId","data-v-2e94cca6"]]),fe=$({name:"CountSelector",components:{ElSlider:z,InfoIcon:A,ElInputNumber:q},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),_e={class:"flex justify-between"},he={class:"flex justify-start items-center"},$e={class:"text-sm font-bold"},ge={class:"flex justify-end items-center"},ve={class:"w-full"};function be(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input-number"),n=s("el-slider");return a(),i("div",null,[l("div",_e,[l("div",he,[l("span",$e,r(e.$t("flux.name.numbers")),1),t(c,{content:e.$t("flux.description.numbers")},null,8,["content"])]),l("div",ge,[t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ve,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=d=>e.value=d),min:1,max:4,step:1},null,8,["modelValue"])])])}const xe=g(fe,[["render",be]]),we=$({name:"ActionSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"generate",label:this.$t("flux.name.generate")},{value:"edits",label:this.$t("flux.name.edits")}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||(this.value=F)}}),ke={class:"field"},ye={class:"title font-bold"};function Ve(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ke,[l("h2",ye,r(e.$t("flux.name.task")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(we,[["render",Ve],["__scopeId","data-v-81fd05e5"]]),Ie=$({name:"ImageUrlInput",components:{ElUpload:H,ElButton:S,InfoIcon:A,FontAwesomeIcon:I,ImagePreview:X},emits:["change"],data(){return{fileList:[],uploadUrl:O()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug("URLs changed:",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){k.warning(this.$t("flux.message.uploadStartImageExceed"))},onError(){k.error(this.$t("flux.message.uploadStartImageError"))}}}),Te={class:"relative"},Ue={class:"flex justify-between"},Se={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"};function Ae(e,o,m,p,v,b){const c=s("info-icon"),u=s("image-preview"),n=s("font-awesome-icon"),d=s("el-button"),w=s("el-upload");return a(),i("div",Te,[l("div",Ue,[l("div",Se,[l("span",Ce,r(e.$t("flux.name.imageUrl")),1),t(c,{content:e.$t("flux.description.imageUrl")},null,8,["content"])])]),t(w,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=_=>e.fileList=_),name:"file",limit:5,class:"upload-wrapper",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{file:f(({file:_})=>[t(u,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:f(()=>[t(d,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+r(e.$t("flux.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","headers"])])}const Le=g(Ie,[["render",Ae],["__scopeId","data-v-04710032"]]),Ge="",je=$({name:"PromptInput",components:{ElInput:K,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Ge)}}),Pe={class:"field"},Re={class:"box"},De={class:"title font-bold"};function Fe(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input");return a(),i("div",Pe,[l("div",Re,[l("h2",De,r(e.$t("flux.name.prompt")),1),t(c,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Oe=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Be=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Oe,ModelSelector:me,CountSelector:xe,Consumption:W,ActionSelector:Ee,ImageUrlInput:Le},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return Q(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Me={class:"flex flex-col h-full"},Ne={class:"flex-1 overflow-y-auto p-[15px]"},qe={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ze(e,o,m,p,v,b){const c=s("action-selector"),u=s("prompt-input"),n=s("image-url-input"),d=s("model-selector"),w=s("count-selector"),_=s("consumption"),E=s("font-awesome-icon"),j=s("el-button");return a(),i("div",Me,[l("div",Ne,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),e.config?.action==="edits"?(a(),y(n,{key:0,class:"mb-4"})):x("",!0),t(d,{class:"mb-4"}),t(w,{class:"mb-4"})]),l("div",qe,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),t(j,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[t(E,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+r(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Xe=g(Be,[["render",ze]]),He=$({name:"TaskPreview",components:{ElImage:te,CopyToClipboard:Y,FontAwesomeIcon:I,ElAlert:ee,ImageWrapper:Z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(m=>{let p=m;o&&(p.action=o),e.push(p)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ke={class:"preview"},We={class:"left"},Je={class:"main"},Qe={class:"bot"},Ye={class:"datetime"},Ze={class:"info"},et={key:0,class:"prompt mt-2"},tt={key:0},ot={key:0,class:C({content:!0,failed:!0})},st={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},nt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},lt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},at={key:1,class:C({content:!0})},rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},it={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ut={key:2,class:C({content:!0})},dt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function pt(e,o,m,p,v,b){const c=s("el-image"),u=s("image-wrapper"),n=s("font-awesome-icon"),d=s("copy-to-clipboard"),w=s("el-alert");return a(),i("div",Ke,[l("div",We,[t(c,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),l("div",Je,[l("div",Qe,[h(r(e.$t("flux.name.fluxBot"))+" ",1),l("span",Ye,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ze,[e.modelValue?.request?.prompt?(a(),i("p",et,[h(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(a(),i("span",tt," - ("+r(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(a(),i("div",ot,[l("div",st,[(a(!0),i(V,null,T(e.images,(_,E)=>(a(),y(u,{key:E,src:_?.image_url,"raw-src":_?.image_url,"model-value":_},null,8,["src","raw-src","model-value"]))),128))]),t(w,{closable:!1,class:"mt-2 success"},{default:f(()=>[l("p",nt,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.model"))+": "+r(e.modelValue?.request?.model),1)]),l("p",lt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(a(),i("div",at,[t(w,{closable:!1,class:"failure"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",rt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",it,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+r(e.$t("flux.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),t(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",ct,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),t(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(a(),i("div",ut,[t(w,{closable:!1,class:"info"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",dt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const mt=g(He,[["render",pt],["__scopeId","data-v-fd5838a5"]]),ft=$({name:"RecentPanel",components:{TaskPreview:mt,BotPlaceholder:oe,NoTasks:J},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),_t={key:0},ht={key:1,class:"tasks h-full w-full overflow-y-auto"},$t={key:2,class:"w-full h-full flex items-center justify-center"};function gt(e,o,m,p,v,b){const c=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return a(),i(V,null,[e.tasks?.items===void 0?(a(),i("div",_t,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),i("div",ht,[(a(!0),i(V,null,T(e.tasks?.items,d=>(a(),y(u,{key:d.id,"model-value":d},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(a(),i("div",$t,[t(n)])):x("",!0)],64)}const vt=g(ft,[["render",gt]]),bt="https://webhook.acedata.cloud/flux",xt=$({name:"FluxIndex",components:{ConfigPanel:Xe,Layout:ie,RecentPanel:vt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===N.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:p}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",p),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:p})},async onGenerate(){const e={...this.config,callback_url:bt},o=this.credential?.token;if(!o){console.error("no token specified");return}k.info(this.$t("flux.message.startingTask")),B.generate(e,{token:o}).then(()=>{k.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===M?k.error(this.$t("flux.message.usedUp")):k.error(this.$t("flux.message.startTaskFailed")+p?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function wt(e,o,m,p,v,b){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),y(n,null,{config:f(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:f(()=>[t(u,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const no=g(xt,[["render",wt]]);export{no as default};
|
|
1
|
+
import{F as I}from"./index.es-EtbmiVQe.js";import{E as S}from"./index-CqTGsJay.js";import{E as P}from"./index-BzyEWvnL.js";import{d as $,h as g,b as i,t as l,k as t,r as U,j as f,l as s,o as a,eL as R,x as r,F as V,v as T,i as y,eM as D,eN as F,c7 as O,D as h,y as x,n as C,eO as B,ds as M,dn as N}from"./index-C4ssJdBR.js";import{E as L,a as G}from"./index-C4trafQk.js";import{I as A}from"./InfoIcon-BJAJcb5a.js";import{E as q,a as z}from"./index-DIwFcazb.js";import{I as X}from"./ImagePreview-TA4gKfP6.js";import{E as H}from"./index-gFYmOD1F.js";import{E as k}from"./index-BqAthpig.js";import{E as K}from"./index-Bth-8JIu.js";import{C as W,N as J}from"./NoTasks-oiStcbHf.js";import{a as Q}from"./price-DPmHeT6D.js";import{C as Y}from"./CopyToClipboard-BCGRlwJJ.js";import{I as Z}from"./ImageWrapper-DiWDwTYN.js";import{E as ee}from"./index-qJunmjSC.js";import{E as te}from"./index-tdgIYwZh.js";import{B as oe}from"./BotPlaceholder-BWFhmlAo.js";import"./use-form-item-CGJaz8fH.js";import"./index-r5W6hzzQ.js";import"./index-CCjGuukj.js";import"./index-J4WBpiv9.js";import"./typescript-D14l1a1y.js";import"./index-DEAamx_H.js";import"./strings-cAoZbHaH.js";import"./castArray-TlECDAqv.js";import"./isEqual-BqBcCRrU.js";import"./_initCloneObject-djD3gYlF.js";import"./debounce-DTzFlSYq.js";import"./_baseIteratee-35aC5hBk.js";import"./index-BqzuTEwO.js";import"./index-CP_56dlf.js";import"./_baseClone-kJ5Pgx6e.js";import"./index-zBoOr1pW.js";import"./index-B7ak1Sj_.js";const se=$({name:"LayoutFlux",components:{ElDrawer:P,ElButton:S,FontAwesomeIcon:I},data(){return{drawer:!1}}}),ne={class:"main flex flex-row flex-1"},le={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ae={class:"result h-full p-[15px] flex-1 flex flex-col"};function re(e,o,m,p,v,b){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),i("div",ne,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",ae,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=d=>e.drawer=!0)},{default:f(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=g(se,[["render",re],["__scopeId","data-v-468dfa4e"]]),ce=$({name:"ModelSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=R)}}),ue={class:"field"},de={class:"title font-bold"};function pe(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ue,[l("h2",de,r(e.$t("flux.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const me=g(ce,[["render",pe],["__scopeId","data-v-2e94cca6"]]),fe=$({name:"CountSelector",components:{ElSlider:z,InfoIcon:A,ElInputNumber:q},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),_e={class:"flex justify-between"},he={class:"flex justify-start items-center"},$e={class:"text-sm font-bold"},ge={class:"flex justify-end items-center"},ve={class:"w-full"};function be(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input-number"),n=s("el-slider");return a(),i("div",null,[l("div",_e,[l("div",he,[l("span",$e,r(e.$t("flux.name.numbers")),1),t(c,{content:e.$t("flux.description.numbers")},null,8,["content"])]),l("div",ge,[t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ve,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=d=>e.value=d),min:1,max:4,step:1},null,8,["modelValue"])])])}const xe=g(fe,[["render",be]]),we=$({name:"ActionSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"generate",label:this.$t("flux.name.generate")},{value:"edits",label:this.$t("flux.name.edits")}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||(this.value=F)}}),ke={class:"field"},ye={class:"title font-bold"};function Ve(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ke,[l("h2",ye,r(e.$t("flux.name.task")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(we,[["render",Ve],["__scopeId","data-v-81fd05e5"]]),Ie=$({name:"ImageUrlInput",components:{ElUpload:H,ElButton:S,InfoIcon:A,FontAwesomeIcon:I,ImagePreview:X},emits:["change"],data(){return{fileList:[],uploadUrl:O()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug("URLs changed:",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){k.warning(this.$t("flux.message.uploadStartImageExceed"))},onError(){k.error(this.$t("flux.message.uploadStartImageError"))}}}),Te={class:"relative"},Ue={class:"flex justify-between"},Se={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"};function Ae(e,o,m,p,v,b){const c=s("info-icon"),u=s("image-preview"),n=s("font-awesome-icon"),d=s("el-button"),w=s("el-upload");return a(),i("div",Te,[l("div",Ue,[l("div",Se,[l("span",Ce,r(e.$t("flux.name.imageUrl")),1),t(c,{content:e.$t("flux.description.imageUrl")},null,8,["content"])])]),t(w,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=_=>e.fileList=_),name:"file",limit:5,class:"upload-wrapper",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{file:f(({file:_})=>[t(u,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:f(()=>[t(d,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+r(e.$t("flux.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","headers"])])}const Le=g(Ie,[["render",Ae],["__scopeId","data-v-04710032"]]),Ge="",je=$({name:"PromptInput",components:{ElInput:K,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Ge)}}),Pe={class:"field"},Re={class:"box"},De={class:"title font-bold"};function Fe(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input");return a(),i("div",Pe,[l("div",Re,[l("h2",De,r(e.$t("flux.name.prompt")),1),t(c,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Oe=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Be=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Oe,ModelSelector:me,CountSelector:xe,Consumption:W,ActionSelector:Ee,ImageUrlInput:Le},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return Q(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Me={class:"flex flex-col h-full"},Ne={class:"flex-1 overflow-y-auto p-[15px]"},qe={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ze(e,o,m,p,v,b){const c=s("action-selector"),u=s("prompt-input"),n=s("image-url-input"),d=s("model-selector"),w=s("count-selector"),_=s("consumption"),E=s("font-awesome-icon"),j=s("el-button");return a(),i("div",Me,[l("div",Ne,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),e.config?.action==="edits"?(a(),y(n,{key:0,class:"mb-4"})):x("",!0),t(d,{class:"mb-4"}),t(w,{class:"mb-4"})]),l("div",qe,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),t(j,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[t(E,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+r(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Xe=g(Be,[["render",ze]]),He=$({name:"TaskPreview",components:{ElImage:te,CopyToClipboard:Y,FontAwesomeIcon:I,ElAlert:ee,ImageWrapper:Z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(m=>{let p=m;o&&(p.action=o),e.push(p)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ke={class:"preview"},We={class:"left"},Je={class:"main"},Qe={class:"bot"},Ye={class:"datetime"},Ze={class:"info"},et={key:0,class:"prompt mt-2"},tt={key:0},ot={key:0,class:C({content:!0,failed:!0})},st={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},nt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},lt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},at={key:1,class:C({content:!0})},rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},it={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ut={key:2,class:C({content:!0})},dt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function pt(e,o,m,p,v,b){const c=s("el-image"),u=s("image-wrapper"),n=s("font-awesome-icon"),d=s("copy-to-clipboard"),w=s("el-alert");return a(),i("div",Ke,[l("div",We,[t(c,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),l("div",Je,[l("div",Qe,[h(r(e.$t("flux.name.fluxBot"))+" ",1),l("span",Ye,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ze,[e.modelValue?.request?.prompt?(a(),i("p",et,[h(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(a(),i("span",tt," - ("+r(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(a(),i("div",ot,[l("div",st,[(a(!0),i(V,null,T(e.images,(_,E)=>(a(),y(u,{key:E,src:_?.image_url,"raw-src":_?.image_url,"model-value":_},null,8,["src","raw-src","model-value"]))),128))]),t(w,{closable:!1,class:"mt-2 success"},{default:f(()=>[l("p",nt,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.model"))+": "+r(e.modelValue?.request?.model),1)]),l("p",lt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(a(),i("div",at,[t(w,{closable:!1,class:"failure"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",rt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",it,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+r(e.$t("flux.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),t(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",ct,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),t(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(a(),i("div",ut,[t(w,{closable:!1,class:"info"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",dt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const mt=g(He,[["render",pt],["__scopeId","data-v-fd5838a5"]]),ft=$({name:"RecentPanel",components:{TaskPreview:mt,BotPlaceholder:oe,NoTasks:J},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),_t={key:0},ht={key:1,class:"tasks h-full w-full overflow-y-auto"},$t={key:2,class:"w-full h-full flex items-center justify-center"};function gt(e,o,m,p,v,b){const c=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return a(),i(V,null,[e.tasks?.items===void 0?(a(),i("div",_t,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),i("div",ht,[(a(!0),i(V,null,T(e.tasks?.items,d=>(a(),y(u,{key:d.id,"model-value":d},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(a(),i("div",$t,[t(n)])):x("",!0)],64)}const vt=g(ft,[["render",gt]]),bt="https://webhook.acedata.cloud/flux",xt=$({name:"FluxIndex",components:{ConfigPanel:Xe,Layout:ie,RecentPanel:vt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===N.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:p}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",p),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:p})},async onGenerate(){const e={...this.config,callback_url:bt},o=this.credential?.token;if(!o){console.error("no token specified");return}k.info(this.$t("flux.message.startingTask")),B.generate(e,{token:o}).then(()=>{k.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===M?k.error(this.$t("flux.message.usedUp")):k.error(this.$t("flux.message.startTaskFailed")+p?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function wt(e,o,m,p,v,b){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),y(n,null,{config:f(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:f(()=>[t(u,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const no=g(xt,[["render",wt]]);export{no as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as S}from"./index.es-CJbKM0CV.js";import{E as I}from"./index-C5k9PNqL.js";import{E as O}from"./index-CNg43fsi.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,el as N,x as i,em as q,en as H,c7 as j,D as g,i as k,y as f,n as C,ai as z,F as D,v as K,eo as J,ds as Q,dn as W}from"./index-DTe9fRn-.js";import{I as U}from"./InfoIcon-YhCcbV8z.js";import{E as A}from"./index-DkUww0O6.js";import{I as F}from"./ImagePreview-D6FjLfQO.js";import{E as R}from"./index-DxTeNsnH.js";import{E}from"./index-H7zk7enZ.js";import{F as X}from"./FilePreview-9n711Ra6.js";import{E as Y}from"./index-I4cHhAfY.js";import{V as M}from"./VideoPlayer-C0am2_1Y.js";import{C as Z,N as x}from"./NoTasks-ex5PKih3.js";import{a as ee}from"./price-C04dX6gR.js";import{C as te}from"./CopyToClipboard-CU-Bssp8.js";import{E as oe}from"./index-DjlWqdX5.js";import{E as se}from"./index-N-T3RtWX.js";import{E as ne}from"./index-Bp0DDosh.js";import{B as ae}from"./BotPlaceholder-C_vy0qCQ.js";import"./use-form-item-CtZlpzU6.js";import"./index-r5W6hzzQ.js";import"./index-DaEk4vUe.js";import"./index-DPoEMPUV.js";import"./typescript-BioIzq79.js";import"./_baseClone-BDmNDGGK.js";import"./_initCloneObject-CJq550xS.js";import"./isEqual-CH8EZj5t.js";import"./index-MMWJF36O.js";import"./vue-plyr-QZFBikSk.js";import"./debounce-Bzi7Cd91.js";import"./index-DyxxJgEB.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main flex flex-row flex-1"},re={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ce={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-11a53e0c"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),Ne=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),qe={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",qe,[n("div",He,[n("div",Ke,[n("span",Je,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const We=b(Ne,[["render",Qe],["__scopeId","data-v-425a8cec"]]),Xe=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:X,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Ye={class:"relative"},Ze={class:"flex justify-between"},xe={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ye,[n("div",Ze,[n("div",xe,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(Xe,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:Y,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:We,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Z},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return ee(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ne,CopyToClipboard:te,FontAwesomeIcon:S,ElAlert:se,VideoPlayer:M,ElTooltip:oe,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const Nt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),qt=v({name:"RecentPanel",components:{BotPlaceholder:ae,TaskPreview:Nt,NoTasks:x},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},Jt={key:2,class:"w-full h-full flex items-center justify-center"};function Qt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",Jt,[t(c)])):f("",!0)],64)}const Wt=b(qt,[["render",Qt]]),Xt="https://webhook.acedata.cloud/luma",Yt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Wt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===W.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Xt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),J.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===Q?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Zt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const To=b(Yt,[["render",Zt]]);export{To as default};
|
|
1
|
+
import{F as S}from"./index.es-EtbmiVQe.js";import{E as I}from"./index-CqTGsJay.js";import{E as O}from"./index-BzyEWvnL.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,el as N,x as i,em as q,en as H,c7 as j,D as g,i as k,y as f,n as C,ai as z,F as D,v as K,eo as J,ds as Q,dn as W}from"./index-C4ssJdBR.js";import{I as U}from"./InfoIcon-BJAJcb5a.js";import{E as A}from"./index-C3GYDBc-.js";import{I as F}from"./ImagePreview-TA4gKfP6.js";import{E as R}from"./index-gFYmOD1F.js";import{E}from"./index-BqAthpig.js";import{F as X}from"./FilePreview-fVU_bWwG.js";import{E as Y}from"./index-Bth-8JIu.js";import{V as M}from"./VideoPlayer-CYaGmv09.js";import{C as Z,N as x}from"./NoTasks-oiStcbHf.js";import{a as ee}from"./price-DPmHeT6D.js";import{C as te}from"./CopyToClipboard-BCGRlwJJ.js";import{E as oe}from"./index-CCjGuukj.js";import{E as se}from"./index-qJunmjSC.js";import{E as ne}from"./index-tdgIYwZh.js";import{B as ae}from"./BotPlaceholder-BWFhmlAo.js";import"./use-form-item-CGJaz8fH.js";import"./index-r5W6hzzQ.js";import"./index-J4WBpiv9.js";import"./index-CP_56dlf.js";import"./typescript-D14l1a1y.js";import"./_baseClone-kJ5Pgx6e.js";import"./_initCloneObject-djD3gYlF.js";import"./isEqual-BqBcCRrU.js";import"./index-zBoOr1pW.js";import"./vue-plyr-QZFBikSk.js";import"./debounce-DTzFlSYq.js";import"./index-B7ak1Sj_.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main flex flex-row flex-1"},re={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ce={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-11a53e0c"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),Ne=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),qe={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",qe,[n("div",He,[n("div",Ke,[n("span",Je,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const We=b(Ne,[["render",Qe],["__scopeId","data-v-425a8cec"]]),Xe=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:X,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Ye={class:"relative"},Ze={class:"flex justify-between"},xe={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ye,[n("div",Ze,[n("div",xe,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(Xe,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:Y,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:We,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Z},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return ee(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ne,CopyToClipboard:te,FontAwesomeIcon:S,ElAlert:se,VideoPlayer:M,ElTooltip:oe,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const Nt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),qt=v({name:"RecentPanel",components:{BotPlaceholder:ae,TaskPreview:Nt,NoTasks:x},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},Jt={key:2,class:"w-full h-full flex items-center justify-center"};function Qt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",Jt,[t(c)])):f("",!0)],64)}const Wt=b(qt,[["render",Qt]]),Xt="https://webhook.acedata.cloud/luma",Yt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Wt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===W.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Xt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),J.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===Q?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Zt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const To=b(Yt,[["render",Zt]]);export{To as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,f0 as S,m as N,p as T,q as L,f1 as D,c7 as R,b as h,f as U,F as P,v as B,n as q}from"./index-
|
|
1
|
+
import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,f0 as S,m as N,p as T,q as L,f1 as D,c7 as R,b as h,f as U,F as P,v as B,n as q}from"./index-C4ssJdBR.js";import{F as w}from"./index.es-EtbmiVQe.js";import{E as F,a as V}from"./index-CPE0C_s4.js";import{E as j}from"./index-tOFv-Cd9.js";import{E as b}from"./index-tdgIYwZh.js";import"./typescript-D14l1a1y.js";import"./index-CCjGuukj.js";import"./index-J4WBpiv9.js";import"./index-r5W6hzzQ.js";import"./index-BqzuTEwO.js";import"./dropdown-zSfjtIjT.js";import"./debounce-DTzFlSYq.js";import"./index-zBoOr1pW.js";const H=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:j,ElMenu:V,ElMenuItem:F,FontAwesomeIcon:w},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),M={class:"flex"},X={class:"flex-1 text-center"};function z(e,n,E,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),d=t("el-image"),m=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:n[0]||(n[0]=C=>e.$emit("close"))},{default:i(()=>[s(a,{collapse:!1,class:"menu"},{default:i(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:i(()=>[$(p(e.$t("common.message.joinDiscord")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),s(m,{width:350,trigger:"hover"},{reference:i(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:i(()=>[$(p(e.$t("common.message.addWeChat")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:i(()=>[o("div",M,[o("div",X,[s(d,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(H,[["render",z],["__scopeId","data-v-0fce633f"]]),G=g({name:"ProfileIndex",components:{ElImage:b,HelpDialog:J,FontAwesomeIcon:w},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${S()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:N,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:T,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:L,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:D,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:R(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("resetAll"),await this.$store.dispatch("chat/resetAll"),await this.$store.dispatch("midjourney/resetAll"),await this.$store.dispatch("qrart/resetAll"),await this.$store.dispatch("flux/resetAll"),await this.$store.dispatch("hailuo/resetAll"),await this.$store.dispatch("headshots/resetAll"),await this.$store.dispatch("kling/resetAll"),await this.$store.dispatch("luma/resetAll"),await this.$store.dispatch("pika/resetAll"),await this.$store.dispatch("suno/resetAll"),await this.$store.dispatch("login")}}]}},methods:{onHome(){this.$router.push({name:O})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),W={class:"profile"},K={class:"info"},Q={class:"links"},Y=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function se(e,n,E,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),d=t("locale-selector"),m=t("help-dialog");return r(),h("div",W,[o("div",K,[s(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),o("h2",null,p(e.user.username),1),o("div",{style:U({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),o("div",Q,[(r(!0),h(P,null,B(e.links,(a,u)=>(r(),h("a",{key:u,class:q({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[o("span",Z,[s(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),o("span",ee,p(a.text),1),o("span",te,[s(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Y))),128))]),s(d,{visible:e.operating.locale==!0,onClose:n[0]||(n[0]=a=>e.operating.locale=!1)},null,8,["visible"]),s(m,{visible:e.operating.help==!0,onClose:n[1]||(n[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(G,[["render",se],["__scopeId","data-v-54290de4"]]);export{_e as default};
|