@acedatacloud/nexior 3.24.0 → 3.24.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.
Files changed (94) hide show
  1. package/dist/assets/{Auth-U3yYMWPb.js → Auth-DTWbVCp6.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-DKPNFbIr.js → BotPlaceholder-BgP8q68w.js} +1 -1
  3. package/dist/assets/{Callback-CVMoquq2.js → Callback-Cb9A2lu5.js} +1 -1
  4. package/dist/assets/{Console-CTJZPHmF.js → Console-DKm795jt.js} +1 -1
  5. package/dist/assets/{Conversation-BS7L0VcC.js → Conversation-Dk0fhTtm.js} +2 -2
  6. package/dist/assets/{CopyToClipboard-CzE5Qyes.js → CopyToClipboard-C_xMmtDc.js} +1 -1
  7. package/dist/assets/{Detail-C3oYMO6J.js → Detail-DrLS-v5M.js} +1 -1
  8. package/dist/assets/{EditArray-C1bpV3sz.js → EditArray-ClJUMpk4.js} +1 -1
  9. package/dist/assets/{Extra-DbeIRzak.js → Extra-DIxRDCsF.js} +1 -1
  10. package/dist/assets/{FilePreview-CDzbEEK9.js → FilePreview-Br7iuVJu.js} +1 -1
  11. package/dist/assets/{History-CIxJTX4E.js → History-DCtkx2Uv.js} +1 -1
  12. package/dist/assets/{ImagePreview-VnpfW9Pj.js → ImagePreview-D_L90Mc7.js} +1 -1
  13. package/dist/assets/{ImageWrapper-C2PohC6W.js → ImageWrapper-Pritl6ia.js} +1 -1
  14. package/dist/assets/{Index-BkVsyXyu.js → Index--R6Mez1e.js} +1 -1
  15. package/dist/assets/{Index-BDLsUrH_.js → Index-3BrY7GTD.js} +1 -1
  16. package/dist/assets/{Index-CHJJxQZZ.js → Index-BGpRIRnJ.js} +1 -1
  17. package/dist/assets/{Index-BZdHsOL7.js → Index-BKRMsAnb.js} +1 -1
  18. package/dist/assets/{Index-DNUO_WLR.js → Index-BOd6hidv.js} +1 -1
  19. package/dist/assets/{Index-BfanYqxM.js → Index-C7oPQwl1.js} +1 -1
  20. package/dist/assets/Index-CByCCg-O.css +1 -0
  21. package/dist/assets/{Index-QhofBqyo.js → Index-CIQ_Kr5J.js} +1 -1
  22. package/dist/assets/{Index-DYEsXBUc.js → Index-CXaW3ysi.js} +1 -1
  23. package/dist/assets/{Index-c9YVJIU8.js → Index-CtvpUe3c.js} +1 -1
  24. package/dist/assets/{Index-DNxQOH2I.js → Index-CxLpwFuf.js} +1 -1
  25. package/dist/assets/{Index-BqnAzyak.js → Index-DGBKmiyr.js} +1 -1
  26. package/dist/assets/Index-DIoE-xqc.js +1 -0
  27. package/dist/assets/{Index-DxTCv_hq.js → Index-DY2ratY8.js} +1 -1
  28. package/dist/assets/Index-DkScbE8t.js +1 -0
  29. package/dist/assets/Index-H2tBAlzy.css +1 -0
  30. package/dist/assets/{Index-UvepuNe-.js → Index-Ky0a79So.js} +1 -1
  31. package/dist/assets/{Index-D-RFeTM-.js → Index-uEyIppRg.js} +1 -1
  32. package/dist/assets/{InfoIcon-htaT17q9.js → InfoIcon-cglftkH2.js} +1 -1
  33. package/dist/assets/{Invitees-BFsoobgF.js → Invitees-Bp3ntf_X.js} +1 -1
  34. package/dist/assets/{List-DX0aA1uB.js → List-DnT5KyyU.js} +1 -1
  35. package/dist/assets/{List-D3J3Rfhh.js → List-cBcRn9xk.js} +1 -1
  36. package/dist/assets/{List-X5PnY5tK.js → List-sD7bv3K1.js} +1 -1
  37. package/dist/assets/{Login-DSWYve0k.js → Login-Bqwz79l3.js} +1 -1
  38. package/dist/assets/{Main-DnQIo5_J.js → Main-CVFNdoBS.js} +1 -1
  39. package/dist/assets/{Navigator-CFx-t1E0.js → Navigator-DZb9560y.js} +1 -1
  40. package/dist/assets/{NoTasks-DHdI1Frr.js → NoTasks-B6hLJrko.js} +1 -1
  41. package/dist/assets/{Pagination-DcQVmu45.js → Pagination-BYFbwkF0.js} +1 -1
  42. package/dist/assets/{Status-C3EStxoL.js → Status-CsL--y5f.js} +1 -1
  43. package/dist/assets/{Subscribe-C7U8Yb7_.js → Subscribe-DIcCgCzT.js} +1 -1
  44. package/dist/assets/{VideoPlayer-DCap_X2q.js → VideoPlayer-CjCdW8Fe.js} +1 -1
  45. package/dist/assets/{_baseClone-B6o0klpv.js → _baseClone-DiKhUhxc.js} +1 -1
  46. package/dist/assets/{_baseIteratee-Bk7QROEW.js → _baseIteratee-7W3vde5j.js} +1 -1
  47. package/dist/assets/{_initCloneObject-iRvJrG7M.js → _initCloneObject-CwAtjxb1.js} +1 -1
  48. package/dist/assets/{castArray-CoJ3z4SB.js → castArray-7tYrhn6A.js} +1 -1
  49. package/dist/assets/{debounce-CEE_CsrA.js → debounce-09KXX3DN.js} +1 -1
  50. package/dist/assets/{distribution-pW96wtpU.js → distribution-tLpcb6Nq.js} +1 -1
  51. package/dist/assets/{dropdown-CfSu6_B-.js → dropdown-UbXA6R_N.js} +1 -1
  52. package/dist/assets/{index-BZHTBEqD.js → index-3k3mWDTk.js} +1 -1
  53. package/dist/assets/{index-Czog4o5z.js → index-7746Wyq5.js} +1 -1
  54. package/dist/assets/{index-DNzgGVij.js → index-B-7UQmSa.js} +1 -1
  55. package/dist/assets/{index-z-6wtqoM.js → index-BAMr6BWr.js} +1 -1
  56. package/dist/assets/{index-Colfa9sv.js → index-BCo-Le3_.js} +1 -1
  57. package/dist/assets/{index-DTBHHHz_.js → index-BQWF6H8D.js} +1 -1
  58. package/dist/assets/{index-CLOiWNZO.js → index-BX6sU3GX.js} +1 -1
  59. package/dist/assets/{index--xRF9A-K.js → index-BbDlaK5a.js} +1 -1
  60. package/dist/assets/{index-CLwJbfYs.js → index-BjMVMy9y.js} +33 -33
  61. package/dist/assets/{index-d2CvBCAu.js → index-Bk6FKSGz.js} +1 -1
  62. package/dist/assets/{index-AT7DtKgl.js → index-BzF_Ko5s.js} +1 -1
  63. package/dist/assets/{index-BU5-qzoD.js → index-CCO_ODiz.js} +1 -1
  64. package/dist/assets/{index-H2WJr-nr.js → index-CEhCMEW7.js} +1 -1
  65. package/dist/assets/{index-Cs65NgP9.js → index-CEpvbqDt.js} +1 -1
  66. package/dist/assets/{index-C1s2diPf.js → index-CQ2bsd-r.js} +1 -1
  67. package/dist/assets/{index-CGrkkZd-.js → index-CgDmoqKO.js} +1 -1
  68. package/dist/assets/{index-O2tEst1s.js → index-Ckr3Af0G.js} +1 -1
  69. package/dist/assets/{index-Dc0-osYE.js → index-D19A578F.js} +1 -1
  70. package/dist/assets/{index-BR8qEo0P.js → index-DURkl1eZ.js} +1 -1
  71. package/dist/assets/{index-B_qlJ-la.js → index-DXfYQh0Z.js} +1 -1
  72. package/dist/assets/{index-DNuWNnk-.js → index-Dagq6Y2s.js} +1 -1
  73. package/dist/assets/{index-DITqxnfk.js → index-DulF_7UO.js} +1 -1
  74. package/dist/assets/{index-Cg60JDEK.js → index-DvTCiu3P.js} +1 -1
  75. package/dist/assets/{index-DbY2GEPa.js → index-DxLDQU_A.js} +1 -1
  76. package/dist/assets/{index-DHn59BRx.js → index-OiDdq1JS.js} +1 -1
  77. package/dist/assets/{index-BkA1qQd3.js → index-SyQbsg8v.js} +1 -1
  78. package/dist/assets/{index-D3gVuWw7.js → index-WJgswFMW.js} +1 -1
  79. package/dist/assets/{index-MlWSSchD.js → index-bryRJW_X.js} +1 -1
  80. package/dist/assets/{index-CQvuK-4v.js → index-ifdCUgG7.js} +1 -1
  81. package/dist/assets/{index.es-BLCm9UT-.js → index.es-B6L7VFNr.js} +1 -1
  82. package/dist/assets/{isEqual-DQdO_K1-.js → isEqual-Df5ippj8.js} +1 -1
  83. package/dist/assets/{isPlainObject-BsyTgoxK.js → isPlainObject-BF8_keIM.js} +1 -1
  84. package/dist/assets/{order-CeKvimTq.js → order-DXkvQhpi.js} +1 -1
  85. package/dist/assets/{price-CZSDhLnN.js → price-CG10y7sa.js} +1 -1
  86. package/dist/assets/{strings-WMZYwrQD.js → strings-C0ATdFxF.js} +1 -1
  87. package/dist/assets/{typescript-CoKqfRJS.js → typescript-DXZhO2KE.js} +1 -1
  88. package/dist/assets/{use-form-item-CRDWzFx1.js → use-form-item-CZJno9cW.js} +1 -1
  89. package/dist/index.html +1 -1
  90. package/package.json +1 -1
  91. package/dist/assets/Index-Bqvjazj0.js +0 -1
  92. package/dist/assets/Index-DPQ747pA.css +0 -1
  93. package/dist/assets/Index-PQerfBmJ.css +0 -1
  94. package/dist/assets/Index-eWhLfJGA.js +0 -1
@@ -0,0 +1 @@
1
+ .menu[data-v-0fce633f]{border-right:none}.menu .el-menu-item[data-v-0fce633f]{height:40px}.profile[data-v-8eb3b1d9]{display:flex;flex-direction:column}.info[data-v-8eb3b1d9]{width:100%;display:flex;flex-direction:column;align-items:center;padding:50px 0 20px;height:200px!important;overflow:hidden;position:relative}.info .background[data-v-8eb3b1d9]{width:100%;height:100%;position:absolute;top:0;left:0;z-index:-1;background-repeat:no-repeat;background-size:cover;background-position:center;filter:blur(15px) brightness(.7)}.info .avatar[data-v-8eb3b1d9]{width:50px;height:50px;border-radius:50%}.info h2[data-v-8eb3b1d9]{font-size:18px}.links[data-v-8eb3b1d9]{width:100%;flex:1;padding:20px}.links .link[data-v-8eb3b1d9]{height:40px;display:block;width:100%;cursor:pointer;margin-bottom:5px;position:relative;color:var(--el-text-color-primary);line-height:40px}.links .link .suffix[data-v-8eb3b1d9]{width:3px;height:40px;position:absolute;right:-5px;margin-right:5px;border-radius:3px;display:inline-block}.links .link .icon[data-v-8eb3b1d9]{width:16px;height:16px;display:inline-block;position:relative;margin-right:10px;transform:translateY(-2%)}.links .link .text[data-v-8eb3b1d9]{font-size:14px}
@@ -1 +1 @@
1
- import{F as U}from"./index.es-BLCm9UT-.js";import{E as R}from"./index-Czog4o5z.js";import{E as M}from"./index-Cs65NgP9.js";import{d as f,h,b as r,t as l,k as t,r as P,j as u,l as o,o as a,eY as O,x as c,F as V,v as x,i as k,eZ as q,e_ as B,e$ as z,f0 as N,f1 as X,n as I,f as Q,cf as Y,D as w,y,f2 as H,dA as Z,dw as J}from"./index-CLwJbfYs.js";import{E as T,a as C}from"./index-CLOiWNZO.js";import{I as L}from"./InfoIcon-htaT17q9.js";import{E as K,a as W}from"./index-Cg60JDEK.js";import{I as ee}from"./ImagePreview-VnpfW9Pj.js";import{E as te}from"./index-Colfa9sv.js";import{E as S}from"./index-CQvuK-4v.js";import{E as oe}from"./index-DHn59BRx.js";import{C as se,N as ne}from"./NoTasks-DHdI1Frr.js";import{a as ae}from"./price-CZSDhLnN.js";import{C as le}from"./CopyToClipboard-CzE5Qyes.js";import{V as re}from"./VideoPlayer-DCap_X2q.js";import{E as ie}from"./index-DITqxnfk.js";import{E as ce}from"./index-DNuWNnk-.js";import{E as pe}from"./index-O2tEst1s.js";import{B as de}from"./BotPlaceholder-DKPNFbIr.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-DNzgGVij.js";import"./typescript-CoKqfRJS.js";import"./index-AT7DtKgl.js";import"./strings-WMZYwrQD.js";import"./castArray-CoJ3z4SB.js";import"./isEqual-DQdO_K1-.js";import"./_initCloneObject-iRvJrG7M.js";import"./debounce-CEE_CsrA.js";import"./_baseIteratee-Bk7QROEW.js";import"./index-Dc0-osYE.js";import"./index-D3gVuWw7.js";import"./_baseClone-B6o0klpv.js";import"./index-C1s2diPf.js";import"./vue-plyr-QZFBikSk.js";import"./index-MlWSSchD.js";const ue=f({name:"LayoutPixverse",components:{ElDrawer:M,ElButton:R,FontAwesomeIcon:U},data(){return{drawer:!1}}}),me={class:"main flex flex-row flex-1"},ve={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function fe(e,s,d,m,$,g){const i=o("font-awesome-icon"),p=o("el-button"),n=o("el-drawer");return a(),r("div",me,[l("div",ve,[P(e.$slots,"config",{},void 0,!0)]),l("div",_e,[P(e.$slots,"result",{},void 0,!0)]),t(p,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(i,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const he=h(ue,[["render",fe],["__scopeId","data-v-0646853d"]]),$e=f({name:"ModelSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=O)}}),ge={class:"field"},be={class:"title font-bold"};function ye(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",ge,[l("h2",be,c(e.$t("pixverse.name.model")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const we=h($e,[["render",ye],["__scopeId","data-v-e8f337ca"]]),ke=f({name:"QualitySelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=q)}}),Ve={class:"field"},xe={class:"title font-bold"};function Se(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Ve,[l("h2",xe,c(e.$t("pixverse.name.quality")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=h(ke,[["render",Se],["__scopeId","data-v-64aeaae9"]]),Ie=f({name:"MotionSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=B)}}),Te={class:"field"},Ce={class:"title font-bold"};function Ue(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Te,[l("h2",Ce,c(e.$t("pixverse.name.motion")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=h(Ie,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=f({name:"StyleSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=z)}}),Pe={class:"field"},Le={class:"title font-bold"};function De(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Pe,[l("h2",Le,c(e.$t("pixverse.name.style")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ge=h(Ae,[["render",De],["__scopeId","data-v-64e17b3c"]]),je=f({name:"SeedSelector",components:{ElSlider:W,InfoIcon:L,ElInputNumber:K},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Fe={class:"flex justify-between"},Me={class:"flex justify-start items-center"},Oe={class:"text-sm font-bold"},qe={class:"flex justify-end items-center"},Be={class:"w-full"};function ze(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input-number"),n=o("el-slider");return a(),r("div",null,[l("div",Fe,[l("div",Me,[l("span",Oe,c(e.$t("pixverse.name.seed")),1),t(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",qe,[t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",Be,[t(n,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Ne=h(je,[["render",ze]]),Xe=f({name:"DurationSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=N)}}),Qe={class:"field"},Ye={class:"title font-bold"};function He(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Qe,[l("h2",Ye,c(e.$t("pixverse.name.duration")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ze=h(Xe,[["render",He],["__scopeId","data-v-065c77ef"]]),Je=f({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=X)}}),Ke={class:"text-sm font-bold mb-2 block"},We={class:"items"},et=["onClick"],tt={class:"name"};function ot(e,s,d,m,$,g){return a(),r("div",null,[l("span",Ke,c(e.$t("pixverse.name.aspectRatio")),1),l("div",We,[(a(!0),r(V,null,x(e.options,(i,p)=>(a(),r("div",{key:p,class:I({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:I(["preview",i.label])},[l("div",{class:"rect",style:Q({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",tt,c(i.label),1)],10,et))),128))])])}const st=h(Je,[["render",ot],["__scopeId","data-v-32a7677f"]]),nt=f({name:"StartImage",components:{ElUpload:te,ElButton:R,InfoIcon:L,FontAwesomeIcon:U,ImagePreview:ee},emits:["change"],data(){return{fileList:[],uploadUrl:Y()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){S.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),at={class:"relative"},lt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},it={class:"text-sm font-bold"};function ct(e,s,d,m,$,g){const i=o("info-icon"),p=o("image-preview"),n=o("font-awesome-icon"),_=o("el-button"),b=o("el-upload");return a(),r("div",at,[l("div",lt,[l("div",rt,[l("span",it,c(e.$t("pixverse.name.startImage")),1),t(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),t(b,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:v})=>[v.url&&v.percentage!==void 0?(a(),k(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=h(nt,[["render",ct],["__scopeId","data-v-666104e4"]]),dt="",ut=f({name:"PromptInput",components:{ElInput:oe,InfoIcon:L},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=dt)}}),mt={class:"field"},vt={class:"box"},_t={class:"title font-bold"};function ft(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input");return a(),r("div",mt,[l("div",vt,[l("h2",_t,c(e.$t("pixverse.name.prompt")),1),t(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),t(p,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ht=h(ut,[["render",ft],["__scopeId","data-v-b3dd608e"]]),$t=f({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:U,PromptInput:ht,ModelSelector:we,QualitySelector:Ee,MotionSelector:Re,StyleSelector:Ge,DurationSelector:Ze,StartImage:pt,SeedSelector:Ne,RatioSelector:st,Consumption:se},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ae(this.config,this.service?.metadata?.price)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),gt={class:"flex flex-col h-full"},bt={class:"flex-1 overflow-y-auto p-[15px]"},yt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wt(e,s,d,m,$,g){const i=o("prompt-input"),p=o("model-selector"),n=o("style-selector"),_=o("ratio-selector"),b=o("motion-selector"),v=o("quality-selector"),E=o("start-image"),A=o("seed-selector"),D=o("duration-selector"),G=o("consumption"),j=o("font-awesome-icon"),F=o("el-button");return a(),r("div",gt,[l("div",bt,[t(i,{class:"mb-4"}),t(p,{class:"mb-4"}),t(n,{class:"mb-4"}),t(_,{class:"mb-4"}),t(b,{class:"mb-4"}),t(v,{class:"mb-4"}),t(E,{class:"mb-2"}),t(A,{class:"mb-4"}),t(D,{class:"mb-4"})]),l("div",yt,[t(G,{value:e.consumption,service:e.service},null,8,["value","service"]),t(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(j,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const kt=h($t,[["render",wt]]),Vt=f({name:"TaskPreview",components:{ElImage:pe,CopyToClipboard:le,FontAwesomeIcon:U,ElAlert:ce,VideoPlayer:re,ElTooltip:ie,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),xt={class:"preview"},St={class:"left"},Et={class:"main"},It={class:"bot"},Tt={class:"datetime"},Ct={class:"info"},Ut={key:0,class:"prompt mt-2"},Rt={key:0},At={key:1},Pt={key:0,class:I({content:!0,failed:!0})},Lt={key:0,class:"mb-4"},Dt={key:1,class:I({operations:!0,"mt-2":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},jt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:I({content:!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={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 Bt(e,s,d,m,$,g){const i=o("el-image"),p=o("video-player"),n=o("el-button"),_=o("el-tooltip"),b=o("font-awesome-icon"),v=o("copy-to-clipboard"),E=o("el-alert");return a(),r("div",xt,[l("div",St,[t(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",Et,[l("div",It,[w(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Tt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ct,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[w(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Rt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Pt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Lt,[t(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",Dt,[t(_,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),k(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[w(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Gt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",jt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Ft,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failure")),1)]),default:u(()=>[l("p",Mt,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),t(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",Ot,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",qt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),t(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const zt=h(Vt,[["render",Bt],["__scopeId","data-v-3f3bff8a"]]),Nt=f({name:"RecentPanel",components:{TaskPreview:zt,NoTasks:ne,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.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")}}}),Xt={key:0},Qt={key:1,class:"h-full w-full overflow-y-auto tasks"},Yt={key:2,class:"w-full h-full flex items-center justify-center"};function Ht(e,s,d,m,$,g){const i=o("bot-placeholder"),p=o("task-preview"),n=o("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Xt,[t(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",Qt,[(a(!0),r(V,null,x(e.tasks?.items,(_,b)=>(a(),k(p,{key:b,"model-value":_},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Yt,[t(n)])):y("",!0)],64)}const Zt=h(Nt,[["render",Ht]]),Jt="https://webhook.acedata.cloud/pixverse",Kt=f({name:"PixverseIndex",components:{ConfigPanel:kt,Layout:he,RecentPanel:Zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pixverse?.status?.getApplications===J.Request},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.tasks}},watch:{tasks:{handler(e,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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){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:d,createdAtMax:m}=e||{};console.debug("limit",s,"createdAtMin",d,"createdAtMax",m),await this.$store.dispatch("pixverse/getTasks",{limit:s,createdAtMin:d,createdAtMax:m})},async onGenerate(){const e={...this.config,callback_url:Jt},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("pixverse.message.startingTask")),H.generate(e,{token:s}).then(()=>{S.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(d=>{d?.response?.data?.error?.code===Z?S.error(this.$t("pixverse.message.usedUp")):S.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Wt(e,s,d,m,$,g){const i=o("config-panel"),p=o("recent-panel"),n=o("layout");return a(),k(n,null,{config:u(()=>[t(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(p,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Go=h(Kt,[["render",Wt]]);export{Go as default};
1
+ import{F as U}from"./index.es-B6L7VFNr.js";import{E as R}from"./index-7746Wyq5.js";import{E as M}from"./index-CEpvbqDt.js";import{d as f,h,b as r,t as l,k as t,r as P,j as u,l as o,o as a,eY as O,x as c,F as V,v as x,i as k,eZ as q,e_ as B,e$ as z,f0 as N,f1 as X,n as I,f as Q,cf as Y,D as w,y,f2 as H,dA as Z,dw as J}from"./index-BjMVMy9y.js";import{E as T,a as C}from"./index-BX6sU3GX.js";import{I as L}from"./InfoIcon-cglftkH2.js";import{E as K,a as W}from"./index-DvTCiu3P.js";import{I as ee}from"./ImagePreview-D_L90Mc7.js";import{E as te}from"./index-BCo-Le3_.js";import{E as S}from"./index-ifdCUgG7.js";import{E as oe}from"./index-OiDdq1JS.js";import{C as se,N as ne}from"./NoTasks-B6hLJrko.js";import{a as ae}from"./price-CG10y7sa.js";import{C as le}from"./CopyToClipboard-C_xMmtDc.js";import{V as re}from"./VideoPlayer-CjCdW8Fe.js";import{E as ie}from"./index-DulF_7UO.js";import{E as ce}from"./index-Dagq6Y2s.js";import{E as pe}from"./index-Ckr3Af0G.js";import{B as de}from"./BotPlaceholder-BgP8q68w.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-B-7UQmSa.js";import"./typescript-DXZhO2KE.js";import"./index-BzF_Ko5s.js";import"./strings-C0ATdFxF.js";import"./castArray-7tYrhn6A.js";import"./isEqual-Df5ippj8.js";import"./_initCloneObject-CwAtjxb1.js";import"./debounce-09KXX3DN.js";import"./_baseIteratee-7W3vde5j.js";import"./index-D19A578F.js";import"./index-WJgswFMW.js";import"./_baseClone-DiKhUhxc.js";import"./index-CQ2bsd-r.js";import"./vue-plyr-QZFBikSk.js";import"./index-bryRJW_X.js";const ue=f({name:"LayoutPixverse",components:{ElDrawer:M,ElButton:R,FontAwesomeIcon:U},data(){return{drawer:!1}}}),me={class:"main flex flex-row flex-1"},ve={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function fe(e,s,d,m,$,g){const i=o("font-awesome-icon"),p=o("el-button"),n=o("el-drawer");return a(),r("div",me,[l("div",ve,[P(e.$slots,"config",{},void 0,!0)]),l("div",_e,[P(e.$slots,"result",{},void 0,!0)]),t(p,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(i,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const he=h(ue,[["render",fe],["__scopeId","data-v-0646853d"]]),$e=f({name:"ModelSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=O)}}),ge={class:"field"},be={class:"title font-bold"};function ye(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",ge,[l("h2",be,c(e.$t("pixverse.name.model")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const we=h($e,[["render",ye],["__scopeId","data-v-e8f337ca"]]),ke=f({name:"QualitySelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=q)}}),Ve={class:"field"},xe={class:"title font-bold"};function Se(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Ve,[l("h2",xe,c(e.$t("pixverse.name.quality")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=h(ke,[["render",Se],["__scopeId","data-v-64aeaae9"]]),Ie=f({name:"MotionSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=B)}}),Te={class:"field"},Ce={class:"title font-bold"};function Ue(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Te,[l("h2",Ce,c(e.$t("pixverse.name.motion")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=h(Ie,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=f({name:"StyleSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=z)}}),Pe={class:"field"},Le={class:"title font-bold"};function De(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Pe,[l("h2",Le,c(e.$t("pixverse.name.style")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ge=h(Ae,[["render",De],["__scopeId","data-v-64e17b3c"]]),je=f({name:"SeedSelector",components:{ElSlider:W,InfoIcon:L,ElInputNumber:K},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Fe={class:"flex justify-between"},Me={class:"flex justify-start items-center"},Oe={class:"text-sm font-bold"},qe={class:"flex justify-end items-center"},Be={class:"w-full"};function ze(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input-number"),n=o("el-slider");return a(),r("div",null,[l("div",Fe,[l("div",Me,[l("span",Oe,c(e.$t("pixverse.name.seed")),1),t(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",qe,[t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",Be,[t(n,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Ne=h(je,[["render",ze]]),Xe=f({name:"DurationSelector",components:{ElSelect:C,ElOption:T},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=N)}}),Qe={class:"field"},Ye={class:"title font-bold"};function He(e,s,d,m,$,g){const i=o("el-option"),p=o("el-select");return a(),r("div",Qe,[l("h2",Ye,c(e.$t("pixverse.name.duration")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:u(()=>[(a(!0),r(V,null,x(e.options,n=>(a(),k(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ze=h(Xe,[["render",He],["__scopeId","data-v-065c77ef"]]),Je=f({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=X)}}),Ke={class:"text-sm font-bold mb-2 block"},We={class:"items"},et=["onClick"],tt={class:"name"};function ot(e,s,d,m,$,g){return a(),r("div",null,[l("span",Ke,c(e.$t("pixverse.name.aspectRatio")),1),l("div",We,[(a(!0),r(V,null,x(e.options,(i,p)=>(a(),r("div",{key:p,class:I({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:I(["preview",i.label])},[l("div",{class:"rect",style:Q({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",tt,c(i.label),1)],10,et))),128))])])}const st=h(Je,[["render",ot],["__scopeId","data-v-32a7677f"]]),nt=f({name:"StartImage",components:{ElUpload:te,ElButton:R,InfoIcon:L,FontAwesomeIcon:U,ImagePreview:ee},emits:["change"],data(){return{fileList:[],uploadUrl:Y()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){S.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),at={class:"relative"},lt={class:"flex justify-between"},rt={class:"flex justify-start items-center"},it={class:"text-sm font-bold"};function ct(e,s,d,m,$,g){const i=o("info-icon"),p=o("image-preview"),n=o("font-awesome-icon"),_=o("el-button"),b=o("el-upload");return a(),r("div",at,[l("div",lt,[l("div",rt,[l("span",it,c(e.$t("pixverse.name.startImage")),1),t(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),t(b,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:v})=>[v.url&&v.percentage!==void 0?(a(),k(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=h(nt,[["render",ct],["__scopeId","data-v-666104e4"]]),dt="",ut=f({name:"PromptInput",components:{ElInput:oe,InfoIcon:L},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=dt)}}),mt={class:"field"},vt={class:"box"},_t={class:"title font-bold"};function ft(e,s,d,m,$,g){const i=o("info-icon"),p=o("el-input");return a(),r("div",mt,[l("div",vt,[l("h2",_t,c(e.$t("pixverse.name.prompt")),1),t(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),t(p,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ht=h(ut,[["render",ft],["__scopeId","data-v-b3dd608e"]]),$t=f({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:U,PromptInput:ht,ModelSelector:we,QualitySelector:Ee,MotionSelector:Re,StyleSelector:Ge,DurationSelector:Ze,StartImage:pt,SeedSelector:Ne,RatioSelector:st,Consumption:se},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return ae(this.config,this.service?.metadata?.price)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),gt={class:"flex flex-col h-full"},bt={class:"flex-1 overflow-y-auto p-[15px]"},yt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wt(e,s,d,m,$,g){const i=o("prompt-input"),p=o("model-selector"),n=o("style-selector"),_=o("ratio-selector"),b=o("motion-selector"),v=o("quality-selector"),E=o("start-image"),A=o("seed-selector"),D=o("duration-selector"),G=o("consumption"),j=o("font-awesome-icon"),F=o("el-button");return a(),r("div",gt,[l("div",bt,[t(i,{class:"mb-4"}),t(p,{class:"mb-4"}),t(n,{class:"mb-4"}),t(_,{class:"mb-4"}),t(b,{class:"mb-4"}),t(v,{class:"mb-4"}),t(E,{class:"mb-2"}),t(A,{class:"mb-4"}),t(D,{class:"mb-4"})]),l("div",yt,[t(G,{value:e.consumption,service:e.service},null,8,["value","service"]),t(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(j,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const kt=h($t,[["render",wt]]),Vt=f({name:"TaskPreview",components:{ElImage:pe,CopyToClipboard:le,FontAwesomeIcon:U,ElAlert:ce,VideoPlayer:re,ElTooltip:ie,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),xt={class:"preview"},St={class:"left"},Et={class:"main"},It={class:"bot"},Tt={class:"datetime"},Ct={class:"info"},Ut={key:0,class:"prompt mt-2"},Rt={key:0},At={key:1},Pt={key:0,class:I({content:!0,failed:!0})},Lt={key:0,class:"mb-4"},Dt={key:1,class:I({operations:!0,"mt-2":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},jt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:I({content:!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={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 Bt(e,s,d,m,$,g){const i=o("el-image"),p=o("video-player"),n=o("el-button"),_=o("el-tooltip"),b=o("font-awesome-icon"),v=o("copy-to-clipboard"),E=o("el-alert");return a(),r("div",xt,[l("div",St,[t(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",Et,[l("div",It,[w(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Tt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ct,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[w(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Rt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Pt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Lt,[t(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",Dt,[t(_,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),k(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[w(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",Gt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",jt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Ft,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failure")),1)]),default:u(()=>[l("p",Mt,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),t(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",Ot,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),t(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",qt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),w(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),t(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const zt=h(Vt,[["render",Bt],["__scopeId","data-v-3f3bff8a"]]),Nt=f({name:"RecentPanel",components:{TaskPreview:zt,NoTasks:ne,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.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")}}}),Xt={key:0},Qt={key:1,class:"h-full w-full overflow-y-auto tasks"},Yt={key:2,class:"w-full h-full flex items-center justify-center"};function Ht(e,s,d,m,$,g){const i=o("bot-placeholder"),p=o("task-preview"),n=o("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Xt,[t(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",Qt,[(a(!0),r(V,null,x(e.tasks?.items,(_,b)=>(a(),k(p,{key:b,"model-value":_},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Yt,[t(n)])):y("",!0)],64)}const Zt=h(Nt,[["render",Ht]]),Jt="https://webhook.acedata.cloud/pixverse",Kt=f({name:"PixverseIndex",components:{ConfigPanel:kt,Layout:he,RecentPanel:Zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pixverse?.status?.getApplications===J.Request},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.tasks}},watch:{tasks:{handler(e,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("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){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:d,createdAtMax:m}=e||{};console.debug("limit",s,"createdAtMin",d,"createdAtMax",m),await this.$store.dispatch("pixverse/getTasks",{limit:s,createdAtMin:d,createdAtMax:m})},async onGenerate(){const e={...this.config,callback_url:Jt},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("pixverse.message.startingTask")),H.generate(e,{token:s}).then(()=>{S.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(d=>{d?.response?.data?.error?.code===Z?S.error(this.$t("pixverse.message.usedUp")):S.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Wt(e,s,d,m,$,g){const i=o("config-panel"),p=o("recent-panel"),n=o("layout");return a(),k(n,null,{config:u(()=>[t(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(p,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Go=h(Kt,[["render",Wt]]);export{Go as default};
@@ -1 +1 @@
1
- import{F as U}from"./index.es-BLCm9UT-.js";import{E as I}from"./index-Czog4o5z.js";import{E as L}from"./index-Cs65NgP9.js";import{d as b,h as k,b as l,t as i,k as t,r as T,j as u,l as o,o as s,f7 as R,x as n,F as C,v as G,i as v,cf as P,D as p,y as h,n as E,aq as j,f8 as D,dA as B,dw as M}from"./index-CLwJbfYs.js";import{E as q,a as O}from"./index-CLOiWNZO.js";import{I as A}from"./InfoIcon-htaT17q9.js";import{I as z}from"./ImagePreview-VnpfW9Pj.js";import{E as F}from"./index-Colfa9sv.js";import{E as V}from"./index-CQvuK-4v.js";import{E as N}from"./index-DHn59BRx.js";import{C as H,N as K}from"./NoTasks-DHdI1Frr.js";import{a as J}from"./price-CZSDhLnN.js";import{C as Q}from"./CopyToClipboard-CzE5Qyes.js";import{V as W}from"./VideoPlayer-DCap_X2q.js";import{E as X}from"./index-DITqxnfk.js";import{E as Y}from"./index-DNuWNnk-.js";import{E as Z}from"./index-O2tEst1s.js";import{B as x}from"./BotPlaceholder-DKPNFbIr.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-DNzgGVij.js";import"./typescript-CoKqfRJS.js";import"./index-AT7DtKgl.js";import"./strings-WMZYwrQD.js";import"./castArray-CoJ3z4SB.js";import"./isEqual-DQdO_K1-.js";import"./_initCloneObject-iRvJrG7M.js";import"./debounce-CEE_CsrA.js";import"./_baseIteratee-Bk7QROEW.js";import"./index-Dc0-osYE.js";import"./index-D3gVuWw7.js";import"./_baseClone-B6o0klpv.js";import"./index-C1s2diPf.js";import"./vue-plyr-QZFBikSk.js";import"./index-MlWSSchD.js";const ee=b({name:"LayoutHailuo",components:{ElDrawer:L,ElButton:I,FontAwesomeIcon:U},data(){return{drawer:!1}}}),te={class:"main flex flex-row flex-1"},oe={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},se={class:"result h-full p-[15px] flex-1 flex flex-col"};function ae(e,a,f,_,w,y){const d=o("font-awesome-icon"),m=o("el-button"),r=o("el-drawer");return s(),l("div",te,[i("div",oe,[T(e.$slots,"config",{},void 0,!0)]),i("div",se,[T(e.$slots,"result",{},void 0,!0)]),t(m,{circle:"",class:"menu",onClick:a[0]||(a[0]=g=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(r,{modelValue:e.drawer,"onUpdate:modelValue":a[1]||(a[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"340px"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ne=k(ee,[["render",ae],["__scopeId","data-v-096d9205"]]),le=b({name:"ModelSelector",components:{ElSelect:O,ElOption:q},data(){return{}},computed:{options(){return[{value:"minimax-t2v",label:this.$t("hailuo.button.model1")},{value:"minimax-i2v",label:this.$t("hailuo.button.model2")}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||(this.value=R)}}),ie={class:"field"},re={class:"title font-bold"},ce={class:"float-left"};function ue(e,a,f,_,w,y){const d=o("el-option"),m=o("el-select");return s(),l("div",ie,[i("h2",re,n(e.$t("hailuo.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=r=>e.value=r),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:u(()=>[(s(!0),l(C,null,G(e.options,r=>(s(),v(d,{key:r.value,label:r.label,value:r.value},{default:u(()=>[i("span",ce,n(r.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const de=k(le,[["render",ue],["__scopeId","data-v-30ff1e69"]]),me=b({name:"StartImageUrlInput",components:{ElUpload:F,ElButton:I,InfoIcon:A,ImagePreview:z},data(){return{fileList:[],uploadUrl:P()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){V.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){V.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),pe={class:"relative"},he={class:"flex justify-between"},fe={class:"flex justify-start items-center"},_e={class:"text-sm font-bold"};function ge(e,a,f,_,w,y){const d=o("info-icon"),m=o("image-preview"),r=o("el-button"),g=o("el-upload");return s(),l("div",pe,[i("div",he,[i("div",fe,[i("span",_e,n(e.$t("hailuo.name.startImageUrl")),1),t(d,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),t(g,{"file-list":e.fileList,"onUpdate:fileList":a[0]||(a[0]=c=>e.fileList=c),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file","show-file-list":!0,limit:1,multiple:!1,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:c})=>[c.url&&c.percentage!==void 0?(s(),v(m,{key:0,url:c.url,name:c.name,percentage:c.percentage,onRemove:$=>e.fileList.splice(e.fileList.indexOf(c),1)},null,8,["url","name","percentage","onRemove"])):h("",!0)]),default:u(()=>[t(r,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:u(()=>[p(n(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}const $e=k(me,[["render",ge],["__scopeId","data-v-a906df80"]]),ve="",be=b({name:"PromptInput",components:{ElInput:N,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ve)}}),ke={class:"field"},we={class:"box"},ye={class:"title font-bold"};function Ve(e,a,f,_,w,y){const d=o("info-icon"),m=o("el-input");return s(),l("div",ke,[i("div",we,[i("h2",ye,n(e.$t("hailuo.name.prompt")),1),t(d,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":a[0]||(a[0]=r=>e.prompt=r),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ie=k(be,[["render",Ve],["__scopeId","data-v-d54ffa64"]]),Ee=b({name:"PresetPanel",components:{ElButton:I,FontAwesomeIcon:U,PromptInput:Ie,StartImageUrlInput:$e,ModelSelector:de,Consumption:H},emits:["generate"],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return J(this.config,this.service?.metadata?.price)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Se={class:"flex flex-col h-full"},Te={class:"flex-1 overflow-y-auto p-[15px]"},Ce={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ue(e,a,f,_,w,y){const d=o("prompt-input"),m=o("model-selector"),r=o("start-image-url-input"),g=o("consumption"),c=o("font-awesome-icon"),$=o("el-button");return s(),l("div",Se,[i("div",Te,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),e.config?.model==="minimax-i2v"?(s(),v(r,{key:0,class:"mb-2"})):h("",!0)]),i("div",Ce,[t(g,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(s(),v($,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(c,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(s(),v($,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(c,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])}const Ge=k(Ee,[["render",Ue]]),Ae=b({name:"TaskPreview",components:{ElImage:Z,CopyToClipboard:Q,FontAwesomeIcon:U,ElAlert:Y,VideoPlayer:W,ElTooltip:X,ElButton:I},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug("on download hailuo video",e),window.open(e,"_blank")}}}),Le={class:"preview"},Re={class:"left"},Pe={class:"main"},je={class:"bot"},De={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Oe={key:1},ze={key:0,class:E({content:!0,failed:!0})},Fe={key:0,class:"mb-4"},Ne={key:1,class:E({operations:!0,"mt-2":!0})},He={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ke={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Je={key:1,class:E({content:!0})},Qe={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},We={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ye={key:2,class:E({content:!0})},Ze={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function xe(e,a,f,_,w,y){const d=o("el-image"),m=o("video-player"),r=o("el-button"),g=o("el-tooltip"),c=o("font-awesome-icon"),$=o("copy-to-clipboard"),S=o("el-alert");return s(),l("div",Le,[i("div",Re,[t(d,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),i("div",Pe,[i("div",je,[p(n(e.$t("hailuo.name.hailuoBot"))+" ",1),i("span",De,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",Be,[e.modelValue?.request?.prompt?(s(),l("p",Me,[p(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(s(),l("span",qe," - ("+n(e.$t("hailuo.status.pending"))+") ",1)),e.video?.state==="processing"||e.video?.state==="pending"||e.video?.state==="running"?(s(),l("span",Oe," - ("+n(e.$t("hailuo.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(s(),l("div",ze,[e.video?.video_url?(s(),l("div",Fe,[t(m,{src:e.video?.video_url},null,8,["src"])])):h("",!0),e.video?(s(),l("div",Ne,[t(g,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.video?.video_url?(s(),v(r,{key:0,type:"info",size:"small",class:"mb-2",onClick:a[0]||(a[0]=j(ut=>e.onDownload(e.video?.video_url),["stop"]))},{default:u(()=>[p(n(e.$t("hailuo.button.download")),1)]),_:1})):h("",!0)]),_:1},8,["content"])])):h("",!0),t(S,{closable:!1,class:"mt-2 success"},{default:u(()=>[e.modelValue?.request?.model?(s(),l("p",He,[t(c,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.model"))+": "+n(e.modelValue?.request?.model)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])):h("",!0),i("p",Ke,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(s(),l("div",Je,[t(S,{closable:!1,class:"failure"},{template:u(()=>[t(c,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",Qe,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])]),i("p",We,[t(c,{icon:"fa-solid fa-circle-info",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t($,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),i("p",Xe,[t(c,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t($,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===void 0?(s(),l("div",Ye,[t(S,{closable:!1,class:"info"},{template:u(()=>[t(c,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",Ze,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0)])])}const et=k(Ae,[["render",xe],["__scopeId","data-v-72acd507"]]),tt=b({name:"RecentPanel",components:{TaskPreview:et,BotPlaceholder:x,NoTasks:K},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.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")}}}),ot={key:0},st={key:1,class:"tasks w-full h-full overflow-y-auto"},at={key:2,class:"w-full h-full flex items-center justify-center"};function nt(e,a,f,_,w,y){const d=o("bot-placeholder"),m=o("task-preview"),r=o("no-tasks");return s(),l(C,null,[e.tasks?.items===void 0?(s(),l("div",ot,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(s(),l("div",st,[(s(!0),l(C,null,G(e.tasks?.items,g=>(s(),v(m,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):h("",!0),e.tasks?.items?.length===0?(s(),l("div",at,[t(r)])):h("",!0)],64)}const lt=k(tt,[["render",nt]]),it="https://webhook.acedata.cloud/hailuo",rt=b({name:"HailuoIndex",components:{ConfigPanel:Ge,Layout:ne,RecentPanel:lt},inject:["initialized"],data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.hailuo?.status?.getApplications===M.Request},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,a){e?.items?.length>a?.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("hailuo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("hailuo/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:a=5,createdAtMin:f,createdAtMax:_}=e||{};console.debug("limit",a,"createdAtMin",f,"createdAtMax",_),await this.$store.dispatch("hailuo/getTasks",{limit:a,createdAtMin:f,createdAtMax:_})},async onGenerate(){const e={...this.config,callback_url:it},a=this.credential?.token;if(!a){console.error("no token specified");return}V.info(this.$t("hailuo.message.startingTask")),D.generate(e,{token:a}).then(()=>{V.success(this.$t("hailuo.message.startTaskSuccess"))}).catch(f=>{f?.response?.data?.error?.code===B?V.error(this.$t("hailuo.message.usedUp")):V.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ct(e,a,f,_,w,y){const d=o("config-panel"),m=o("recent-panel"),r=o("layout");return s(),v(r,null,{config:u(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Kt=k(rt,[["render",ct]]);export{Kt as default};
1
+ import{F as U}from"./index.es-B6L7VFNr.js";import{E as I}from"./index-7746Wyq5.js";import{E as L}from"./index-CEpvbqDt.js";import{d as b,h as k,b as l,t as i,k as t,r as T,j as u,l as o,o as s,f7 as R,x as n,F as C,v as G,i as v,cf as P,D as p,y as h,n as E,aq as j,f8 as D,dA as B,dw as M}from"./index-BjMVMy9y.js";import{E as q,a as O}from"./index-BX6sU3GX.js";import{I as A}from"./InfoIcon-cglftkH2.js";import{I as z}from"./ImagePreview-D_L90Mc7.js";import{E as F}from"./index-BCo-Le3_.js";import{E as V}from"./index-ifdCUgG7.js";import{E as N}from"./index-OiDdq1JS.js";import{C as H,N as K}from"./NoTasks-B6hLJrko.js";import{a as J}from"./price-CG10y7sa.js";import{C as Q}from"./CopyToClipboard-C_xMmtDc.js";import{V as W}from"./VideoPlayer-CjCdW8Fe.js";import{E as X}from"./index-DulF_7UO.js";import{E as Y}from"./index-Dagq6Y2s.js";import{E as Z}from"./index-Ckr3Af0G.js";import{B as x}from"./BotPlaceholder-BgP8q68w.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-B-7UQmSa.js";import"./typescript-DXZhO2KE.js";import"./index-BzF_Ko5s.js";import"./strings-C0ATdFxF.js";import"./castArray-7tYrhn6A.js";import"./isEqual-Df5ippj8.js";import"./_initCloneObject-CwAtjxb1.js";import"./debounce-09KXX3DN.js";import"./_baseIteratee-7W3vde5j.js";import"./index-D19A578F.js";import"./index-WJgswFMW.js";import"./_baseClone-DiKhUhxc.js";import"./index-CQ2bsd-r.js";import"./vue-plyr-QZFBikSk.js";import"./index-bryRJW_X.js";const ee=b({name:"LayoutHailuo",components:{ElDrawer:L,ElButton:I,FontAwesomeIcon:U},data(){return{drawer:!1}}}),te={class:"main flex flex-row flex-1"},oe={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},se={class:"result h-full p-[15px] flex-1 flex flex-col"};function ae(e,a,f,_,w,y){const d=o("font-awesome-icon"),m=o("el-button"),r=o("el-drawer");return s(),l("div",te,[i("div",oe,[T(e.$slots,"config",{},void 0,!0)]),i("div",se,[T(e.$slots,"result",{},void 0,!0)]),t(m,{circle:"",class:"menu",onClick:a[0]||(a[0]=g=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(r,{modelValue:e.drawer,"onUpdate:modelValue":a[1]||(a[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"340px"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ne=k(ee,[["render",ae],["__scopeId","data-v-096d9205"]]),le=b({name:"ModelSelector",components:{ElSelect:O,ElOption:q},data(){return{}},computed:{options(){return[{value:"minimax-t2v",label:this.$t("hailuo.button.model1")},{value:"minimax-i2v",label:this.$t("hailuo.button.model2")}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||(this.value=R)}}),ie={class:"field"},re={class:"title font-bold"},ce={class:"float-left"};function ue(e,a,f,_,w,y){const d=o("el-option"),m=o("el-select");return s(),l("div",ie,[i("h2",re,n(e.$t("hailuo.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=r=>e.value=r),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:u(()=>[(s(!0),l(C,null,G(e.options,r=>(s(),v(d,{key:r.value,label:r.label,value:r.value},{default:u(()=>[i("span",ce,n(r.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const de=k(le,[["render",ue],["__scopeId","data-v-30ff1e69"]]),me=b({name:"StartImageUrlInput",components:{ElUpload:F,ElButton:I,InfoIcon:A,ImagePreview:z},data(){return{fileList:[],uploadUrl:P()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){V.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){V.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),pe={class:"relative"},he={class:"flex justify-between"},fe={class:"flex justify-start items-center"},_e={class:"text-sm font-bold"};function ge(e,a,f,_,w,y){const d=o("info-icon"),m=o("image-preview"),r=o("el-button"),g=o("el-upload");return s(),l("div",pe,[i("div",he,[i("div",fe,[i("span",_e,n(e.$t("hailuo.name.startImageUrl")),1),t(d,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),t(g,{"file-list":e.fileList,"onUpdate:fileList":a[0]||(a[0]=c=>e.fileList=c),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file","show-file-list":!0,limit:1,multiple:!1,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:c})=>[c.url&&c.percentage!==void 0?(s(),v(m,{key:0,url:c.url,name:c.name,percentage:c.percentage,onRemove:$=>e.fileList.splice(e.fileList.indexOf(c),1)},null,8,["url","name","percentage","onRemove"])):h("",!0)]),default:u(()=>[t(r,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:u(()=>[p(n(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}const $e=k(me,[["render",ge],["__scopeId","data-v-a906df80"]]),ve="",be=b({name:"PromptInput",components:{ElInput:N,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ve)}}),ke={class:"field"},we={class:"box"},ye={class:"title font-bold"};function Ve(e,a,f,_,w,y){const d=o("info-icon"),m=o("el-input");return s(),l("div",ke,[i("div",we,[i("h2",ye,n(e.$t("hailuo.name.prompt")),1),t(d,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":a[0]||(a[0]=r=>e.prompt=r),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ie=k(be,[["render",Ve],["__scopeId","data-v-d54ffa64"]]),Ee=b({name:"PresetPanel",components:{ElButton:I,FontAwesomeIcon:U,PromptInput:Ie,StartImageUrlInput:$e,ModelSelector:de,Consumption:H},emits:["generate"],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return J(this.config,this.service?.metadata?.price)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Se={class:"flex flex-col h-full"},Te={class:"flex-1 overflow-y-auto p-[15px]"},Ce={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ue(e,a,f,_,w,y){const d=o("prompt-input"),m=o("model-selector"),r=o("start-image-url-input"),g=o("consumption"),c=o("font-awesome-icon"),$=o("el-button");return s(),l("div",Se,[i("div",Te,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),e.config?.model==="minimax-i2v"?(s(),v(r,{key:0,class:"mb-2"})):h("",!0)]),i("div",Ce,[t(g,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(s(),v($,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(c,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(s(),v($,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(c,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])}const Ge=k(Ee,[["render",Ue]]),Ae=b({name:"TaskPreview",components:{ElImage:Z,CopyToClipboard:Q,FontAwesomeIcon:U,ElAlert:Y,VideoPlayer:W,ElTooltip:X,ElButton:I},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug("on download hailuo video",e),window.open(e,"_blank")}}}),Le={class:"preview"},Re={class:"left"},Pe={class:"main"},je={class:"bot"},De={class:"datetime"},Be={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Oe={key:1},ze={key:0,class:E({content:!0,failed:!0})},Fe={key:0,class:"mb-4"},Ne={key:1,class:E({operations:!0,"mt-2":!0})},He={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ke={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Je={key:1,class:E({content:!0})},Qe={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},We={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ye={key:2,class:E({content:!0})},Ze={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function xe(e,a,f,_,w,y){const d=o("el-image"),m=o("video-player"),r=o("el-button"),g=o("el-tooltip"),c=o("font-awesome-icon"),$=o("copy-to-clipboard"),S=o("el-alert");return s(),l("div",Le,[i("div",Re,[t(d,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),i("div",Pe,[i("div",je,[p(n(e.$t("hailuo.name.hailuoBot"))+" ",1),i("span",De,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",Be,[e.modelValue?.request?.prompt?(s(),l("p",Me,[p(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(s(),l("span",qe," - ("+n(e.$t("hailuo.status.pending"))+") ",1)),e.video?.state==="processing"||e.video?.state==="pending"||e.video?.state==="running"?(s(),l("span",Oe," - ("+n(e.$t("hailuo.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(s(),l("div",ze,[e.video?.video_url?(s(),l("div",Fe,[t(m,{src:e.video?.video_url},null,8,["src"])])):h("",!0),e.video?(s(),l("div",Ne,[t(g,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.video?.video_url?(s(),v(r,{key:0,type:"info",size:"small",class:"mb-2",onClick:a[0]||(a[0]=j(ut=>e.onDownload(e.video?.video_url),["stop"]))},{default:u(()=>[p(n(e.$t("hailuo.button.download")),1)]),_:1})):h("",!0)]),_:1},8,["content"])])):h("",!0),t(S,{closable:!1,class:"mt-2 success"},{default:u(()=>[e.modelValue?.request?.model?(s(),l("p",He,[t(c,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.model"))+": "+n(e.modelValue?.request?.model)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])):h("",!0),i("p",Ke,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(s(),l("div",Je,[t(S,{closable:!1,class:"failure"},{template:u(()=>[t(c,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",Qe,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])]),i("p",We,[t(c,{icon:"fa-solid fa-circle-info",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t($,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),i("p",Xe,[t(c,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t($,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===void 0?(s(),l("div",Ye,[t(S,{closable:!1,class:"info"},{template:u(()=>[t(c,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",Ze,[t(c,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0)])])}const et=k(Ae,[["render",xe],["__scopeId","data-v-72acd507"]]),tt=b({name:"RecentPanel",components:{TaskPreview:et,BotPlaceholder:x,NoTasks:K},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.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")}}}),ot={key:0},st={key:1,class:"tasks w-full h-full overflow-y-auto"},at={key:2,class:"w-full h-full flex items-center justify-center"};function nt(e,a,f,_,w,y){const d=o("bot-placeholder"),m=o("task-preview"),r=o("no-tasks");return s(),l(C,null,[e.tasks?.items===void 0?(s(),l("div",ot,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(s(),l("div",st,[(s(!0),l(C,null,G(e.tasks?.items,g=>(s(),v(m,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):h("",!0),e.tasks?.items?.length===0?(s(),l("div",at,[t(r)])):h("",!0)],64)}const lt=k(tt,[["render",nt]]),it="https://webhook.acedata.cloud/hailuo",rt=b({name:"HailuoIndex",components:{ConfigPanel:Ge,Layout:ne,RecentPanel:lt},inject:["initialized"],data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.hailuo?.status?.getApplications===M.Request},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,a){e?.items?.length>a?.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("hailuo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("hailuo/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:a=5,createdAtMin:f,createdAtMax:_}=e||{};console.debug("limit",a,"createdAtMin",f,"createdAtMax",_),await this.$store.dispatch("hailuo/getTasks",{limit:a,createdAtMin:f,createdAtMax:_})},async onGenerate(){const e={...this.config,callback_url:it},a=this.credential?.token;if(!a){console.error("no token specified");return}V.info(this.$t("hailuo.message.startingTask")),D.generate(e,{token:a}).then(()=>{V.success(this.$t("hailuo.message.startTaskSuccess"))}).catch(f=>{f?.response?.data?.error?.code===B?V.error(this.$t("hailuo.message.usedUp")):V.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ct(e,a,f,_,w,y){const d=o("config-panel"),m=o("recent-panel"),r=o("layout");return s(),v(r,null,{config:u(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Kt=k(rt,[["render",ct]]);export{Kt as default};
@@ -1 +1 @@
1
- import{F as I}from"./index.es-BLCm9UT-.js";import{E as S}from"./index-Czog4o5z.js";import{E as P}from"./index-Cs65NgP9.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,f3 as R,x as r,F as V,v as T,i as y,f4 as D,f5 as F,cf as B,D as h,y as x,n as C,f6 as O,dA as M,dw as N}from"./index-CLwJbfYs.js";import{E as L,a as G}from"./index-CLOiWNZO.js";import{I as A}from"./InfoIcon-htaT17q9.js";import{E as q,a as z}from"./index-Cg60JDEK.js";import{I as X}from"./ImagePreview-VnpfW9Pj.js";import{E as H}from"./index-Colfa9sv.js";import{E as k}from"./index-CQvuK-4v.js";import{E as K}from"./index-DHn59BRx.js";import{C as W,N as J}from"./NoTasks-DHdI1Frr.js";import{a as Q}from"./price-CZSDhLnN.js";import{C as Y}from"./CopyToClipboard-CzE5Qyes.js";import{I as Z}from"./ImageWrapper-C2PohC6W.js";import{E as ee}from"./index-DNuWNnk-.js";import{E as te}from"./index-O2tEst1s.js";import{B as oe}from"./BotPlaceholder-DKPNFbIr.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-DITqxnfk.js";import"./index-AT7DtKgl.js";import"./typescript-CoKqfRJS.js";import"./index-DNzgGVij.js";import"./strings-WMZYwrQD.js";import"./castArray-CoJ3z4SB.js";import"./isEqual-DQdO_K1-.js";import"./_initCloneObject-iRvJrG7M.js";import"./debounce-CEE_CsrA.js";import"./_baseIteratee-Bk7QROEW.js";import"./index-Dc0-osYE.js";import"./index-D3gVuWw7.js";import"./_baseClone-B6o0klpv.js";import"./index-C1s2diPf.js";import"./index-MlWSSchD.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-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-8df4b8a7"]]),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:B()+"/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 Be=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Oe=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Be,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(Oe,[["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")),O.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-B6L7VFNr.js";import{E as S}from"./index-7746Wyq5.js";import{E as P}from"./index-CEpvbqDt.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,f3 as R,x as r,F as V,v as T,i as y,f4 as D,f5 as F,cf as B,D as h,y as x,n as C,f6 as O,dA as M,dw as N}from"./index-BjMVMy9y.js";import{E as L,a as G}from"./index-BX6sU3GX.js";import{I as A}from"./InfoIcon-cglftkH2.js";import{E as q,a as z}from"./index-DvTCiu3P.js";import{I as X}from"./ImagePreview-D_L90Mc7.js";import{E as H}from"./index-BCo-Le3_.js";import{E as k}from"./index-ifdCUgG7.js";import{E as K}from"./index-OiDdq1JS.js";import{C as W,N as J}from"./NoTasks-B6hLJrko.js";import{a as Q}from"./price-CG10y7sa.js";import{C as Y}from"./CopyToClipboard-C_xMmtDc.js";import{I as Z}from"./ImageWrapper-Pritl6ia.js";import{E as ee}from"./index-Dagq6Y2s.js";import{E as te}from"./index-Ckr3Af0G.js";import{B as oe}from"./BotPlaceholder-BgP8q68w.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-DulF_7UO.js";import"./index-BzF_Ko5s.js";import"./typescript-DXZhO2KE.js";import"./index-B-7UQmSa.js";import"./strings-C0ATdFxF.js";import"./castArray-7tYrhn6A.js";import"./isEqual-Df5ippj8.js";import"./_initCloneObject-CwAtjxb1.js";import"./debounce-09KXX3DN.js";import"./_baseIteratee-7W3vde5j.js";import"./index-D19A578F.js";import"./index-WJgswFMW.js";import"./_baseClone-DiKhUhxc.js";import"./index-CQ2bsd-r.js";import"./index-bryRJW_X.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-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-8df4b8a7"]]),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:B()+"/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 Be=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Oe=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Be,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(Oe,[["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")),O.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 T}from"./index.es-BLCm9UT-.js";import{E as A}from"./index-Czog4o5z.js";import{E as O}from"./index-Cs65NgP9.js";import{d as g,h as k,b as l,t as r,k as t,r as R,j as m,l as s,o as a,ez as q,x as i,F as S,v as C,i as I,eA as j,D as h,eB as B,cf as z,y as $,n as P,eC as N,dA as F,dn as K,dv as H,dw as D}from"./index-CLwJbfYs.js";import{I as G}from"./InfoIcon-htaT17q9.js";import{E as J}from"./index-BU5-qzoD.js";import{E as L,a as M}from"./index-CLOiWNZO.js";import{a as Q,E as W}from"./index-DbY2GEPa.js";import{I as X}from"./ImagePreview-VnpfW9Pj.js";import{E as Y}from"./index-Colfa9sv.js";import{E as V}from"./index-CQvuK-4v.js";import{E as Z}from"./index-DHn59BRx.js";import{C as x,N as ee}from"./NoTasks-DHdI1Frr.js";import{a as te}from"./price-CZSDhLnN.js";import{C as oe}from"./CopyToClipboard-CzE5Qyes.js";import{s as se}from"./vue-plyr-QZFBikSk.js";import{E as ae}from"./index-DITqxnfk.js";import{E as ne}from"./index-DNuWNnk-.js";import{E as ie}from"./index-O2tEst1s.js";import{B as le}from"./BotPlaceholder-DKPNFbIr.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-AT7DtKgl.js";import"./index-DNzgGVij.js";import"./typescript-CoKqfRJS.js";import"./strings-WMZYwrQD.js";import"./castArray-CoJ3z4SB.js";import"./isEqual-DQdO_K1-.js";import"./_initCloneObject-iRvJrG7M.js";import"./debounce-CEE_CsrA.js";import"./_baseIteratee-Bk7QROEW.js";import"./index-Dc0-osYE.js";import"./index-D3gVuWw7.js";import"./_baseClone-B6o0klpv.js";import"./index-C1s2diPf.js";import"./index-MlWSSchD.js";const re=g({name:"LayoutPika",components:{ElDrawer:O,ElButton:A,FontAwesomeIcon:T},data(){return{drawer:!1}}}),ce={class:"main flex flex-row flex-1"},pe={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},de={class:"result h-full p-[15px] flex-1 flex flex-col"};function ue(e,o,c,d,v,b){const p=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),l("div",ce,[r("div",pe,[R(e.$slots,"config",{},void 0,!0)]),r("div",de,[R(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=y=>e.drawer=!0)},{default:m(()=>[t(p,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=y=>e.drawer=y),direction:"ltr","with-header":!1,size:"350px"},{default:m(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const me=k(re,[["render",ue],["__scopeId","data-v-80748529"]]),fe=g({name:"IngredientsSelector",components:{ElSwitch:J,InfoIcon:G},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=q)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,c,d,v,b){const p=s("el-switch"),u=s("info-icon");return a(),l("div",_e,[r("h2",he,i(e.$t("pika.name.ingredients")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value"},null,8,["modelValue"]),t(u,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const ge=k(fe,[["render",$e],["__scopeId","data-v-17c0af5c"]]),ke=g({name:"EffectSelector",components:{ElSelect:M,ElOption:L},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),ve={class:"field"},be={class:"title font-bold"},ye={class:"float-left"};function we(e,o,c,d,v,b){const p=s("el-option"),u=s("el-select");return a(),l("div",ve,[r("h2",be,i(e.$t("pika.name.effect")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),l(S,null,C(e.options,n=>(a(),I(p,{key:n.value,label:n.label,value:n.value},{default:m(()=>[r("span",ye,i(n.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ve=k(ke,[["render",we],["__scopeId","data-v-d1c54475"]]),Ie=g({name:"IngredientsModelSelector",components:{ElRadioButton:W,ElRadioGroup:Q},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=j)}}),Ee={class:"field"},Se={class:"title font-bold"};function Ce(e,o,c,d,v,b){const p=s("el-radio-button"),u=s("el-radio-group");return a(),l("div",Ee,[r("h2",Se,i(e.$t("pika.name.ingredientsModel")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),size:"small",class:"quality"},{default:m(()=>[(a(!0),l(S,null,C(e.options,n=>(a(),I(p,{key:n.value,label:n.value},{default:m(()=>[h(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Te=k(Ie,[["render",Ce],["__scopeId","data-v-b948551f"]]),Ae=g({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=B)}}),Pe={class:"field"},Ue={class:"title font-bold"};function Re(e,o,c,d,v,b){const p=s("el-option"),u=s("el-select");return a(),l("div",Pe,[r("h2",Ue,i(e.$t("pika.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),l(S,null,C(e.options,n=>(a(),I(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const De=k(Ae,[["render",Re],["__scopeId","data-v-7b2e870a"]]),Ge=g({name:"ImageUrlInput",components:{ElUpload:Y,ElButton:A,InfoIcon:G,ImagePreview:X,FontAwesomeIcon:T},data(){return{fileList:[],uploadUrl:z()+"/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.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){V.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){V.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Le={class:"field"},Me={class:"title font-bold"},Oe={class:"upload-wrapper"};function qe(e,o,c,d,v,b){const p=s("image-preview"),u=s("font-awesome-icon"),n=s("el-button"),y=s("el-upload"),_=s("info-icon");return a(),l("div",Le,[r("h2",Me,i(e.$t("pika.name.imageUrl")),1),r("div",Oe,[t(y,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:3,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:f})=>[t(p,{url:f.url||f.response?.file_url,name:f.name,percentage:f.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(f),1)},null,8,["url","name","percentage","onRemove"])]),default:m(()=>[t(n,{size:"small",type:"primary",round:""},{default:m(()=>[t(u,{icon:"fa-solid fa-upload",class:"mr-1"}),h(" "+i(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(_,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const je=k(Ge,[["render",qe],["__scopeId","data-v-18cda67a"]]),Be="",ze=g({name:"PromptInput",components:{ElInput:Z,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Be)}}),Ne={class:"field"},Fe={class:"box"},Ke={class:"title font-bold"};function He(e,o,c,d,v,b){const p=s("info-icon"),u=s("el-input");return a(),l("div",Ne,[r("div",Fe,[r("h2",Ke,i(e.$t("pika.name.prompt")),1),t(p,{content:e.$t("pika.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("pika.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Je=k(ze,[["render",He],["__scopeId","data-v-b94e7a3e"]]),Qe=g({name:"PresetPanel",components:{ImageUrlInput:je,ElButton:A,FontAwesomeIcon:T,Consumption:x,PromptInput:Je,IngredientsSelector:ge,IngredientsModelSelector:Te,ModelSelector:De,EffectSelector:Ve},emits:["generate"],computed:{config(){return this.$store.state.pika?.config},consumption(){return te(this.config,this.service?.metadata?.price)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit("generate")}}}),We={class:"flex flex-col h-full"},Xe={class:"flex-1 overflow-y-auto p-[15px]"},Ye={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ze(e,o,c,d,v,b){const p=s("prompt-input"),u=s("model-selector"),n=s("ingredients-selector"),y=s("effect-selector"),_=s("image-url-input"),f=s("ingredients-model-selector"),E=s("consumption"),w=s("font-awesome-icon"),U=s("el-button");return a(),l("div",We,[r("div",Xe,[t(p,{class:"mb-4"}),t(u,{class:"mb-4"}),t(n,{class:"mb-4"}),t(y,{class:"mb-4"}),e.config?.ingredients?(a(),I(_,{key:0,class:"mb-4"})):$("",!0),e.config?.ingredients?(a(),I(f,{key:1,class:"mb-4"})):$("",!0)]),r("div",Ye,[t(E,{value:e.consumption,service:e.service},null,8,["value","service"]),t(U,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(w,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])}const xe=k(Qe,[["render",Ze]]),et=g({name:"VideoPlayer",components:{VuePlyr:se},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),tt=["data-poster"],ot=["src"];function st(e,o,c,d,v,b){const p=s("vue-plyr");return a(),l("div",null,[t(p,{options:e.options,class:"video"},{default:m(()=>[r("video",{controls:"",crossorigin:"",playsinline:"","data-poster":e.modelValue?.image_url},[r("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,ot)],8,tt)]),_:1},8,["options"])])}const at=k(et,[["render",st],["__scopeId","data-v-fc420430"]]),nt=g({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:oe,FontAwesomeIcon:T,ElAlert:ne,VideoPlayer:at,ElTooltip:ae,ElButton:A},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(c=>{let d=c;o&&(d.action=o),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const o=e.target,c=new URL(o.src),d=c.searchParams.get("retry");if(!d)c.searchParams.set("retry","1");else if(parseInt(d)<2)c.searchParams.set("retry",(parseInt(d)+1).toString());else return;o.src=c.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),it={class:"left"},lt={class:"main"},rt={class:"bot"},ct={class:"datetime"},pt={class:"info"},dt={key:0,class:"prompt mt-2"},ut={key:0},mt={key:1},ft={key:0,class:P({content:!0,failed:!0})},_t={class:"image-wrapper"},ht={key:0,class:P({operations:!0,"mt-2":!0})},$t={key:0,class:"description"},gt={class:"description"},kt={key:1,class:P({content:!0})},vt={class:"description"},bt={class:"description"},yt={class:"description"},wt={key:2,class:P({content:!0})},Vt={class:"description"};function It(e,o,c,d,v,b){const p=s("el-image"),u=s("VideoPlayer"),n=s("el-button"),y=s("el-tooltip"),_=s("font-awesome-icon"),f=s("copy-to-clipboard"),E=s("el-alert");return a(!0),l(S,null,C(e.videos,(w,U)=>(a(),l("div",{key:U,class:"preview"},[r("div",it,[t(p,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),r("div",lt,[r("div",rt,[h(i(e.$t("pika.name.pikaBot"))+" ",1),r("span",ct,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",pt,[e.modelValue?.request?.prompt?(a(),l("p",dt,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(a(),l("span",ut," - ("+i(e.$t("pika.status.pending"))+") ",1)),w?.state==="processing"||w?.state==="pending"?(a(),l("span",mt," - ("+i(e.$t("pika.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(a(),l("div",ft,[r("div",_t,[t(u,{"model-value":w},null,8,["model-value"])]),w?(a(),l("div",ht,[t(y,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[w?.video_url?(a(),I(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:Lt=>e.onDownload(w?.video_url)},{default:m(()=>[h(i(e.$t("pika.button.download")),1)]),_:2},1032,["onClick"])):$("",!0)]),_:2},1032,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:m(()=>[e.modelValue?.request?.model?(a(),l("p",$t,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("pika.name.model"))+": "+i(e.modelValue?.request?.model),1)])):$("",!0),r("p",gt,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(f,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(a(),l("div",kt,[t(E,{closable:!1,class:"failure"},{template:m(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[r("p",vt,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(f,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",bt,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+i(e.$t("pika.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(f,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),r("p",yt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("pika.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(f,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),!e.modelValue?.response||w?.state==="processing"||w?.state==="pending"?(a(),l("div",wt,[t(E,{closable:!1,class:"info"},{template:m(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[r("p",Vt,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(f,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])]))),128)}const Et=k(nt,[["render",It],["__scopeId","data-v-4c2810f1"]]),St=g({name:"RecentPanel",components:{TaskPreview:Et,BotPlaceholder:le,NoTasks:ee},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.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")}}}),Ct={key:0},Tt={key:1,class:"tasks h-full w-full overflow-y-auto"},At={key:2,class:"w-full h-full flex items-center justify-center"};function Pt(e,o,c,d,v,b){const p=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return a(),l(S,null,[e.tasks?.items===void 0?(a(),l("div",Ct,[t(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),l("div",Tt,[(a(!0),l(S,null,C(e.tasks?.items,(y,_)=>(a(),I(u,{key:_,"model-value":y},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(a(),l("div",At,[t(n)])):$("",!0)],64)}const Ut=k(St,[["render",Pt]]),Rt="https://webhook.acedata.cloud/pika",Dt=g({name:"PikaIndex",components:{ConfigPanel:xe,Layout:me,RecentPanel:Ut},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pika?.status?.getApplications===D.Request},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===D.Request},needApply(){return this.$store.state.pika.status.getApplications===D.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.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("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){K.create({application:this.application}).then(({data:e})=>{this.application=e,V.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===H&&V.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");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:c,createdAtMax:d}=e||{};console.debug("limit",o,"createdAtMin",c,"createdAtMax",d),await this.$store.dispatch("pika/getTasks",{limit:o,createdAtMin:c,createdAtMax:d})},async onGenerate(){const e={...this.config,callback_url:Rt},o=this.credential?.token;if(!o){console.error("no token specified");return}V.info(this.$t("pika.message.startingTask")),N.generate(e,{token:o}).then(()=>{V.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(c=>{c?.response?.data?.error?.code===F?V.error(this.$t("pika.message.usedUp")):V.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Gt(e,o,c,d,v,b){const p=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),I(n,null,{config:m(()=>[t(p,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const vo=k(Dt,[["render",Gt],["__scopeId","data-v-bc973743"]]);export{vo as default};
1
+ import{F as T}from"./index.es-B6L7VFNr.js";import{E as A}from"./index-7746Wyq5.js";import{E as O}from"./index-CEpvbqDt.js";import{d as g,h as k,b as l,t as r,k as t,r as R,j as m,l as s,o as a,ez as q,x as i,F as S,v as C,i as I,eA as j,D as h,eB as B,cf as z,y as $,n as P,eC as N,dA as F,dn as K,dv as H,dw as D}from"./index-BjMVMy9y.js";import{I as G}from"./InfoIcon-cglftkH2.js";import{E as J}from"./index-CCO_ODiz.js";import{E as L,a as M}from"./index-BX6sU3GX.js";import{a as Q,E as W}from"./index-DxLDQU_A.js";import{I as X}from"./ImagePreview-D_L90Mc7.js";import{E as Y}from"./index-BCo-Le3_.js";import{E as V}from"./index-ifdCUgG7.js";import{E as Z}from"./index-OiDdq1JS.js";import{C as x,N as ee}from"./NoTasks-B6hLJrko.js";import{a as te}from"./price-CG10y7sa.js";import{C as oe}from"./CopyToClipboard-C_xMmtDc.js";import{s as se}from"./vue-plyr-QZFBikSk.js";import{E as ae}from"./index-DulF_7UO.js";import{E as ne}from"./index-Dagq6Y2s.js";import{E as ie}from"./index-Ckr3Af0G.js";import{B as le}from"./BotPlaceholder-BgP8q68w.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-BzF_Ko5s.js";import"./index-B-7UQmSa.js";import"./typescript-DXZhO2KE.js";import"./strings-C0ATdFxF.js";import"./castArray-7tYrhn6A.js";import"./isEqual-Df5ippj8.js";import"./_initCloneObject-CwAtjxb1.js";import"./debounce-09KXX3DN.js";import"./_baseIteratee-7W3vde5j.js";import"./index-D19A578F.js";import"./index-WJgswFMW.js";import"./_baseClone-DiKhUhxc.js";import"./index-CQ2bsd-r.js";import"./index-bryRJW_X.js";const re=g({name:"LayoutPika",components:{ElDrawer:O,ElButton:A,FontAwesomeIcon:T},data(){return{drawer:!1}}}),ce={class:"main flex flex-row flex-1"},pe={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},de={class:"result h-full p-[15px] flex-1 flex flex-col"};function ue(e,o,c,d,v,b){const p=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),l("div",ce,[r("div",pe,[R(e.$slots,"config",{},void 0,!0)]),r("div",de,[R(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=y=>e.drawer=!0)},{default:m(()=>[t(p,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=y=>e.drawer=y),direction:"ltr","with-header":!1,size:"350px"},{default:m(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const me=k(re,[["render",ue],["__scopeId","data-v-80748529"]]),fe=g({name:"IngredientsSelector",components:{ElSwitch:J,InfoIcon:G},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=q)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,c,d,v,b){const p=s("el-switch"),u=s("info-icon");return a(),l("div",_e,[r("h2",he,i(e.$t("pika.name.ingredients")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value"},null,8,["modelValue"]),t(u,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const ge=k(fe,[["render",$e],["__scopeId","data-v-17c0af5c"]]),ke=g({name:"EffectSelector",components:{ElSelect:M,ElOption:L},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),ve={class:"field"},be={class:"title font-bold"},ye={class:"float-left"};function we(e,o,c,d,v,b){const p=s("el-option"),u=s("el-select");return a(),l("div",ve,[r("h2",be,i(e.$t("pika.name.effect")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),l(S,null,C(e.options,n=>(a(),I(p,{key:n.value,label:n.label,value:n.value},{default:m(()=>[r("span",ye,i(n.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ve=k(ke,[["render",we],["__scopeId","data-v-d1c54475"]]),Ie=g({name:"IngredientsModelSelector",components:{ElRadioButton:W,ElRadioGroup:Q},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=j)}}),Ee={class:"field"},Se={class:"title font-bold"};function Ce(e,o,c,d,v,b){const p=s("el-radio-button"),u=s("el-radio-group");return a(),l("div",Ee,[r("h2",Se,i(e.$t("pika.name.ingredientsModel")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),size:"small",class:"quality"},{default:m(()=>[(a(!0),l(S,null,C(e.options,n=>(a(),I(p,{key:n.value,label:n.value},{default:m(()=>[h(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Te=k(Ie,[["render",Ce],["__scopeId","data-v-b948551f"]]),Ae=g({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=B)}}),Pe={class:"field"},Ue={class:"title font-bold"};function Re(e,o,c,d,v,b){const p=s("el-option"),u=s("el-select");return a(),l("div",Pe,[r("h2",Ue,i(e.$t("pika.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),l(S,null,C(e.options,n=>(a(),I(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const De=k(Ae,[["render",Re],["__scopeId","data-v-7b2e870a"]]),Ge=g({name:"ImageUrlInput",components:{ElUpload:Y,ElButton:A,InfoIcon:G,ImagePreview:X,FontAwesomeIcon:T},data(){return{fileList:[],uploadUrl:z()+"/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.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){V.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){V.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Le={class:"field"},Me={class:"title font-bold"},Oe={class:"upload-wrapper"};function qe(e,o,c,d,v,b){const p=s("image-preview"),u=s("font-awesome-icon"),n=s("el-button"),y=s("el-upload"),_=s("info-icon");return a(),l("div",Le,[r("h2",Me,i(e.$t("pika.name.imageUrl")),1),r("div",Oe,[t(y,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:3,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:f})=>[t(p,{url:f.url||f.response?.file_url,name:f.name,percentage:f.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(f),1)},null,8,["url","name","percentage","onRemove"])]),default:m(()=>[t(n,{size:"small",type:"primary",round:""},{default:m(()=>[t(u,{icon:"fa-solid fa-upload",class:"mr-1"}),h(" "+i(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(_,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const je=k(Ge,[["render",qe],["__scopeId","data-v-18cda67a"]]),Be="",ze=g({name:"PromptInput",components:{ElInput:Z,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Be)}}),Ne={class:"field"},Fe={class:"box"},Ke={class:"title font-bold"};function He(e,o,c,d,v,b){const p=s("info-icon"),u=s("el-input");return a(),l("div",Ne,[r("div",Fe,[r("h2",Ke,i(e.$t("pika.name.prompt")),1),t(p,{content:e.$t("pika.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("pika.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Je=k(ze,[["render",He],["__scopeId","data-v-b94e7a3e"]]),Qe=g({name:"PresetPanel",components:{ImageUrlInput:je,ElButton:A,FontAwesomeIcon:T,Consumption:x,PromptInput:Je,IngredientsSelector:ge,IngredientsModelSelector:Te,ModelSelector:De,EffectSelector:Ve},emits:["generate"],computed:{config(){return this.$store.state.pika?.config},consumption(){return te(this.config,this.service?.metadata?.price)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit("generate")}}}),We={class:"flex flex-col h-full"},Xe={class:"flex-1 overflow-y-auto p-[15px]"},Ye={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Ze(e,o,c,d,v,b){const p=s("prompt-input"),u=s("model-selector"),n=s("ingredients-selector"),y=s("effect-selector"),_=s("image-url-input"),f=s("ingredients-model-selector"),E=s("consumption"),w=s("font-awesome-icon"),U=s("el-button");return a(),l("div",We,[r("div",Xe,[t(p,{class:"mb-4"}),t(u,{class:"mb-4"}),t(n,{class:"mb-4"}),t(y,{class:"mb-4"}),e.config?.ingredients?(a(),I(_,{key:0,class:"mb-4"})):$("",!0),e.config?.ingredients?(a(),I(f,{key:1,class:"mb-4"})):$("",!0)]),r("div",Ye,[t(E,{value:e.consumption,service:e.service},null,8,["value","service"]),t(U,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(w,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])}const xe=k(Qe,[["render",Ze]]),et=g({name:"VideoPlayer",components:{VuePlyr:se},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),tt=["data-poster"],ot=["src"];function st(e,o,c,d,v,b){const p=s("vue-plyr");return a(),l("div",null,[t(p,{options:e.options,class:"video"},{default:m(()=>[r("video",{controls:"",crossorigin:"",playsinline:"","data-poster":e.modelValue?.image_url},[r("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,ot)],8,tt)]),_:1},8,["options"])])}const at=k(et,[["render",st],["__scopeId","data-v-fc420430"]]),nt=g({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:oe,FontAwesomeIcon:T,ElAlert:ne,VideoPlayer:at,ElTooltip:ae,ElButton:A},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(c=>{let d=c;o&&(d.action=o),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const o=e.target,c=new URL(o.src),d=c.searchParams.get("retry");if(!d)c.searchParams.set("retry","1");else if(parseInt(d)<2)c.searchParams.set("retry",(parseInt(d)+1).toString());else return;o.src=c.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),it={class:"left"},lt={class:"main"},rt={class:"bot"},ct={class:"datetime"},pt={class:"info"},dt={key:0,class:"prompt mt-2"},ut={key:0},mt={key:1},ft={key:0,class:P({content:!0,failed:!0})},_t={class:"image-wrapper"},ht={key:0,class:P({operations:!0,"mt-2":!0})},$t={key:0,class:"description"},gt={class:"description"},kt={key:1,class:P({content:!0})},vt={class:"description"},bt={class:"description"},yt={class:"description"},wt={key:2,class:P({content:!0})},Vt={class:"description"};function It(e,o,c,d,v,b){const p=s("el-image"),u=s("VideoPlayer"),n=s("el-button"),y=s("el-tooltip"),_=s("font-awesome-icon"),f=s("copy-to-clipboard"),E=s("el-alert");return a(!0),l(S,null,C(e.videos,(w,U)=>(a(),l("div",{key:U,class:"preview"},[r("div",it,[t(p,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),r("div",lt,[r("div",rt,[h(i(e.$t("pika.name.pikaBot"))+" ",1),r("span",ct,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",pt,[e.modelValue?.request?.prompt?(a(),l("p",dt,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(a(),l("span",ut," - ("+i(e.$t("pika.status.pending"))+") ",1)),w?.state==="processing"||w?.state==="pending"?(a(),l("span",mt," - ("+i(e.$t("pika.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(a(),l("div",ft,[r("div",_t,[t(u,{"model-value":w},null,8,["model-value"])]),w?(a(),l("div",ht,[t(y,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[w?.video_url?(a(),I(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:Lt=>e.onDownload(w?.video_url)},{default:m(()=>[h(i(e.$t("pika.button.download")),1)]),_:2},1032,["onClick"])):$("",!0)]),_:2},1032,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:m(()=>[e.modelValue?.request?.model?(a(),l("p",$t,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("pika.name.model"))+": "+i(e.modelValue?.request?.model),1)])):$("",!0),r("p",gt,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(f,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(a(),l("div",kt,[t(E,{closable:!1,class:"failure"},{template:m(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[r("p",vt,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(f,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),r("p",bt,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+i(e.$t("pika.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(f,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),r("p",yt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("pika.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(f,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0),!e.modelValue?.response||w?.state==="processing"||w?.state==="pending"?(a(),l("div",wt,[t(E,{closable:!1,class:"info"},{template:m(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[r("p",Vt,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(f,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):$("",!0)])]))),128)}const Et=k(nt,[["render",It],["__scopeId","data-v-4c2810f1"]]),St=g({name:"RecentPanel",components:{TaskPreview:Et,BotPlaceholder:le,NoTasks:ee},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.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")}}}),Ct={key:0},Tt={key:1,class:"tasks h-full w-full overflow-y-auto"},At={key:2,class:"w-full h-full flex items-center justify-center"};function Pt(e,o,c,d,v,b){const p=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return a(),l(S,null,[e.tasks?.items===void 0?(a(),l("div",Ct,[t(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),l("div",Tt,[(a(!0),l(S,null,C(e.tasks?.items,(y,_)=>(a(),I(u,{key:_,"model-value":y},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(a(),l("div",At,[t(n)])):$("",!0)],64)}const Ut=k(St,[["render",Pt]]),Rt="https://webhook.acedata.cloud/pika",Dt=g({name:"PikaIndex",components:{ConfigPanel:xe,Layout:me,RecentPanel:Ut},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pika?.status?.getApplications===D.Request},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===D.Request},needApply(){return this.$store.state.pika.status.getApplications===D.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.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("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){K.create({application:this.application}).then(({data:e})=>{this.application=e,V.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===H&&V.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");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:c,createdAtMax:d}=e||{};console.debug("limit",o,"createdAtMin",c,"createdAtMax",d),await this.$store.dispatch("pika/getTasks",{limit:o,createdAtMin:c,createdAtMax:d})},async onGenerate(){const e={...this.config,callback_url:Rt},o=this.credential?.token;if(!o){console.error("no token specified");return}V.info(this.$t("pika.message.startingTask")),N.generate(e,{token:o}).then(()=>{V.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(c=>{c?.response?.data?.error?.code===F?V.error(this.$t("pika.message.usedUp")):V.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Gt(e,o,c,d,v,b){const p=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),I(n,null,{config:m(()=>[t(p,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const vo=k(Dt,[["render",Gt],["__scopeId","data-v-bc973743"]]);export{vo as default};
@@ -1 +1 @@
1
- import{F as G}from"./index.es-BLCm9UT-.js";import{E as R}from"./index-Czog4o5z.js";import{E as M}from"./index-Cs65NgP9.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,eJ as z,x as a,F as C,v as U,i as y,eK as N,eL as q,eM as H,n as T,f as J,y as f,cf as K,D as h,J as E,K as S,eN as Q,dA as W,dw as X}from"./index-CLwJbfYs.js";import{E as D,a as O}from"./index-CLOiWNZO.js";import{I as j}from"./InfoIcon-htaT17q9.js";import{E as Y}from"./index-BU5-qzoD.js";import{V as P}from"./VideoPlayer-DCap_X2q.js";import{I as Z}from"./ImagePreview-VnpfW9Pj.js";import{E as x}from"./index-Colfa9sv.js";import{E as I}from"./index-CQvuK-4v.js";import{C as ee,N as te}from"./NoTasks-DHdI1Frr.js";import{E as oe}from"./index-DHn59BRx.js";import{a as se}from"./price-CZSDhLnN.js";import{C as ne}from"./CopyToClipboard-CzE5Qyes.js";import{E as ae}from"./index-DITqxnfk.js";import{E as le}from"./index-DNuWNnk-.js";import{E as ie}from"./index-O2tEst1s.js";import{B as re}from"./BotPlaceholder-DKPNFbIr.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-DNzgGVij.js";import"./typescript-CoKqfRJS.js";import"./index-AT7DtKgl.js";import"./strings-WMZYwrQD.js";import"./castArray-CoJ3z4SB.js";import"./isEqual-DQdO_K1-.js";import"./_initCloneObject-iRvJrG7M.js";import"./debounce-CEE_CsrA.js";import"./_baseIteratee-Bk7QROEW.js";import"./index-Dc0-osYE.js";import"./vue-plyr-QZFBikSk.js";import"./index-D3gVuWw7.js";import"./_baseClone-B6o0klpv.js";import"./index-C1s2diPf.js";import"./index-MlWSSchD.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:M,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=z)}}),_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(C,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=N)}}),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(C,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=q)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ae={class:"flex justify-start items-center"},Ce={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",Ae,[l("span",Ce,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(C,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"]]),Me=$({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}}}),ze={class:"relative"},Ne={class:"flex mb-2"},qe={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",ze,[l("div",Ne,[l("span",qe,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(Me,[["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"),A=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(A,{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})},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={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]=A=>e.onGet1080p(A,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]=A=>e.onDownload(A,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",At,[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",Ct,[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 Mt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(C,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(C,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 zt=g(Ot,[["render",Mt]]),Nt="https://webhook.acedata.cloud/veo",qt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:zt},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:Nt},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 Ao=g(qt,[["render",Ht]]);export{Ao as default};
1
+ import{F as G}from"./index.es-B6L7VFNr.js";import{E as R}from"./index-7746Wyq5.js";import{E as M}from"./index-CEpvbqDt.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,eJ as z,x as a,F as C,v as U,i as y,eK as N,eL as q,eM as H,n as T,f as J,y as f,cf as K,D as h,J as E,K as S,eN as Q,dA as W,dw as X}from"./index-BjMVMy9y.js";import{E as D,a as O}from"./index-BX6sU3GX.js";import{I as j}from"./InfoIcon-cglftkH2.js";import{E as Y}from"./index-CCO_ODiz.js";import{V as P}from"./VideoPlayer-CjCdW8Fe.js";import{I as Z}from"./ImagePreview-D_L90Mc7.js";import{E as x}from"./index-BCo-Le3_.js";import{E as I}from"./index-ifdCUgG7.js";import{C as ee,N as te}from"./NoTasks-B6hLJrko.js";import{E as oe}from"./index-OiDdq1JS.js";import{a as se}from"./price-CG10y7sa.js";import{C as ne}from"./CopyToClipboard-C_xMmtDc.js";import{E as ae}from"./index-DulF_7UO.js";import{E as le}from"./index-Dagq6Y2s.js";import{E as ie}from"./index-Ckr3Af0G.js";import{B as re}from"./BotPlaceholder-BgP8q68w.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-B-7UQmSa.js";import"./typescript-DXZhO2KE.js";import"./index-BzF_Ko5s.js";import"./strings-C0ATdFxF.js";import"./castArray-7tYrhn6A.js";import"./isEqual-Df5ippj8.js";import"./_initCloneObject-CwAtjxb1.js";import"./debounce-09KXX3DN.js";import"./_baseIteratee-7W3vde5j.js";import"./index-D19A578F.js";import"./vue-plyr-QZFBikSk.js";import"./index-WJgswFMW.js";import"./_baseClone-DiKhUhxc.js";import"./index-CQ2bsd-r.js";import"./index-bryRJW_X.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:M,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=z)}}),_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(C,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=N)}}),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(C,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=q)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ae={class:"flex justify-start items-center"},Ce={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",Ae,[l("span",Ce,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(C,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"]]),Me=$({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}}}),ze={class:"relative"},Ne={class:"flex mb-2"},qe={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",ze,[l("div",Ne,[l("span",qe,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(Me,[["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"),A=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(A,{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})},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={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]=A=>e.onGet1080p(A,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]=A=>e.onDownload(A,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",At,[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",Ct,[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 Mt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(C,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(C,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 zt=g(Ot,[["render",Mt]]),Nt="https://webhook.acedata.cloud/veo",qt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:zt},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:Nt},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 Ao=g(qt,[["render",Ht]]);export{Ao as default};