@acedatacloud/nexior 3.5.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Auth.a21ceb87.js → Auth.7e6f4111.js} +1 -1
- package/dist/assets/{Callback.9d1efb14.js → Callback.cb45a84d.js} +1 -1
- package/dist/assets/{Console.df0a185d.js → Console.e3aac631.js} +1 -1
- package/dist/assets/Conversation.66d77b99.css +1 -0
- package/dist/assets/Conversation.7c9f3730.js +1 -0
- package/dist/assets/{CopyToClipboard.b1fffe0f.js → CopyToClipboard.3752e201.js} +1 -1
- package/dist/assets/{Detail.736ab7b3.js → Detail.3f01ee17.js} +1 -1
- package/dist/assets/{EditArray.5990f3dd.js → EditArray.5391fc09.js} +1 -1
- package/dist/assets/{Extra.1d16a1af.js → Extra.5477a502.js} +1 -1
- package/dist/assets/{History.f131fc4f.js → History.d047803b.js} +1 -1
- package/dist/assets/{ImagePreview.33ef2f8c.js → ImagePreview.65bc0654.js} +1 -1
- package/dist/assets/{Index.5154ecc9.js → Index.17dc01b1.js} +1 -1
- package/dist/assets/{Index.47136fa2.js → Index.2e3d5c82.js} +1 -1
- package/dist/assets/Index.33f3dfb6.js +1 -0
- package/dist/assets/{Index.c0c9d360.js → Index.4529fd48.js} +1 -1
- package/dist/assets/{Index.8b79d6c4.js → Index.50ba380b.js} +2 -2
- package/dist/assets/{Index.4656fc30.js → Index.5e76681e.js} +1 -1
- package/dist/assets/{Index.d5bb6b0a.js → Index.6e057f69.js} +1 -1
- package/dist/assets/Index.8675ada1.js +1 -0
- package/dist/assets/{Index.61a1ecec.js → Index.bb85723a.js} +1 -1
- package/dist/assets/{Index.5774625e.js → Index.c0e93ce4.js} +1 -1
- package/dist/assets/{Index.bff92738.js → Index.ea29dd1e.js} +1 -1
- package/dist/assets/{Index.b736a93b.js → Index.f0f74bae.js} +1 -1
- package/dist/assets/{InfoIcon.523bd2db.js → InfoIcon.b3285074.js} +1 -1
- package/dist/assets/{Invitees.ecb943e1.js → Invitees.554ecb8a.js} +1 -1
- package/dist/assets/{List.3ac2eda7.js → List.72564a10.js} +1 -1
- package/dist/assets/{List.876b0dcd.js → List.cadae838.js} +1 -1
- package/dist/assets/{List.76b1ee8d.js → List.edcf37b7.js} +1 -1
- package/dist/assets/{Login.287bed07.js → Login.cb819cb0.js} +1 -1
- package/dist/assets/{Main.6c3eb960.js → Main.d6712532.js} +1 -1
- package/dist/assets/{Navigator.d336ddf5.js → Navigator.fb908eb8.js} +1 -1
- package/dist/assets/{Pagination.4a82380d.js → Pagination.87c48fec.js} +1 -1
- package/dist/assets/Status.5419f090.js +1 -0
- package/dist/assets/Subscribe.d0a01233.js +1 -0
- package/dist/assets/{common.5be6d835.js → common.fd9e9fef.js} +1 -1
- package/dist/assets/{distribution.39db3da4.js → distribution.fade0158.js} +1 -1
- package/dist/assets/index.bb8f1411.js +2 -0
- package/dist/assets/{order.b1edf3c0.js → order.ac0ff18c.js} +1 -1
- package/dist/assets/{price.1b4f3d3e.js → price.68957c74.js} +1 -1
- package/dist/assets/{vendor-@vue.6c0309d3.js → vendor-@vue.38e80b4c.js} +1 -1
- package/dist/assets/{vendor-element-plus.1fa87efb.js → vendor-element-plus.0d60bec3.js} +5 -5
- package/dist/assets/{vendor-fortawesome.2b54ad1b.js → vendor-fortawesome.20479da6.js} +1 -1
- package/dist/assets/{vendor-markdown.cf3e96ae.js → vendor-markdown.b359a0a8.js} +1 -1
- package/dist/assets/{vendor-others.cdfefb59.js → vendor-others.4ac6d265.js} +1 -1
- package/dist/assets/{vendor-qrcode.6ab44f81.js → vendor-qrcode.60b22bc6.js} +1 -1
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/Chatdoc.273c3eed.js +0 -1
- package/dist/assets/Chatdoc.b833a665.css +0 -1
- package/dist/assets/Conversation.5b91179b.js +0 -1
- package/dist/assets/Conversation.61f3cac0.js +0 -1
- package/dist/assets/Conversation.65fed89e.css +0 -1
- package/dist/assets/Conversation.c2ebf796.css +0 -1
- package/dist/assets/Index.14d54260.js +0 -1
- package/dist/assets/Index.877f522f.css +0 -1
- package/dist/assets/Index.a7bd4a7b.js +0 -1
- package/dist/assets/Index.aecfea0c.js +0 -1
- package/dist/assets/Manage.07d2ae70.css +0 -1
- package/dist/assets/Manage.e9a1fd37.js +0 -1
- package/dist/assets/MarkdownRenderer.31aa9b9c.js +0 -1
- package/dist/assets/MarkdownRenderer.f404d95c.css +0 -1
- package/dist/assets/Setting.7c0a47a4.js +0 -1
- package/dist/assets/Status.68f53ef7.js +0 -1
- package/dist/assets/Subscribe.15409729.js +0 -1
- package/dist/assets/chatdoc.26e34f62.js +0 -1
- package/dist/assets/chatdoc.369240c0.js +0 -1
- package/dist/assets/chatdoc.38093bef.js +0 -1
- package/dist/assets/chatdoc.4963b715.js +0 -1
- package/dist/assets/chatdoc.5968870d.js +0 -1
- package/dist/assets/chatdoc.6e05604b.js +0 -1
- package/dist/assets/chatdoc.6f26a6c3.js +0 -1
- package/dist/assets/chatdoc.82bb469d.js +0 -1
- package/dist/assets/chatdoc.8b1244bd.js +0 -1
- package/dist/assets/chatdoc.a330c226.js +0 -1
- package/dist/assets/chatdoc.a7a590fd.js +0 -1
- package/dist/assets/chatdoc.be4f6cf9.js +0 -1
- package/dist/assets/chatdoc.c9102d6b.js +0 -1
- package/dist/assets/chatdoc.c99b8fc5.js +0 -1
- package/dist/assets/chatdoc.cb5d28e1.js +0 -1
- package/dist/assets/chatdoc.d6fa331d.js +0 -1
- package/dist/assets/chatdoc.e6a3302d.js +0 -1
- package/dist/assets/chatdoc.eb31a140.js +0 -1
- package/dist/assets/index.f9e15558.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-others.cdfefb59.js";import{ar as j}from"./vendor-fortawesome.2b54ad1b.js";import{_ as w,D as ne,N as L,J as ie,P as le,aY as re,a1 as ce}from"./index.f9e15558.js";import{T as de,u as O,x as pe,y as T,M as me,L as ue,W as he,X as _e,m as oe,I as ge,H as fe,R as ve}from"./vendor-element-plus.1fa87efb.js";import{H as I,al as r,o,e as c,f as p,I as M,V as t,M as u,T as l,S as $,U as P,ai as E,L as D,R as g,P as R,m as $e}from"./vendor-@vue.6c0309d3.js";import{I as ye}from"./InfoIcon.523bd2db.js";import{A as be}from"./Status.68f53ef7.js";import{C as ke}from"./CopyToClipboard.b1fffe0f.js";import"./vendor-markdown.cf3e96ae.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.6ab44f81.js";const we=I({name:"LayoutHeadshots",components:{ElDrawer:de,ElButton:O,FontAwesomeIcon:j},data(){return{drawer:!1}}}),Ie={class:"main"},Se={class:"config"},Te={class:"result"};function Ve(e,s,a,n,_,f){const d=r("font-awesome-icon"),h=r("el-button"),i=r("el-drawer");return o(),c("div",Ie,[p("div",Se,[M(e.$slots,"config",{},void 0,!0)]),p("div",Te,[M(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:s[0]||(s[0]=m=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=m=>e.drawer=m),"with-header":!1,size:"340px",class:"drawer"},{default:u(()=>[M(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ce=w(we,[["render",Ve],["__scopeId","data-v-3e896eaa"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Headshots.vue"]]);const Pe=I({name:"ImageUrlsInput",components:{ElUpload:pe,ElButton:O,InfoIcon:ye},data(){return{fileList:[],uploadUrl:ne()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var s;return(s=e==null?void 0:e.response)==null?void 0:s.file_url})},value:{get(){var e,s;return(s=(e=this.$store.state.headshots)==null?void 0:e.config)==null?void 0:s.image_urls},set(e){var a;const s=this.urls;this.$store.commit("headshots/setConfig",{...(a=this.$store.state.headshots)==null?void 0:a.config,image_urls:s})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){T.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){T.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){var s;const e=this.urls;this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),Ee={class:"field"},Ae={class:"title font-bold"},Ge={class:"upload-wrapper"};function Ne(e,s,a,n,_,f){const d=r("el-button"),h=r("el-upload"),i=r("info-icon");return o(),c("div",Ee,[p("h2",Ae,l(e.$t("headshots.name.endImageUrls")),1),p("div",Ge,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=m=>e.fileList=m),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:u(()=>[t(d,{size:"small",type:"primary",round:""},{default:u(()=>[$(l(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(i,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}var Re=w(Pe,[["render",Ne],["__scopeId","data-v-69ae8722"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ImageUrlsInput.vue"]]);const Ue="fast",De=I({name:"ModeSelector",components:{ElRadioButton:me,ElRadioGroup:ue},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){var e;return(e=this.$store.state.headshots.config)==null?void 0:e.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=Ue)}}),Le={class:"field"},Me={class:"title font-bold"};function je(e,s,a,n,_,f){const d=r("el-radio-button"),h=r("el-radio-group");return o(),c("div",Le,[p("h2",Me,l(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=i=>e.value=i),size:"small",class:"mode"},{default:u(()=>[(o(!0),c(P,null,E(e.options,i=>(o(),D(d,{key:i.value,label:i.value},{default:u(()=>[$(l(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}var Oe=w(De,[["render",je],["__scopeId","data-v-5ec8e3d9"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ModeSelector.vue"]]);const ze=I({name:"StylizeSelector",components:{ElTabs:he,ElTabPane:_e,ElImage:oe},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){var s;console.debug("set template",e),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:e})}},mounted(){var e;this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(e=this.$store.state.headshots)==null?void 0:e.config,template:this.value})},methods:{onToggle(e){var s;this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:this.value})}}}),Be={class:"field"},He=["onClick"],qe={class:"name"};function Fe(e,s,a,n,_,f){const d=r("el-image"),h=r("el-tab-pane"),i=r("el-tabs");return o(),c("div",Be,[g(` <h2 class="title">{{ $t('headshots.field.elements') }}</h2> `),t(i,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=m=>e.tab=m)},{default:u(()=>[(o(!0),c(P,null,E(e.elements,(m,v)=>(o(),D(h,{key:v,label:m.displayName,name:v,class:"pane"},{default:u(()=>[(o(!0),c(P,null,E(m.items,(k,V)=>(o(),c("div",{key:V,class:R({item:!0,active:e.value===k.value}),onClick:C=>e.onToggle(k.value)},[t(d,{src:k.image,fit:"fill",class:"preview"},null,8,["src"]),p("span",qe,l(k.label),1)],10,He))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}var Je=w(ze,[["render",Fe],["__scopeId","data-v-7e0125ad"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ElementsSelector.vue"]]);const We=I({name:"PresetPanel",components:{ModeSelector:Oe,ImageUrlsInput:Re,ElButton:O,FontAwesomeIcon:j,ElementsSelector:Je},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Xe={class:"panel"},Ye={class:"config"},Ke={class:"actions"};function Qe(e,s,a,n,_,f){const d=r("elements-selector"),h=r("mode-selector"),i=r("image-urls-input"),m=r("font-awesome-icon"),v=r("el-button");return o(),c("div",Xe,[p("div",Ye,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(i,{class:"mb-4"}),p("div",Ke,[t(v,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(m,{icon:"fa-solid fa-magic",class:"mr-2"}),$(" "+l(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}var Ze=w(We,[["render",Qe],["__scopeId","data-v-6a264fac"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ConfigPanel.vue"]]);const xe=I({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:$e(()=>{var n,_,f;return((f=(_=(n=e.modelValue)==null?void 0:n.response)==null?void 0:_.data)==null?void 0:f.slice(0,2))||[]}),viewImage:n=>{window.open(n,"_blank")}}}}),es={class:"image-gallery"},ss=["src"],ts=["onClick"];function as(e,s,a,n,_,f){return o(),c("div",es,[(o(!0),c(P,null,E(e.images,(d,h)=>(o(),c("div",{key:h,class:"image-container"},[p("img",{src:d.image_url,alt:"Image"},null,8,ss),d.image_url?(o(),c("button",{key:0,class:"view-button",onClick:i=>e.viewImage(d.image_url)},l(e.$t("headshots.button.viewImage")),9,ts)):g("v-if",!0)]))),128))])}var os=w(xe,[["render",as],["__scopeId","data-v-0187109d"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ImageGallery.vue"]]);const ns=I({name:"TaskPreview",components:{ElImage:oe,CopyToClipboard:ke,FontAwesomeIcon:j,ElAlert:ge,ImageGallery:os},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.headshots)==null?void 0:e.application},config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,a=new URL(s.src),n=a.searchParams.get("retry");if(!n)a.searchParams.set("retry","1");else if(parseInt(n)<2)a.searchParams.set("retry",(parseInt(n)+1).toString());else return;s.src=a.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),is={class:"preview"},ls={class:"left"},rs={class:"main"},cs={class:"bot"},ds={class:"datetime"},ps={class:"info"},ms={key:0,class:"prompt mt-2"},us={key:0},hs={key:1},_s={key:0,class:R({content:!0,failed:!0})},gs={class:"image-wrapper"},fs={class:"description"},vs={key:1,class:R({content:!0})},$s={class:"description"},ys={class:"description"},bs={class:"description"},ks={key:2,class:R({content:!0})},ws={class:"description"},Is={key:3,class:R({content:!0})},Ss={class:"description"};function Ts(e,s,a,n,_,f){var k,V,C,A,G,N,S,U,z,B,H,q,F,J,W;const d=r("el-image"),h=r("image-gallery"),i=r("font-awesome-icon"),m=r("copy-to-clipboard"),v=r("el-alert");return o(),c("div",is,[p("div",ls,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),p("div",rs,[p("div",cs,[$(l(e.$t("headshots.name.headshotsBot"))+" ",1),p("span",ds,l(e.$dayjs.format(""+new Date(parseFloat(((k=e.modelValue)==null?void 0:k.created_at)||"")*1e3))),1)]),p("div",ps,[(C=(V=e.modelValue)==null?void 0:V.request)!=null&&C.template?(o(),c("p",ms,[$(l((G=(A=e.modelValue)==null?void 0:A.request)==null?void 0:G.template)+" ",1),(N=e.modelValue)!=null&&N.response?g("v-if",!0):(o(),c("span",us," - ("+l(e.$t("headshots.status.pending"))+") ",1)),((U=(S=e.modelValue)==null?void 0:S.response)==null?void 0:U.status)==="unknown"?(o(),c("span",hs," - ("+l(e.$t("headshots.status.processing"))+") ",1)):g("v-if",!0)])):g("v-if",!0)]),g(" Display success message "),((B=(z=e.modelValue)==null?void 0:z.response)==null?void 0:B.success)===!0?(o(),c("div",_s,[p("div",gs,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(v,{closable:!1,class:"mt-2 success"},{default:u(()=>{var y,b;return[p("p",fs,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),((q=(H=e.modelValue)==null?void 0:H.response)==null?void 0:q.success)===!1?(o(),c("div",vs,[t(v,{closable:!1,class:"failure"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b,X,Y,K,Q,Z,x,ee,se,te,ae;return[p("p",$s,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])]),p("p",ys,[t(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failureReason"))+": "+l((K=(Y=(X=e.modelValue)==null?void 0:X.response)==null?void 0:Y.error)==null?void 0:K.message)+" ",1),t(m,{content:(x=(Z=(Q=e.modelValue)==null?void 0:Q.response)==null?void 0:Z.error)==null?void 0:x.message,class:"btn-copy"},null,8,["content"])]),p("p",bs,[t(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),$(" "+l(e.$t("headshots.name.traceId"))+": "+l((se=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:se.trace_id)+" ",1),t(m,{content:(ae=(te=e.modelValue)==null?void 0:te.response)==null?void 0:ae.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),(F=e.modelValue)!=null&&F.response?g("v-if",!0):(o(),c("div",ks,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",ws,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])),((W=(J=e.modelValue)==null?void 0:J.response)==null?void 0:W.status)==="unknown"?(o(),c("div",Is,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",Ss,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0)])])}var Vs=w(ns,[["render",Ts],["__scopeId","data-v-43e1feb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/task/Preview.vue"]]);const Cs=I({name:"RecentPanel",components:{TaskPreview:Vs,ElSkeleton:fe,ElSkeletonItem:ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,s,a,n;return{...(e=this.$store.state.headshots)==null?void 0:e.tasks,items:(n=(a=(s=this.$store.state.headshots)==null?void 0:s.tasks)==null?void 0:a.items)==null?void 0:n.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ps={key:0,class:"tasks"},Es={class:"left"},As={class:"main"},Gs={key:1,class:"tasks"},Ns={key:2,class:"description"};function Rs(e,s,a,n,_,f){var m,v,k,V,C,A,G,N;const d=r("el-skeleton-item"),h=r("el-skeleton"),i=r("task-preview");return o(),c("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...S)=>e.onHandleScroll&&e.onHandleScroll(...S))},[((m=e.tasks)==null?void 0:m.items)===void 0?(o(),c("div",Ps,[(o(),c(P,null,E(3,S=>p("div",{key:S,class:"task placeholder"},[p("div",Es,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),p("div",As,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):((k=(v=e.tasks)==null?void 0:v.items)==null?void 0:k.length)&&((C=(V=e.tasks)==null?void 0:V.items)==null?void 0:C.length)>0?(o(),c("div",Gs,[(o(!0),c(P,null,E((A=e.tasks)==null?void 0:A.items,(S,U)=>(o(),D(i,{key:U,"model-value":S,class:"preview"},null,8,["model-value"]))),128))])):g("v-if",!0),((N=(G=e.tasks)==null?void 0:G.items)==null?void 0:N.length)===0?(o(),c("p",Ns,l(e.$t("headshots.message.noTasks")),1)):g("v-if",!0)],544)}var Us=w(Cs,[["render",Rs],["__scopeId","data-v-37920e9a"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/RecentPanel.vue"]]);const Ds="https://webhook.acedata.cloud/headshots",Ls=I({name:"HeadshotsIndex",components:{ConfigPanel:Ze,Layout:Ce,ApplicationStatus:be,RecentPanel:Us},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,s;return((s=(e=this.$store.state.headshots)==null?void 0:e.status)==null?void 0:s.getApplications)===L.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===L.Request},needApply(){return this.$store.state.headshots.status.getApplications===L.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){var a,n;((a=e==null?void 0:e.items)==null?void 0:a.length)>((n=s==null?void 0:s.items)==null?void 0:n.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,s,a;console.debug("reached top"),await this.onGetTasks({createdAtMax:(a=(s=(e=this.tasks)==null?void 0:e.items)==null?void 0:s[0])==null?void 0:a.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){ie.create({application:this.application}).then(({data:e})=>{this.application=e,T.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var s,a;((a=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:a.code)===le&&T.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:s=5,createdAtMin:a,createdAtMax:n}=e||{};console.debug("limit",s,"createdAtMin",a,"createdAtMax",n),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:a,createdAtMax:n})},async onGeneratePicture(){var a;const e={...this.config,callback_url:Ds},s=(a=this.credential)==null?void 0:a.token;if(!s){console.error("no token specified");return}T.info(this.$t("headshots.message.startingTask")),re.generate(e,{token:s}).then(()=>{T.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(n=>{var f,d;const _=(f=n==null?void 0:n.response)==null?void 0:f.data;((d=_==null?void 0:_.error)==null?void 0:d.code)===ce?T.error(this.$t("headshots.message.usedUp")):T.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ms(e,s,a,n,_,f){const d=r("config-panel"),h=r("application-status"),i=r("recent-panel"),m=r("layout");return o(),D(m,null,{config:u(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:u(()=>[t(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=v=>e.$store.dispatch("headshots/setApplication",v))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(i,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),g(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var Ks=w(Ls,[["render",Ms],["__scopeId","data-v-62da1b28"],["__file","/home/runner/work/Nexior/Nexior/src/pages/headshots/Index.vue"]]);export{Ks as default};
|
|
1
|
+
import"./vendor-others.4ac6d265.js";import{ar as j}from"./vendor-fortawesome.20479da6.js";import{_ as w,D as ne,N as L,J as ie,P as le,aT as re,a2 as ce}from"./index.bb8f1411.js";import{T as de,u as O,x as pe,y as T,M as me,L as ue,W as he,X as _e,m as oe,I as ge,H as fe,R as ve}from"./vendor-element-plus.0d60bec3.js";import{H as I,al as r,o,e as c,f as p,I as M,V as t,M as u,T as l,S as $,U as P,ai as E,L as D,R as g,P as R,m as $e}from"./vendor-@vue.38e80b4c.js";import{I as ye}from"./InfoIcon.b3285074.js";import{A as be}from"./Status.5419f090.js";import{C as ke}from"./CopyToClipboard.3752e201.js";import"./vendor-markdown.b359a0a8.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.60b22bc6.js";const we=I({name:"LayoutHeadshots",components:{ElDrawer:de,ElButton:O,FontAwesomeIcon:j},data(){return{drawer:!1}}}),Ie={class:"main"},Se={class:"config"},Te={class:"result"};function Ve(e,s,a,n,_,f){const d=r("font-awesome-icon"),h=r("el-button"),i=r("el-drawer");return o(),c("div",Ie,[p("div",Se,[M(e.$slots,"config",{},void 0,!0)]),p("div",Te,[M(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:s[0]||(s[0]=m=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=m=>e.drawer=m),"with-header":!1,size:"340px",class:"drawer"},{default:u(()=>[M(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ce=w(we,[["render",Ve],["__scopeId","data-v-3e896eaa"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Headshots.vue"]]);const Pe=I({name:"ImageUrlsInput",components:{ElUpload:pe,ElButton:O,InfoIcon:ye},data(){return{fileList:[],uploadUrl:ne()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var s;return(s=e==null?void 0:e.response)==null?void 0:s.file_url})},value:{get(){var e,s;return(s=(e=this.$store.state.headshots)==null?void 0:e.config)==null?void 0:s.image_urls},set(e){var a;const s=this.urls;this.$store.commit("headshots/setConfig",{...(a=this.$store.state.headshots)==null?void 0:a.config,image_urls:s})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){T.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){T.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){var s;const e=this.urls;this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),Ee={class:"field"},Ae={class:"title font-bold"},Ge={class:"upload-wrapper"};function Ne(e,s,a,n,_,f){const d=r("el-button"),h=r("el-upload"),i=r("info-icon");return o(),c("div",Ee,[p("h2",Ae,l(e.$t("headshots.name.endImageUrls")),1),p("div",Ge,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=m=>e.fileList=m),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:u(()=>[t(d,{size:"small",type:"primary",round:""},{default:u(()=>[$(l(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(i,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}var Re=w(Pe,[["render",Ne],["__scopeId","data-v-69ae8722"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ImageUrlsInput.vue"]]);const Ue="fast",De=I({name:"ModeSelector",components:{ElRadioButton:me,ElRadioGroup:ue},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){var e;return(e=this.$store.state.headshots.config)==null?void 0:e.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=Ue)}}),Le={class:"field"},Me={class:"title font-bold"};function je(e,s,a,n,_,f){const d=r("el-radio-button"),h=r("el-radio-group");return o(),c("div",Le,[p("h2",Me,l(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=i=>e.value=i),size:"small",class:"mode"},{default:u(()=>[(o(!0),c(P,null,E(e.options,i=>(o(),D(d,{key:i.value,label:i.value},{default:u(()=>[$(l(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}var Oe=w(De,[["render",je],["__scopeId","data-v-5ec8e3d9"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ModeSelector.vue"]]);const ze=I({name:"StylizeSelector",components:{ElTabs:he,ElTabPane:_e,ElImage:oe},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){var s;console.debug("set template",e),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:e})}},mounted(){var e;this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(e=this.$store.state.headshots)==null?void 0:e.config,template:this.value})},methods:{onToggle(e){var s;this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...(s=this.$store.state.headshots)==null?void 0:s.config,template:this.value})}}}),Be={class:"field"},He=["onClick"],qe={class:"name"};function Fe(e,s,a,n,_,f){const d=r("el-image"),h=r("el-tab-pane"),i=r("el-tabs");return o(),c("div",Be,[g(` <h2 class="title">{{ $t('headshots.field.elements') }}</h2> `),t(i,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=m=>e.tab=m)},{default:u(()=>[(o(!0),c(P,null,E(e.elements,(m,v)=>(o(),D(h,{key:v,label:m.displayName,name:v,class:"pane"},{default:u(()=>[(o(!0),c(P,null,E(m.items,(k,V)=>(o(),c("div",{key:V,class:R({item:!0,active:e.value===k.value}),onClick:C=>e.onToggle(k.value)},[t(d,{src:k.image,fit:"fill",class:"preview"},null,8,["src"]),p("span",qe,l(k.label),1)],10,He))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}var Je=w(ze,[["render",Fe],["__scopeId","data-v-7e0125ad"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ElementsSelector.vue"]]);const We=I({name:"PresetPanel",components:{ModeSelector:Oe,ImageUrlsInput:Re,ElButton:O,FontAwesomeIcon:j,ElementsSelector:Je},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Xe={class:"panel"},Ke={class:"config"},Qe={class:"actions"};function Ye(e,s,a,n,_,f){const d=r("elements-selector"),h=r("mode-selector"),i=r("image-urls-input"),m=r("font-awesome-icon"),v=r("el-button");return o(),c("div",Xe,[p("div",Ke,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(i,{class:"mb-4"}),p("div",Qe,[t(v,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(m,{icon:"fa-solid fa-magic",class:"mr-2"}),$(" "+l(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}var Ze=w(We,[["render",Ye],["__scopeId","data-v-6a264fac"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ConfigPanel.vue"]]);const xe=I({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:$e(()=>{var n,_,f;return((f=(_=(n=e.modelValue)==null?void 0:n.response)==null?void 0:_.data)==null?void 0:f.slice(0,2))||[]}),viewImage:n=>{window.open(n,"_blank")}}}}),es={class:"image-gallery"},ss=["src"],ts=["onClick"];function as(e,s,a,n,_,f){return o(),c("div",es,[(o(!0),c(P,null,E(e.images,(d,h)=>(o(),c("div",{key:h,class:"image-container"},[p("img",{src:d.image_url,alt:"Image"},null,8,ss),d.image_url?(o(),c("button",{key:0,class:"view-button",onClick:i=>e.viewImage(d.image_url)},l(e.$t("headshots.button.viewImage")),9,ts)):g("v-if",!0)]))),128))])}var os=w(xe,[["render",as],["__scopeId","data-v-0187109d"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/ImageGallery.vue"]]);const ns=I({name:"TaskPreview",components:{ElImage:oe,CopyToClipboard:ke,FontAwesomeIcon:j,ElAlert:ge,ImageGallery:os},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.headshots)==null?void 0:e.application},config(){var e;return(e=this.$store.state.headshots)==null?void 0:e.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,a=new URL(s.src),n=a.searchParams.get("retry");if(!n)a.searchParams.set("retry","1");else if(parseInt(n)<2)a.searchParams.set("retry",(parseInt(n)+1).toString());else return;s.src=a.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),is={class:"preview"},ls={class:"left"},rs={class:"main"},cs={class:"bot"},ds={class:"datetime"},ps={class:"info"},ms={key:0,class:"prompt mt-2"},us={key:0},hs={key:1},_s={key:0,class:R({content:!0,failed:!0})},gs={class:"image-wrapper"},fs={class:"description"},vs={key:1,class:R({content:!0})},$s={class:"description"},ys={class:"description"},bs={class:"description"},ks={key:2,class:R({content:!0})},ws={class:"description"},Is={key:3,class:R({content:!0})},Ss={class:"description"};function Ts(e,s,a,n,_,f){var k,V,C,A,G,N,S,U,z,B,H,q,F,J,W;const d=r("el-image"),h=r("image-gallery"),i=r("font-awesome-icon"),m=r("copy-to-clipboard"),v=r("el-alert");return o(),c("div",is,[p("div",ls,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),p("div",rs,[p("div",cs,[$(l(e.$t("headshots.name.headshotsBot"))+" ",1),p("span",ds,l(e.$dayjs.format(""+new Date(parseFloat(((k=e.modelValue)==null?void 0:k.created_at)||"")*1e3))),1)]),p("div",ps,[(C=(V=e.modelValue)==null?void 0:V.request)!=null&&C.template?(o(),c("p",ms,[$(l((G=(A=e.modelValue)==null?void 0:A.request)==null?void 0:G.template)+" ",1),(N=e.modelValue)!=null&&N.response?g("v-if",!0):(o(),c("span",us," - ("+l(e.$t("headshots.status.pending"))+") ",1)),((U=(S=e.modelValue)==null?void 0:S.response)==null?void 0:U.status)==="unknown"?(o(),c("span",hs," - ("+l(e.$t("headshots.status.processing"))+") ",1)):g("v-if",!0)])):g("v-if",!0)]),g(" Display success message "),((B=(z=e.modelValue)==null?void 0:z.response)==null?void 0:B.success)===!0?(o(),c("div",_s,[p("div",gs,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(v,{closable:!1,class:"mt-2 success"},{default:u(()=>{var y,b;return[p("p",fs,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),((q=(H=e.modelValue)==null?void 0:H.response)==null?void 0:q.success)===!1?(o(),c("div",vs,[t(v,{closable:!1,class:"failure"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b,X,K,Q,Y,Z,x,ee,se,te,ae;return[p("p",$s,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])]),p("p",ys,[t(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failureReason"))+": "+l((Q=(K=(X=e.modelValue)==null?void 0:X.response)==null?void 0:K.error)==null?void 0:Q.message)+" ",1),t(m,{content:(x=(Z=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:Z.error)==null?void 0:x.message,class:"btn-copy"},null,8,["content"])]),p("p",bs,[t(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),$(" "+l(e.$t("headshots.name.traceId"))+": "+l((se=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:se.trace_id)+" ",1),t(m,{content:(ae=(te=e.modelValue)==null?void 0:te.response)==null?void 0:ae.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),(F=e.modelValue)!=null&&F.response?g("v-if",!0):(o(),c("div",ks,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",ws,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])),((W=(J=e.modelValue)==null?void 0:J.response)==null?void 0:W.status)==="unknown"?(o(),c("div",Is,[t(v,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[p("p",Ss,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("headshots.name.taskId"))+": "+l((y=e.modelValue)==null?void 0:y.id)+" ",1),t(m,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0)])])}var Vs=w(ns,[["render",Ts],["__scopeId","data-v-43e1feb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/task/Preview.vue"]]);const Cs=I({name:"RecentPanel",components:{TaskPreview:Vs,ElSkeleton:fe,ElSkeletonItem:ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,s,a,n;return{...(e=this.$store.state.headshots)==null?void 0:e.tasks,items:(n=(a=(s=this.$store.state.headshots)==null?void 0:s.tasks)==null?void 0:a.items)==null?void 0:n.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ps={key:0,class:"tasks"},Es={class:"left"},As={class:"main"},Gs={key:1,class:"tasks"},Ns={key:2,class:"description"};function Rs(e,s,a,n,_,f){var m,v,k,V,C,A,G,N;const d=r("el-skeleton-item"),h=r("el-skeleton"),i=r("task-preview");return o(),c("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...S)=>e.onHandleScroll&&e.onHandleScroll(...S))},[((m=e.tasks)==null?void 0:m.items)===void 0?(o(),c("div",Ps,[(o(),c(P,null,E(3,S=>p("div",{key:S,class:"task placeholder"},[p("div",Es,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),p("div",As,[t(h,{animated:""},{template:u(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):((k=(v=e.tasks)==null?void 0:v.items)==null?void 0:k.length)&&((C=(V=e.tasks)==null?void 0:V.items)==null?void 0:C.length)>0?(o(),c("div",Gs,[(o(!0),c(P,null,E((A=e.tasks)==null?void 0:A.items,(S,U)=>(o(),D(i,{key:U,"model-value":S,class:"preview"},null,8,["model-value"]))),128))])):g("v-if",!0),((N=(G=e.tasks)==null?void 0:G.items)==null?void 0:N.length)===0?(o(),c("p",Ns,l(e.$t("headshots.message.noTasks")),1)):g("v-if",!0)],544)}var Us=w(Cs,[["render",Rs],["__scopeId","data-v-37920e9a"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/RecentPanel.vue"]]);const Ds="https://webhook.acedata.cloud/headshots",Ls=I({name:"HeadshotsIndex",components:{ConfigPanel:Ze,Layout:Ce,ApplicationStatus:be,RecentPanel:Us},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,s;return((s=(e=this.$store.state.headshots)==null?void 0:e.status)==null?void 0:s.getApplications)===L.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===L.Request},needApply(){return this.$store.state.headshots.status.getApplications===L.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){var a,n;((a=e==null?void 0:e.items)==null?void 0:a.length)>((n=s==null?void 0:s.items)==null?void 0:n.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,s,a;console.debug("reached top"),await this.onGetTasks({createdAtMax:(a=(s=(e=this.tasks)==null?void 0:e.items)==null?void 0:s[0])==null?void 0:a.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){ie.create({application:this.application}).then(({data:e})=>{this.application=e,T.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var s,a;((a=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:a.code)===le&&T.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:s=5,createdAtMin:a,createdAtMax:n}=e||{};console.debug("limit",s,"createdAtMin",a,"createdAtMax",n),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:a,createdAtMax:n})},async onGeneratePicture(){var a;const e={...this.config,callback_url:Ds},s=(a=this.credential)==null?void 0:a.token;if(!s){console.error("no token specified");return}T.info(this.$t("headshots.message.startingTask")),re.generate(e,{token:s}).then(()=>{T.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(n=>{var f,d;const _=(f=n==null?void 0:n.response)==null?void 0:f.data;((d=_==null?void 0:_.error)==null?void 0:d.code)===ce?T.error(this.$t("headshots.message.usedUp")):T.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ms(e,s,a,n,_,f){const d=r("config-panel"),h=r("application-status"),i=r("recent-panel"),m=r("layout");return o(),D(m,null,{config:u(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:u(()=>[t(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=v=>e.$store.dispatch("headshots/setApplication",v))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(i,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),g(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var Qs=w(Ls,[["render",Ms],["__scopeId","data-v-62da1b28"],["__file","/home/runner/work/Nexior/Nexior/src/pages/headshots/Index.vue"]]);export{Qs as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{an as Ve}from"./vendor-others.4ac6d265.js";import{ar as z}from"./vendor-fortawesome.20479da6.js";import{_ as y,aJ as Se,aK as Ee,aL as Ne,aM as Pe,D as ye,aN as Te,N as H,J as Ce,P as Re,aO as Le,a2 as Ue}from"./index.bb8f1411.js";import{T as Ae,u as B,N as Q,O as W,x as be,y as E,U as De,V as Ge,t as we,m as Oe,I as Me,s as je,H as Fe,R as qe}from"./vendor-element-plus.0d60bec3.js";import{H as b,al as n,o as l,e as p,f as a,I as J,V as o,M as _,T as c,U,ai as A,L,P as D,a0 as ze,S as k,R as $}from"./vendor-@vue.38e80b4c.js";import{I as K}from"./InfoIcon.b3285074.js";import{I as Ie}from"./ImagePreview.65bc0654.js";import{C as Be}from"./CopyToClipboard.3752e201.js";import"./vendor-markdown.b359a0a8.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.60b22bc6.js";const Ke=b({name:"LayoutKling",components:{ElDrawer:Ae,ElButton:B,FontAwesomeIcon:z},data(){return{drawer:!1}}}),He={class:"main"},Je={class:"config"},Qe={class:"result"};function We(e,t,s,d,g,f){const i=n("font-awesome-icon"),u=n("el-button"),r=n("el-drawer");return l(),p("div",He,[a("div",Je,[J(e.$slots,"config",{},void 0,!0)]),a("div",Qe,[J(e.$slots,"result",{},void 0,!0)]),o(u,{round:"",class:"menu",onClick:t[0]||(t[0]=v=>e.drawer=!0)},{default:_(()=>[o(i,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),o(r,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=v=>e.drawer=v),"with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[J(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Xe=y(Ke,[["render",We],["__scopeId","data-v-50bc0f32"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Kling.vue"]]);const Ye=b({name:"ModelSelector",components:{ElSelect:Q,ElOption:W},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"V1"},{value:"kling-v1-5",label:"V1.5"},{value:"kling-v1-6",label:"V1.6"}]}},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.kling)==null?void 0:e.config)==null?void 0:t.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=Se)}}),Ze={class:"field"},xe={class:"title font-bold"};function et(e,t,s,d,g,f){const i=n("el-option"),u=n("el-select");return l(),p("div",Ze,[a("h2",xe,c(e.$t("pika.name.model")),1),o(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=r=>e.value=r),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:_(()=>[(l(!0),p(U,null,A(e.options,r=>(l(),L(i,{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var tt=y(Ye,[["render",et],["__scopeId","data-v-13cacdf9"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/ModelSelector.vue"]]);const ot=b({name:"ModeSelector",components:{ElSelect:Q,ElOption:W},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:"\u6807\u51C6"},{value:"pro",label:"\u9AD8\u901F"}]}},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.kling)==null?void 0:e.config)==null?void 0:t.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=Ee)}}),st={class:"field"},nt={class:"title font-bold"};function at(e,t,s,d,g,f){const i=n("el-option"),u=n("el-select");return l(),p("div",st,[a("h2",nt,c(e.$t("kling.name.mode")),1),o(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=r=>e.value=r),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:_(()=>[(l(!0),p(U,null,A(e.options,r=>(l(),L(i,{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var lt=y(ot,[["render",at],["__scopeId","data-v-3af5203e"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/ModeSelector.vue"]]);const it=b({name:"DurationSelector",components:{ElSelect:Q,ElOption:W},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5\u79D2"},{value:10,label:"10\u79D2"}]}},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.kling)==null?void 0:e.config)==null?void 0:t.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=Ne)}}),rt={class:"field"},ct={class:"title font-bold"};function dt(e,t,s,d,g,f){const i=n("el-option"),u=n("el-select");return l(),p("div",rt,[a("h2",ct,c(e.$t("kling.name.duration")),1),o(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=r=>e.value=r),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:_(()=>[(l(!0),p(U,null,A(e.options,r=>(l(),L(i,{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var pt=y(it,[["render",dt],["__scopeId","data-v-6434f6d2"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/DurationSelector.vue"]]);const ut=b({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){var e,t,s;return(s=(t=(e=this.$store.state)==null?void 0:e.kling)==null?void 0:t.config)==null?void 0:s.aspect_ratio},set(e){var t,s;console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...(s=(t=this.$store.state)==null?void 0:t.kling)==null?void 0:s.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Pe)}}),mt={class:"text-sm font-bold mb-2 block"},_t={class:"items"},gt=["onClick"],ft={class:"name"};function vt(e,t,s,d,g,f){return l(),p("div",null,[a("span",mt,c(e.$t("kling.name.ratio")),1),a("div",_t,[(l(!0),p(U,null,A(e.options,(i,u)=>(l(),p("div",{key:u,class:D({active:e.active===u,item:!0}),onClick:r=>e.value=i.value},[a("div",{class:D(["preview",i.label])},[a("div",{class:"rect",style:ze({width:i.width+"px",height:i.height+"px"})},null,4)],2),a("p",ft,c(i.label),1)],10,gt))),128))])])}var ht=y(ut,[["render",vt],["__scopeId","data-v-41d8dfdb"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/RatioSelector.vue"]]);const $t=b({name:"StartImage",components:{ElUpload:be,ElButton:B,InfoIcon:K,FontAwesomeIcon:z,ImagePreview:Ie},emits:["change"],data(){return{fileList:[],uploadUrl:ye()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var t;return(t=e==null?void 0:e.response)==null?void 0:t.file_url})},value:{get(){var e,t,s;return(s=(t=(e=this.$store.state)==null?void 0:e.kling)==null?void 0:t.config)==null?void 0:s.start_image_url},set(e){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){E.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){var t,s,d;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("kling/setConfig",{...(d=(s=this.$store.state)==null?void 0:s.kling)==null?void 0:d.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),kt={class:"relative"},yt={class:"flex justify-between"},bt={class:"flex justify-start items-center"},wt={class:"text-sm font-bold"};function It(e,t,s,d,g,f){const i=n("info-icon"),u=n("image-preview"),r=n("font-awesome-icon"),v=n("el-button"),h=n("el-upload");return l(),p("div",kt,[a("div",yt,[a("div",bt,[a("span",wt,c(e.$t("kling.name.startImage")),1),o(i,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),o(h,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",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:_(({file:m})=>{var w;return[o(u,{url:m.url||((w=m.response)==null?void 0:w.file_url),name:m.name,percentage:m.percentage,onRemove:N=>e.fileList.splice(e.fileList.indexOf(m),1)},null,8,["url","name","percentage","onRemove"])]}),default:_(()=>[o(v,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:_(()=>[o(r,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+c(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}var Vt=y($t,[["render",It],["__scopeId","data-v-6e6084d0"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/StartImage.vue"]]);const St=b({name:"EndImage",components:{ElUpload:be,ElButton:B,ImagePreview:Ie,InfoIcon:K,FontAwesomeIcon:z},data(){return{fileList:[],uploadUrl:ye()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var t;return(t=e==null?void 0:e.response)==null?void 0:t.file_url})},value:{get(){var e,t,s;return(s=(t=(e=this.$store.state)==null?void 0:e.kling)==null?void 0:t.config)==null?void 0:s.start_image_url},set(e){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){E.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){var t,s;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("kling/setConfig",{...(s=this.$store.state.kling)==null?void 0:s.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Et={class:"relative"},Nt={class:"flex justify-between"},Pt={class:"flex justify-start items-center"},Tt={class:"text-sm font-bold"};function Ct(e,t,s,d,g,f){const i=n("info-icon"),u=n("image-preview"),r=n("font-awesome-icon"),v=n("el-button"),h=n("el-upload");return l(),p("div",Et,[a("div",Nt,[a("div",Pt,[a("span",Tt,c(e.$t("kling.name.endImage")),1),o(i,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),o(h,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",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:_(({file:m})=>{var w;return[o(u,{url:m.url||((w=m.response)==null?void 0:w.file_url),name:m.name,percentage:m.percentage,onRemove:N=>e.fileList.splice(e.fileList.indexOf(m),1)},null,8,["url","name","percentage","onRemove"])]}),default:_(()=>[o(v,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:_(()=>[o(r,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+c(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}var Rt=y(St,[["render",Ct],["__scopeId","data-v-72a21eff"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/EndImage.vue"]]);const Lt=b({name:"CfgScaleSelector",components:{ElSlider:De,InfoIcon:K,ElInputNumber:Ge},computed:{value:{get(){var e,t,s;return(s=(t=(e=this.$store.state)==null?void 0:e.kling)==null?void 0:t.config)==null?void 0:s.cfg_scale},set(e){var t,s;console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...(s=(t=this.$store.state)==null?void 0:t.kling)==null?void 0:s.config,cfg_scale:e})}}},mounted(){this.value||(this.value=Te)}}),Ut={class:"flex justify-between"},At={class:"flex justify-start items-center"},Dt={class:"text-sm font-bold"},Gt={class:"flex justify-end items-center"},Ot={class:"w-full"};function Mt(e,t,s,d,g,f){const i=n("info-icon"),u=n("el-input-number"),r=n("el-slider");return l(),p("div",null,[a("div",Ut,[a("div",At,[a("span",Dt,c(e.$t("kling.name.cfgScale")),1),o(i,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",Gt,[o(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=v=>e.value=v),"controls-position":"right"},null,8,["modelValue"])])]),a("div",Ot,[o(r,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=v=>e.value=v),min:0,max:1,step:.1},null,8,["modelValue"])])])}var jt=y(Lt,[["render",Mt],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/CfgScaleSelector.vue"]]);const Ft="",qt=b({name:"PromptInput",components:{ElInput:we,InfoIcon:K},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.kling)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...(t=this.$store.state.kling)==null?void 0:t.config,prompt:e})}}},mounted(){this.value||(this.value=Ft)}}),zt={class:"field"},Bt={class:"box"},Kt={class:"title font-bold"};function Ht(e,t,s,d,g,f){const i=n("info-icon"),u=n("el-input");return l(),p("div",zt,[a("div",Bt,[a("h2",Kt,c(e.$t("kling.name.prompt")),1),o(i,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),o(u,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=r=>e.prompt=r),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Jt=y(qt,[["render",Ht],["__scopeId","data-v-fd830852"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/PromptInput.vue"]]);const Qt="",Wt=b({name:"NegativePromptInput",components:{ElInput:we,InfoIcon:K},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.kling)==null?void 0:e.config)==null?void 0:t.negative_prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...(t=this.$store.state.kling)==null?void 0:t.config,negative_prompt:e})}}},mounted(){this.value||(this.value=Qt)}}),Xt={class:"field"},Yt={class:"box"},Zt={class:"title font-bold"};function xt(e,t,s,d,g,f){const i=n("info-icon"),u=n("el-input");return l(),p("div",Xt,[a("div",Yt,[a("h2",Zt,c(e.$t("kling.name.negativePrompt")),1),o(i,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),o(u,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=r=>e.prompt=r),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var eo=y(Wt,[["render",xt],["__scopeId","data-v-6c3d0de2"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/config/NegativePromptInput.vue"]]);const to=b({name:"PresetPanel",components:{ElButton:B,FontAwesomeIcon:z,PromptInput:Jt,NegativePromptInput:eo,ModelSelector:tt,ModeSelector:lt,DurationSelector:pt,RatioSelector:ht,StartImage:Vt,CfgScaleSelector:jt,EndImage:Rt},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.kling)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),oo={class:"panel"},so={class:"config"},no={class:"actions"};function ao(e,t,s,d,g,f){var I,R;const i=n("prompt-input"),u=n("model-selector"),r=n("mode-selector"),v=n("ratio-selector"),h=n("start-image"),m=n("end-image"),w=n("cfg-scale-selector"),N=n("duration-selector"),C=n("negative-prompt-input"),P=n("font-awesome-icon"),T=n("el-button");return l(),p("div",oo,[a("div",so,[o(i,{class:"mb-4"}),o(u,{class:"mb-4"}),o(r,{class:"mb-4"}),o(v,{class:"mb-4"}),o(h,{class:"mb-2"}),o(m,{class:"mb-2"}),o(w,{class:"mb-4"}),o(N,{class:"mb-4"}),o(C,{class:"mb-4"}),a("div",no,[((I=e.config)==null?void 0:I.video_url)!==void 0||((R=e.config)==null?void 0:R.custom)?(l(),L(T,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[o(P,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+c(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(l(),L(T,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[o(P,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+c(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])])}var lo=y(to,[["render",ao],["__scopeId","data-v-301363b4"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/ConfigPanel.vue"]]);const io=b({name:"VideoPlayer",components:{VuePlyr:Ve},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),ro={controls:"",crossorigin:"",playsinline:""},co=["src"];function po(e,t,s,d,g,f){const i=n("vue-plyr");return l(),p("div",null,[o(i,{options:e.options,class:"video"},{default:_(()=>{var u;return[a("video",ro,[a("source",{size:"1080",src:(u=e.modelValue)==null?void 0:u.video_url,type:"video/mp4"},null,8,co)])]}),_:1},8,["options"])])}var uo=y(io,[["render",po],["__scopeId","data-v-3fd1ea0e"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/VideoPlayer.vue"]]);const mo=b({name:"TaskPreview",components:{ElImage:Oe,CopyToClipboard:Be,FontAwesomeIcon:z,ElAlert:Me,VideoPlayer:uo,ElTooltip:je,ElButton:B},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.kling)==null?void 0:e.application},config(){var e;return(e=this.$store.state.kling)==null?void 0:e.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onReload(e){const t=e.target,s=new URL(t.src),d=s.searchParams.get("retry");if(!d)s.searchParams.set("retry","1");else if(parseInt(d)<2)s.searchParams.set("retry",(parseInt(d)+1).toString());else return;t.src=s.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),_o={class:"preview"},go={class:"left"},fo={class:"main"},vo={class:"bot"},ho={class:"datetime"},$o={class:"info"},ko={key:0,class:"prompt mt-2"},yo={key:0},bo={key:1},wo={key:0,class:D({content:!0,failed:!0})},Io={class:"image-wrapper"},Vo={key:0,class:D({operations:!0,"mt-2":!0})},So={class:"description"},Eo={key:1,class:D({content:!0})},No={class:"description"},Po={class:"description"},To={key:0,class:"description"},Co={key:2,class:D({content:!0})},Ro={class:"description"},Lo={key:0,class:"description"};function Uo(e,t,s,d,g,f){var N,C,P,T,I,R,X,Y,Z,x,ee,te,oe,se,ne,ae,le,ie,re,ce,de,pe,ue,me,_e;const i=n("el-image"),u=n("VideoPlayer"),r=n("el-button"),v=n("el-tooltip"),h=n("font-awesome-icon"),m=n("copy-to-clipboard"),w=n("el-alert");return l(),p("div",_o,[a("div",go,[o(i,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",fo,[a("div",vo,[k(c(e.$t("kling.name.klingBot"))+" ",1),a("span",ho,c(e.$dayjs.format(""+new Date(parseFloat(((N=e.modelValue)==null?void 0:N.created_at)||"")*1e3))),1)]),a("div",$o,[(P=(C=e.modelValue)==null?void 0:C.request)!=null&&P.prompt?(l(),p("p",ko,[k(c((I=(T=e.modelValue)==null?void 0:T.request)==null?void 0:I.prompt)+" ",1),(R=e.modelValue)!=null&&R.response?$("v-if",!0):(l(),p("span",yo," - ("+c(e.$t("kling.status.pending"))+") ",1)),((Y=(X=e.modelValue)==null?void 0:X.response)==null?void 0:Y.state)==="submitted"||((x=(Z=e.modelValue)==null?void 0:Z.response)==null?void 0:x.state)==="processing"||((te=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:te.state)==="pending"||((se=(oe=e.modelValue)==null?void 0:oe.response)==null?void 0:se.state)==="completed"?(l(),p("span",bo," - ("+c(e.$t("kling.status.processing"))+") ",1)):$("v-if",!0)])):$("v-if",!0)]),$(" Display success message "),((ae=(ne=e.modelValue)==null?void 0:ne.response)==null?void 0:ae.success)===!0?(l(),p("div",wo,[a("div",Io,[o(u,{"model-value":(le=e.modelValue)==null?void 0:le.response},null,8,["model-value"])]),(ie=e.modelValue)!=null&&ie.response.success?(l(),p("div",Vo,[o(v,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:_(()=>[o(r,{type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=S=>{var V;return e.onDownload(S,(V=e.modelValue)==null?void 0:V.response.video_url)})},{default:_(()=>[k(c(e.$t("kling.button.download")),1)]),_:1})]),_:1},8,["content"])])):$("v-if",!0),o(w,{closable:!1,class:"mt-2 success"},{default:_(()=>{var S,V;return[a("p",So,[o(h,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("kling.name.taskId"))+": "+c((S=e.modelValue)==null?void 0:S.id)+" ",1),o(m,{content:(V=e.modelValue)==null?void 0:V.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):$("v-if",!0),$(" Display error message "),((ce=(re=e.modelValue)==null?void 0:re.response)==null?void 0:ce.success)===!1?(l(),p("div",Eo,[o(w,{closable:!1,class:"failure"},{template:_(()=>[o(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+c(e.$t("kling.name.failure")),1)]),default:_(()=>{var S,V,G,O,M,j,F,q,ge,fe,ve,he,$e,ke;return[a("p",No,[o(h,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("kling.name.taskId"))+": "+c((S=e.modelValue)==null?void 0:S.id)+" ",1),o(m,{content:(V=e.modelValue)==null?void 0:V.id,class:"btn-copy"},null,8,["content"])]),a("p",Po,[o(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),k(" "+c(e.$t("kling.name.failureReason"))+": "+c((M=(O=(G=e.modelValue)==null?void 0:G.response)==null?void 0:O.error)==null?void 0:M.message)+" ",1),o(m,{content:(q=(F=(j=e.modelValue)==null?void 0:j.response)==null?void 0:F.error)==null?void 0:q.message,class:"btn-copy"},null,8,["content"])]),(fe=(ge=e.modelValue)==null?void 0:ge.response)!=null&&fe.trace_id?(l(),p("p",To,[o(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("kling.name.traceId"))+": "+c((he=(ve=e.modelValue)==null?void 0:ve.response)==null?void 0:he.trace_id)+" ",1),o(m,{content:(ke=($e=e.modelValue)==null?void 0:$e.response)==null?void 0:ke.trace_id,class:"btn-copy"},null,8,["content"])])):$("v-if",!0)]}),_:1})])):$("v-if",!0),$(" Display error message "),!((de=e.modelValue)!=null&&de.response)||((ue=(pe=e.modelValue)==null?void 0:pe.response)==null?void 0:ue.state)==="processing"||((_e=(me=e.modelValue)==null?void 0:me.response)==null?void 0:_e.state)==="pending"?(l(),p("div",Co,[o(w,{closable:!1,class:"info"},{template:_(()=>[o(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+c(e.$t("kling.name.failure")),1)]),default:_(()=>{var S,V,G,O,M,j,F,q;return[a("p",Ro,[o(h,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("kling.name.taskId"))+": "+c((S=e.modelValue)==null?void 0:S.id)+" ",1),o(m,{content:(V=e.modelValue)==null?void 0:V.id,class:"btn-copy"},null,8,["content"])]),(O=(G=e.modelValue)==null?void 0:G.response)!=null&&O.trace_id?(l(),p("p",Lo,[o(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("kling.name.traceId"))+": "+c((j=(M=e.modelValue)==null?void 0:M.response)==null?void 0:j.trace_id)+" ",1),o(m,{content:(q=(F=e.modelValue)==null?void 0:F.response)==null?void 0:q.trace_id,class:"btn-copy"},null,8,["content"])])):$("v-if",!0)]}),_:1})])):$("v-if",!0)])])}var Ao=y(mo,[["render",Uo],["__scopeId","data-v-547724c8"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/task/Preview.vue"]]);const Do=b({name:"RecentPanel",components:{TaskPreview:Ao,ElSkeleton:Fe,ElSkeletonItem:qe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,s,d;return{...(e=this.$store.state.kling)==null?void 0:e.tasks,items:(d=(s=(t=this.$store.state.kling)==null?void 0:t.tasks)==null?void 0:s.items)==null?void 0:d.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Go={key:0,class:"tasks"},Oo={class:"left"},Mo={class:"main"},jo={key:1,class:"tasks"},Fo={key:2,class:"description"};function qo(e,t,s,d,g,f){var v,h,m,w,N,C,P,T;const i=n("el-skeleton-item"),u=n("el-skeleton"),r=n("task-preview");return l(),p("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...I)=>e.onHandleScroll&&e.onHandleScroll(...I))},[((v=e.tasks)==null?void 0:v.items)===void 0?(l(),p("div",Go,[(l(),p(U,null,A(3,I=>a("div",{key:I,class:"task placeholder"},[a("div",Oo,[o(u,{animated:""},{template:_(()=>[o(i,{variant:"image",class:"avatar"})]),_:1})]),a("div",Mo,[o(u,{animated:""},{template:_(()=>[o(i,{variant:"p",class:"title"}),o(i,{variant:"image",class:"icon"})]),_:1})])])),64))])):((m=(h=e.tasks)==null?void 0:h.items)==null?void 0:m.length)&&((N=(w=e.tasks)==null?void 0:w.items)==null?void 0:N.length)>0?(l(),p("div",jo,[$(" {{ tasks?.items }} "),(l(!0),p(U,null,A((C=e.tasks)==null?void 0:C.items,(I,R)=>(l(),L(r,{key:R,"model-value":I,class:"preview"},null,8,["model-value"]))),128))])):$("v-if",!0),((T=(P=e.tasks)==null?void 0:P.items)==null?void 0:T.length)===0?(l(),p("p",Fo,c(e.$t("kling.message.noTasks")),1)):$("v-if",!0)],544)}var zo=y(Do,[["render",qo],["__scopeId","data-v-abb7e68a"],["__file","/home/runner/work/Nexior/Nexior/src/components/kling/RecentPanel.vue"]]);const Bo="https://webhook.acedata.cloud/kling",Ko=b({name:"KlingIndex",components:{ConfigPanel:lo,Layout:Xe,RecentPanel:zo},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.kling)==null?void 0:e.status)==null?void 0:t.getApplications)===H.Request},service(){return this.$store.state.kling.service},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},initializing(){return this.$store.state.kling.status.getApplications===H.Request},needApply(){return this.$store.state.kling.status.getApplications===H.Success&&!this.application},application(){return this.$store.state.kling.application},applications(){return this.$store.state.kling.applications},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,t){var s,d;((s=e==null?void 0:e.items)==null?void 0:s.length)>((d=t==null?void 0:t.items)==null?void 0:d.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,t,s;console.debug("reached top"),await this.onGetTasks({createdAtMax:(s=(t=(e=this.tasks)==null?void 0:e.items)==null?void 0:t[0])==null?void 0:s.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){Ce.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var t,s;((s=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:s.code)===Re&&E.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:t=5,createdAtMin:s,createdAtMax:d}=e||{};console.debug("limit",t,"createdAtMin",s,"createdAtMax",d),await this.$store.dispatch("kling/getTasks",{limit:t,createdAtMin:s,createdAtMax:d})},async onGenerate(){var s;const e={...this.config,callback_url:Bo},t=(s=this.credential)==null?void 0:s.token;if(!t){console.error("no token specified");return}E.info(this.$t("kling.message.startingTask")),Le.generate(e,{token:t}).then(()=>{E.success(this.$t("kling.message.startTaskSuccess")),this.$store.commit("kling/setConfig",{config:void 0})}).catch(d=>{var f,i;const g=(f=d==null?void 0:d.response)==null?void 0:f.data;((i=g==null?void 0:g.error)==null?void 0:i.code)===Ue?E.error(this.$t("kling.message.usedUp")):E.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ho(e,t,s,d,g,f){const i=n("config-panel"),u=n("recent-panel"),r=n("layout");return l(),L(r,null,{config:_(()=>[o(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[o(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var ns=y(Ko,[["render",Ho],["__scopeId","data-v-e48d89a0"],["__file","/home/runner/work/Nexior/Nexior/src/pages/kling/Index.vue"]]);export{ns as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{an as ne}from"./vendor-others.cdfefb59.js";import{ar as j}from"./vendor-fortawesome.2b54ad1b.js";import{_ as S,aW as le,D as ie,N as O,J as re,P as ce,aX as ue,a1 as pe}from"./index.f9e15558.js";import{T as de,u as D,N as me,O as _e,x as he,y as I,t as fe,m as ge,I as $e,s as ve,H as ye,R as ke}from"./vendor-element-plus.1fa87efb.js";import{H as V,al as a,o as i,e as _,f as r,I as M,V as s,M as h,T as u,U as N,ai as G,L as E,S as y,R as k,P as L}from"./vendor-@vue.6c0309d3.js";import{I as ae}from"./InfoIcon.523bd2db.js";import{I as we}from"./ImagePreview.33ef2f8c.js";import{C as be}from"./CopyToClipboard.b1fffe0f.js";import"./vendor-markdown.cf3e96ae.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.6ab44f81.js";const Ie=V({name:"LayoutHailuo",components:{ElDrawer:de,ElButton:D,FontAwesomeIcon:j},data(){return{drawer:!1}}}),Se={class:"main"},Ve={class:"config"},Pe={class:"result"};function Te(e,t,o,l,f,g){const p=a("font-awesome-icon"),m=a("el-button"),c=a("el-drawer");return i(),_("div",Se,[r("div",Ve,[M(e.$slots,"config",{},void 0,!0)]),r("div",Pe,[M(e.$slots,"result",{},void 0,!0)]),s(m,{round:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:h(()=>[s(p,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(c,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),"with-header":!1,size:"340px",class:"drawer"},{default:h(()=>[M(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ee=S(Ie,[["render",Te],["__scopeId","data-v-3c8363f5"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Hailuo.vue"]]);const Ce=V({name:"ModelSelector",components:{ElSelect:me,ElOption:_e},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(){var e,t;return(t=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:t.model},set(e){var t;this.$store.commit("hailuo/setConfig",{...(t=this.$store.state.hailuo)==null?void 0:t.config,model:e})}}},mounted(){this.value||(this.value=le)}}),Ue={class:"field"},Ae={class:"title font-bold"},Re={class:"float-left"};function Ne(e,t,o,l,f,g){const p=a("el-option"),m=a("el-select");return i(),_("div",Ue,[r("h2",Ae,u(e.$t("hailuo.name.model")),1),s(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:h(()=>[(i(!0),_(N,null,G(e.options,c=>(i(),E(p,{key:c.value,label:c.label,value:c.value},{default:h(()=>[r("span",Re,u(c.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var Ge=S(Ce,[["render",Ne],["__scopeId","data-v-62190314"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/ModelSelector.vue"]]);const De=V({name:"StartImageUrlInput",components:{ElUpload:he,ElButton:D,InfoIcon:ae,ImagePreview:we},data(){return{fileList:[],uploadUrl:ie()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var t;return(t=e==null?void 0:e.response)==null?void 0:t.file_url})},value:{get(){var e,t;return(t=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:t.first_image_url},set(){var t,o;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){I.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){I.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){I.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){var t,o;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Le={class:"relative"},Oe={class:"flex justify-between"},Me={class:"flex justify-start items-center"},je={class:"text-sm font-bold"};function qe(e,t,o,l,f,g){const p=a("info-icon"),m=a("image-preview"),c=a("el-button"),$=a("el-upload");return i(),_("div",Le,[r("div",Oe,[r("div",Me,[r("span",je,u(e.$t("hailuo.name.startImageUrl")),1),s(p,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),s($,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=d=>e.fileList=d),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"upload-wrapper","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:h(({file:d})=>{var v;return[s(m,{url:d.url||((v=d.response)==null?void 0:v.file_url),name:d.name,percentage:d.percentage,onRemove:w=>e.fileList.splice(e.fileList.indexOf(d),1)},null,8,["url","name","percentage","onRemove"])]}),default:h(()=>[s(c,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:h(()=>[y(u(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}var He=S(De,[["render",qe],["__scopeId","data-v-6c6b80d0"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/StartImageUrlInput.vue"]]);const Be="",ze=V({name:"PromptInput",components:{ElInput:fe,InfoIcon:ae},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...(t=this.$store.state.hailuo)==null?void 0:t.config,prompt:e})}}},mounted(){this.value||(this.value=Be)}}),Fe={class:"field"},Je={class:"box"},Ke={class:"title font-bold"};function We(e,t,o,l,f,g){const p=a("info-icon"),m=a("el-input");return i(),_("div",Fe,[r("div",Je,[r("h2",Ke,u(e.$t("hailuo.name.prompt")),1),s(p,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Xe=S(ze,[["render",We],["__scopeId","data-v-d785889c"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/PromptInput.vue"]]);const Qe=V({name:"PresetPanel",components:{ElButton:D,FontAwesomeIcon:j,PromptInput:Xe,StartImageUrlInput:He,ModelSelector:Ge},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ye={class:"panel"},Ze={class:"config"},xe={class:"actions"};function et(e,t,o,l,f,g){var v,w,n;const p=a("prompt-input"),m=a("model-selector"),c=a("start-image-url-input"),$=a("font-awesome-icon"),d=a("el-button");return i(),_("div",Ye,[r("div",Ze,[s(p,{class:"mb-4"}),s(m,{class:"mb-4"}),((v=e.config)==null?void 0:v.model)==="minimax-i2v"?(i(),E(c,{key:0,class:"mb-4"})):k("v-if",!0),r("div",xe,[((w=e.config)==null?void 0:w.video_url)!==void 0||((n=e.config)==null?void 0:n.custom)?(i(),E(d,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[s($,{icon:"fa-solid fa-magic",class:"mr-2"}),y(" "+u(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(i(),E(d,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[s($,{icon:"fa-solid fa-magic",class:"mr-2"}),y(" "+u(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])])}var tt=S(Qe,[["render",et],["__scopeId","data-v-01eef439"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/ConfigPanel.vue"]]);const ot=V({name:"VideoPlayer",components:{VuePlyr:ne},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),st=["data-poster"],at=["src"];function nt(e,t,o,l,f,g){const p=a("vue-plyr");return i(),_("div",null,[s(p,{options:e.options,class:"video"},{default:h(()=>{var m,c;return[r("video",{controls:"",crossorigin:"",playsinline:"","data-poster":(m=e.modelValue)==null?void 0:m.image_url},[r("source",{size:"1080",src:(c=e.modelValue)==null?void 0:c.video_url,type:"video/mp4"},null,8,at)],8,st)]}),_:1},8,["options"])])}var lt=S(ot,[["render",nt],["__scopeId","data-v-11ad7a93"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/VideoPlayer.vue"]]);const it=V({name:"TaskPreview",components:{ElImage:ge,CopyToClipboard:be,FontAwesomeIcon:j,ElAlert:$e,VideoPlayer:lt,ElTooltip:ve,ElButton:D},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.application},config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config},videos(){var o,l,f,g,p,m,c;let e=[];const t=(l=(o=this.modelValue)==null?void 0:o.request)==null?void 0:l.action;return Array.isArray((g=(f=this.modelValue)==null?void 0:f.response)==null?void 0:g.data)&&((c=(m=(p=this.modelValue)==null?void 0:p.response)==null?void 0:m.data)==null||c.forEach($=>{let d=$;t&&(d.action=t),e.push(d)})),e}},methods:{onExtend(e,t){var o;e.stopPropagation(),console.debug("set config",t),this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,video_id:t.video_id,prompt:t.prompt,action:"extend",thumbnail_url:t.thumbnail_url,video_url:t.video_url})},onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onReload(e){const t=e.target,o=new URL(t.src),l=o.searchParams.get("retry");if(!l)o.searchParams.set("retry","1");else if(parseInt(l)<2)o.searchParams.set("retry",(parseInt(l)+1).toString());else return;t.src=o.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),rt={class:"left"},ct={class:"main"},ut={class:"bot"},pt={class:"datetime"},dt={class:"info"},mt={key:0,class:"prompt mt-2"},_t={key:0},ht={key:1},ft={key:0,class:L({content:!0,failed:!0})},gt={class:"image-wrapper"},$t={key:0,class:L({operations:!0,"mt-2":!0})},vt={class:"description"},yt={key:1,class:L({content:!0})},kt={class:"description"},wt={class:"description"},bt={class:"description"},It={key:2,class:L({content:!0})},St={class:"description"};function Vt(e,t,o,l,f,g){const p=a("el-image"),m=a("VideoPlayer"),c=a("el-button"),$=a("el-tooltip"),d=a("font-awesome-icon"),v=a("copy-to-clipboard"),w=a("el-alert");return i(!0),_(N,null,G(e.videos,(n,A)=>{var C,U,P,R,q,H,B,z,F,J,K;return i(),_("div",{key:A,class:"preview"},[r("div",rt,[s(p,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),r("div",ct,[r("div",ut,[y(u(e.$t("hailuo.name.hailuoBot"))+" ",1),r("span",pt,u(e.$dayjs.format(""+new Date(parseFloat(((C=e.modelValue)==null?void 0:C.created_at)||"")*1e3))),1)]),r("div",dt,[(P=(U=e.modelValue)==null?void 0:U.request)!=null&&P.prompt?(i(),_("p",mt,[y(u((q=(R=e.modelValue)==null?void 0:R.request)==null?void 0:q.prompt)+" ",1),(H=e.modelValue)!=null&&H.response?k("v-if",!0):(i(),_("span",_t," - ("+u(e.$t("hailuo.status.pending"))+") ",1)),(n==null?void 0:n.state)==="processing"||(n==null?void 0:n.state)==="pending"||(n==null?void 0:n.state)==="running"?(i(),_("span",ht," - ("+u(e.$t("hailuo.status.processing"))+") ",1)):k("v-if",!0)])):k("v-if",!0)]),k(" Display success message "),((z=(B=e.modelValue)==null?void 0:B.response)==null?void 0:z.success)===!0?(i(),_("div",ft,[r("div",gt,[s(m,{"model-value":n},null,8,["model-value"])]),n?(i(),_("div",$t,[s($,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:h(()=>[s(c,{type:"info",size:"small",class:"btn-action",onClick:b=>e.onDownload(b,n==null?void 0:n.video_url)},{default:h(()=>[y(u(e.$t("hailuo.button.download")),1)]),_:2},1032,["onClick"])]),_:2},1032,["content"])])):k("v-if",!0),s(w,{closable:!1,class:"mt-2 success"},{default:h(()=>{var b,T;return[r("p",vt,[s(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.taskId"))+": "+u((b=e.modelValue)==null?void 0:b.id)+" ",1),s(v,{content:(T=e.modelValue)==null?void 0:T.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),((J=(F=e.modelValue)==null?void 0:F.response)==null?void 0:J.success)===!1?(i(),_("div",yt,[s(w,{closable:!1,class:"failure"},{template:h(()=>[s(d,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.failure")),1)]),default:h(()=>{var b,T,W,X,Q,Y,Z,x,ee,te,oe,se;return[r("p",kt,[s(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.taskId"))+": "+u((b=e.modelValue)==null?void 0:b.id)+" ",1),s(v,{content:(T=e.modelValue)==null?void 0:T.id,class:"btn-copy"},null,8,["content"])]),r("p",wt,[s(d,{icon:"fa-solid fa-circle-info",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.failureReason"))+": "+u((Q=(X=(W=e.modelValue)==null?void 0:W.response)==null?void 0:X.error)==null?void 0:Q.message)+" ",1),s(v,{content:(x=(Z=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:Z.error)==null?void 0:x.message,class:"btn-copy"},null,8,["content"])]),r("p",bt,[s(d,{icon:"fa-solid fa-hashtag",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.traceId"))+": "+u((te=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:te.trace_id)+" ",1),s(v,{content:(se=(oe=e.modelValue)==null?void 0:oe.response)==null?void 0:se.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),!((K=e.modelValue)!=null&&K.response)||(n==null?void 0:n.state)==="processing"||(n==null?void 0:n.state)==="pending"||(n==null?void 0:n.state)==="running"?(i(),_("div",It,[s(w,{closable:!1,class:"info"},{template:h(()=>[s(d,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.failure")),1)]),default:h(()=>{var b,T;return[r("p",St,[s(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.taskId"))+": "+u((b=e.modelValue)==null?void 0:b.id)+" ",1),s(v,{content:(T=e.modelValue)==null?void 0:T.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0)])])}),128)}var Pt=S(it,[["render",Vt],["__scopeId","data-v-3f5aedb7"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/task/Preview.vue"]]);const Tt=V({name:"RecentPanel",components:{TaskPreview:Pt,ElSkeleton:ye,ElSkeletonItem:ke},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,o,l;return{...(e=this.$store.state.hailuo)==null?void 0:e.tasks,items:(l=(o=(t=this.$store.state.hailuo)==null?void 0:t.tasks)==null?void 0:o.items)==null?void 0:l.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Et={key:0,class:"tasks"},Ct={class:"left"},Ut={class:"main"},At={key:1,class:"tasks"},Rt={key:2,class:"description"};function Nt(e,t,o,l,f,g){var $,d,v,w,n,A,C,U;const p=a("el-skeleton-item"),m=a("el-skeleton"),c=a("task-preview");return i(),_("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...P)=>e.onHandleScroll&&e.onHandleScroll(...P))},[(($=e.tasks)==null?void 0:$.items)===void 0?(i(),_("div",Et,[(i(),_(N,null,G(3,P=>r("div",{key:P,class:"task placeholder"},[r("div",Ct,[s(m,{animated:""},{template:h(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",Ut,[s(m,{animated:""},{template:h(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):((v=(d=e.tasks)==null?void 0:d.items)==null?void 0:v.length)&&((n=(w=e.tasks)==null?void 0:w.items)==null?void 0:n.length)>0?(i(),_("div",At,[(i(!0),_(N,null,G((A=e.tasks)==null?void 0:A.items,(P,R)=>(i(),E(c,{key:R,"model-value":P,class:"preview"},null,8,["model-value"]))),128))])):k("v-if",!0),((U=(C=e.tasks)==null?void 0:C.items)==null?void 0:U.length)===0?(i(),_("p",Rt,u(e.$t("hailuo.message.noTasks")),1)):k("v-if",!0)],544)}var Gt=S(Tt,[["render",Nt],["__scopeId","data-v-7bff9d40"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/RecentPanel.vue"]]);const Dt="https://webhook.acedata.cloud/hailuo",Lt=V({name:"HailuoIndex",components:{ConfigPanel:tt,Layout:Ee,RecentPanel:Gt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.hailuo)==null?void 0:e.status)==null?void 0:t.getApplications)===O.Request},service(){return this.$store.state.hailuo.service},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},initializing(){return this.$store.state.hailuo.status.getApplications===O.Request},needApply(){return this.$store.state.hailuo.status.getApplications===O.Success&&!this.application},application(){return this.$store.state.hailuo.application},applications(){return this.$store.state.hailuo.applications},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){var o,l;((o=e==null?void 0:e.items)==null?void 0:o.length)>((l=t==null?void 0:t.items)==null?void 0:l.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,t,o;console.debug("reached top"),await this.onGetTasks({createdAtMax:(o=(t=(e=this.tasks)==null?void 0:e.items)==null?void 0:t[0])==null?void 0:o.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()},onApply(){re.create({application:this.application}).then(({data:e})=>{this.application=e,I.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var t,o;((o=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:o.code)===ce&&I.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:t=5,createdAtMin:o,createdAtMax:l}=e||{};console.debug("limit",t,"createdAtMin",o,"createdAtMax",l),await this.$store.dispatch("hailuo/getTasks",{limit:t,createdAtMin:o,createdAtMax:l})},async onGenerate(){var o;const e={...this.config,callback_url:Dt},t=(o=this.credential)==null?void 0:o.token;if(!t){console.error("no token specified");return}I.info(this.$t("hailuo.message.startingTask")),ue.generate(e,{token:t}).then(()=>{I.success(this.$t("hailuo.message.startTaskSuccess")),this.$store.commit("hailuo/setConfig",{config:void 0})}).catch(l=>{var g,p;const f=(g=l==null?void 0:l.response)==null?void 0:g.data;((p=f==null?void 0:f.error)==null?void 0:p.code)===pe?I.error(this.$t("hailuo.message.usedUp")):I.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ot(e,t,o,l,f,g){const p=a("config-panel"),m=a("recent-panel"),c=a("layout");return i(),E(c,null,{config:h(()=>[s(p,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:h(()=>[s(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var Qt=S(Lt,[["render",Ot],["__scopeId","data-v-1f8aa246"],["__file","/home/runner/work/Nexior/Nexior/src/pages/hailuo/Index.vue"]]);export{Qt as default};
|
|
1
|
+
import{an as ne}from"./vendor-others.4ac6d265.js";import{ar as j}from"./vendor-fortawesome.20479da6.js";import{_ as S,aR as le,D as ie,N as O,J as re,P as ce,aS as ue,a2 as pe}from"./index.bb8f1411.js";import{T as de,u as D,N as me,O as _e,x as he,y as I,t as fe,m as ge,I as $e,s as ve,H as ye,R as ke}from"./vendor-element-plus.0d60bec3.js";import{H as V,al as a,o as i,e as _,f as r,I as M,V as s,M as h,T as u,U as N,ai as G,L as E,S as y,R as k,P as L}from"./vendor-@vue.38e80b4c.js";import{I as ae}from"./InfoIcon.b3285074.js";import{I as we}from"./ImagePreview.65bc0654.js";import{C as be}from"./CopyToClipboard.3752e201.js";import"./vendor-markdown.b359a0a8.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.60b22bc6.js";const Ie=V({name:"LayoutHailuo",components:{ElDrawer:de,ElButton:D,FontAwesomeIcon:j},data(){return{drawer:!1}}}),Se={class:"main"},Ve={class:"config"},Pe={class:"result"};function Te(e,t,o,l,f,g){const p=a("font-awesome-icon"),m=a("el-button"),c=a("el-drawer");return i(),_("div",Se,[r("div",Ve,[M(e.$slots,"config",{},void 0,!0)]),r("div",Pe,[M(e.$slots,"result",{},void 0,!0)]),s(m,{round:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:h(()=>[s(p,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(c,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),"with-header":!1,size:"340px",class:"drawer"},{default:h(()=>[M(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ee=S(Ie,[["render",Te],["__scopeId","data-v-3c8363f5"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Hailuo.vue"]]);const Ce=V({name:"ModelSelector",components:{ElSelect:me,ElOption:_e},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(){var e,t;return(t=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:t.model},set(e){var t;this.$store.commit("hailuo/setConfig",{...(t=this.$store.state.hailuo)==null?void 0:t.config,model:e})}}},mounted(){this.value||(this.value=le)}}),Re={class:"field"},Ue={class:"title font-bold"},Ae={class:"float-left"};function Ne(e,t,o,l,f,g){const p=a("el-option"),m=a("el-select");return i(),_("div",Re,[r("h2",Ue,u(e.$t("hailuo.name.model")),1),s(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:h(()=>[(i(!0),_(N,null,G(e.options,c=>(i(),E(p,{key:c.value,label:c.label,value:c.value},{default:h(()=>[r("span",Ae,u(c.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var Ge=S(Ce,[["render",Ne],["__scopeId","data-v-62190314"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/ModelSelector.vue"]]);const De=V({name:"StartImageUrlInput",components:{ElUpload:he,ElButton:D,InfoIcon:ae,ImagePreview:we},data(){return{fileList:[],uploadUrl:ie()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>{var t;return(t=e==null?void 0:e.response)==null?void 0:t.file_url})},value:{get(){var e,t;return(t=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:t.first_image_url},set(){var t,o;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){I.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){I.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){I.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){var t,o;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Le={class:"relative"},Oe={class:"flex justify-between"},Me={class:"flex justify-start items-center"},je={class:"text-sm font-bold"};function qe(e,t,o,l,f,g){const p=a("info-icon"),m=a("image-preview"),c=a("el-button"),$=a("el-upload");return i(),_("div",Le,[r("div",Oe,[r("div",Me,[r("span",je,u(e.$t("hailuo.name.startImageUrl")),1),s(p,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),s($,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=d=>e.fileList=d),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"upload-wrapper","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:h(({file:d})=>{var v;return[s(m,{url:d.url||((v=d.response)==null?void 0:v.file_url),name:d.name,percentage:d.percentage,onRemove:w=>e.fileList.splice(e.fileList.indexOf(d),1)},null,8,["url","name","percentage","onRemove"])]}),default:h(()=>[s(c,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:h(()=>[y(u(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}var He=S(De,[["render",qe],["__scopeId","data-v-6c6b80d0"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/StartImageUrlInput.vue"]]);const Be="",ze=V({name:"PromptInput",components:{ElInput:fe,InfoIcon:ae},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.hailuo)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...(t=this.$store.state.hailuo)==null?void 0:t.config,prompt:e})}}},mounted(){this.value||(this.value=Be)}}),Fe={class:"field"},Je={class:"box"},Ke={class:"title font-bold"};function Qe(e,t,o,l,f,g){const p=a("info-icon"),m=a("el-input");return i(),_("div",Fe,[r("div",Je,[r("h2",Ke,u(e.$t("hailuo.name.prompt")),1),s(p,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var We=S(ze,[["render",Qe],["__scopeId","data-v-d785889c"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/PromptInput.vue"]]);const Xe=V({name:"PresetPanel",components:{ElButton:D,FontAwesomeIcon:j,PromptInput:We,StartImageUrlInput:He,ModelSelector:Ge},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ye={class:"panel"},Ze={class:"config"},xe={class:"actions"};function et(e,t,o,l,f,g){var v,w,n;const p=a("prompt-input"),m=a("model-selector"),c=a("start-image-url-input"),$=a("font-awesome-icon"),d=a("el-button");return i(),_("div",Ye,[r("div",Ze,[s(p,{class:"mb-4"}),s(m,{class:"mb-4"}),((v=e.config)==null?void 0:v.model)==="minimax-i2v"?(i(),E(c,{key:0,class:"mb-4"})):k("v-if",!0),r("div",xe,[((w=e.config)==null?void 0:w.video_url)!==void 0||((n=e.config)==null?void 0:n.custom)?(i(),E(d,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[s($,{icon:"fa-solid fa-magic",class:"mr-2"}),y(" "+u(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(i(),E(d,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[s($,{icon:"fa-solid fa-magic",class:"mr-2"}),y(" "+u(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])])}var tt=S(Xe,[["render",et],["__scopeId","data-v-01eef439"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/ConfigPanel.vue"]]);const ot=V({name:"VideoPlayer",components:{VuePlyr:ne},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),st=["data-poster"],at=["src"];function nt(e,t,o,l,f,g){const p=a("vue-plyr");return i(),_("div",null,[s(p,{options:e.options,class:"video"},{default:h(()=>{var m,c;return[r("video",{controls:"",crossorigin:"",playsinline:"","data-poster":(m=e.modelValue)==null?void 0:m.image_url},[r("source",{size:"1080",src:(c=e.modelValue)==null?void 0:c.video_url,type:"video/mp4"},null,8,at)],8,st)]}),_:1},8,["options"])])}var lt=S(ot,[["render",nt],["__scopeId","data-v-11ad7a93"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/VideoPlayer.vue"]]);const it=V({name:"TaskPreview",components:{ElImage:ge,CopyToClipboard:be,FontAwesomeIcon:j,ElAlert:$e,VideoPlayer:lt,ElTooltip:ve,ElButton:D},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.application},config(){var e;return(e=this.$store.state.hailuo)==null?void 0:e.config},videos(){var o,l,f,g,p,m,c;let e=[];const t=(l=(o=this.modelValue)==null?void 0:o.request)==null?void 0:l.action;return Array.isArray((g=(f=this.modelValue)==null?void 0:f.response)==null?void 0:g.data)&&((c=(m=(p=this.modelValue)==null?void 0:p.response)==null?void 0:m.data)==null||c.forEach($=>{let d=$;t&&(d.action=t),e.push(d)})),e}},methods:{onExtend(e,t){var o;e.stopPropagation(),console.debug("set config",t),this.$store.commit("hailuo/setConfig",{...(o=this.$store.state.hailuo)==null?void 0:o.config,video_id:t.video_id,prompt:t.prompt,action:"extend",thumbnail_url:t.thumbnail_url,video_url:t.video_url})},onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onReload(e){const t=e.target,o=new URL(t.src),l=o.searchParams.get("retry");if(!l)o.searchParams.set("retry","1");else if(parseInt(l)<2)o.searchParams.set("retry",(parseInt(l)+1).toString());else return;t.src=o.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),rt={class:"left"},ct={class:"main"},ut={class:"bot"},pt={class:"datetime"},dt={class:"info"},mt={key:0,class:"prompt mt-2"},_t={key:0},ht={key:1},ft={key:0,class:L({content:!0,failed:!0})},gt={class:"image-wrapper"},$t={key:0,class:L({operations:!0,"mt-2":!0})},vt={class:"description"},yt={key:1,class:L({content:!0})},kt={class:"description"},wt={class:"description"},bt={class:"description"},It={key:2,class:L({content:!0})},St={class:"description"};function Vt(e,t,o,l,f,g){const p=a("el-image"),m=a("VideoPlayer"),c=a("el-button"),$=a("el-tooltip"),d=a("font-awesome-icon"),v=a("copy-to-clipboard"),w=a("el-alert");return i(!0),_(N,null,G(e.videos,(n,U)=>{var C,R,P,A,q,H,B,z,F,J,K;return i(),_("div",{key:U,class:"preview"},[r("div",rt,[s(p,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),r("div",ct,[r("div",ut,[y(u(e.$t("hailuo.name.hailuoBot"))+" ",1),r("span",pt,u(e.$dayjs.format(""+new Date(parseFloat(((C=e.modelValue)==null?void 0:C.created_at)||"")*1e3))),1)]),r("div",dt,[(P=(R=e.modelValue)==null?void 0:R.request)!=null&&P.prompt?(i(),_("p",mt,[y(u((q=(A=e.modelValue)==null?void 0:A.request)==null?void 0:q.prompt)+" ",1),(H=e.modelValue)!=null&&H.response?k("v-if",!0):(i(),_("span",_t," - ("+u(e.$t("hailuo.status.pending"))+") ",1)),(n==null?void 0:n.state)==="processing"||(n==null?void 0:n.state)==="pending"||(n==null?void 0:n.state)==="running"?(i(),_("span",ht," - ("+u(e.$t("hailuo.status.processing"))+") ",1)):k("v-if",!0)])):k("v-if",!0)]),k(" Display success message "),((z=(B=e.modelValue)==null?void 0:B.response)==null?void 0:z.success)===!0?(i(),_("div",ft,[r("div",gt,[s(m,{"model-value":n},null,8,["model-value"])]),n?(i(),_("div",$t,[s($,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:h(()=>[s(c,{type:"info",size:"small",class:"btn-action",onClick:b=>e.onDownload(b,n==null?void 0:n.video_url)},{default:h(()=>[y(u(e.$t("hailuo.button.download")),1)]),_:2},1032,["onClick"])]),_:2},1032,["content"])])):k("v-if",!0),s(w,{closable:!1,class:"mt-2 success"},{default:h(()=>{var b,T;return[r("p",vt,[s(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.taskId"))+": "+u((b=e.modelValue)==null?void 0:b.id)+" ",1),s(v,{content:(T=e.modelValue)==null?void 0:T.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),((J=(F=e.modelValue)==null?void 0:F.response)==null?void 0:J.success)===!1?(i(),_("div",yt,[s(w,{closable:!1,class:"failure"},{template:h(()=>[s(d,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.failure")),1)]),default:h(()=>{var b,T,Q,W,X,Y,Z,x,ee,te,oe,se;return[r("p",kt,[s(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.taskId"))+": "+u((b=e.modelValue)==null?void 0:b.id)+" ",1),s(v,{content:(T=e.modelValue)==null?void 0:T.id,class:"btn-copy"},null,8,["content"])]),r("p",wt,[s(d,{icon:"fa-solid fa-circle-info",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.failureReason"))+": "+u((X=(W=(Q=e.modelValue)==null?void 0:Q.response)==null?void 0:W.error)==null?void 0:X.message)+" ",1),s(v,{content:(x=(Z=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:Z.error)==null?void 0:x.message,class:"btn-copy"},null,8,["content"])]),r("p",bt,[s(d,{icon:"fa-solid fa-hashtag",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.traceId"))+": "+u((te=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:te.trace_id)+" ",1),s(v,{content:(se=(oe=e.modelValue)==null?void 0:oe.response)==null?void 0:se.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),!((K=e.modelValue)!=null&&K.response)||(n==null?void 0:n.state)==="processing"||(n==null?void 0:n.state)==="pending"||(n==null?void 0:n.state)==="running"?(i(),_("div",It,[s(w,{closable:!1,class:"info"},{template:h(()=>[s(d,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.failure")),1)]),default:h(()=>{var b,T;return[r("p",St,[s(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+u(e.$t("hailuo.name.taskId"))+": "+u((b=e.modelValue)==null?void 0:b.id)+" ",1),s(v,{content:(T=e.modelValue)==null?void 0:T.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0)])])}),128)}var Pt=S(it,[["render",Vt],["__scopeId","data-v-3f5aedb7"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/task/Preview.vue"]]);const Tt=V({name:"RecentPanel",components:{TaskPreview:Pt,ElSkeleton:ye,ElSkeletonItem:ke},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,o,l;return{...(e=this.$store.state.hailuo)==null?void 0:e.tasks,items:(l=(o=(t=this.$store.state.hailuo)==null?void 0:t.tasks)==null?void 0:o.items)==null?void 0:l.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Et={key:0,class:"tasks"},Ct={class:"left"},Rt={class:"main"},Ut={key:1,class:"tasks"},At={key:2,class:"description"};function Nt(e,t,o,l,f,g){var $,d,v,w,n,U,C,R;const p=a("el-skeleton-item"),m=a("el-skeleton"),c=a("task-preview");return i(),_("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...P)=>e.onHandleScroll&&e.onHandleScroll(...P))},[(($=e.tasks)==null?void 0:$.items)===void 0?(i(),_("div",Et,[(i(),_(N,null,G(3,P=>r("div",{key:P,class:"task placeholder"},[r("div",Ct,[s(m,{animated:""},{template:h(()=>[s(p,{variant:"image",class:"avatar"})]),_:1})]),r("div",Rt,[s(m,{animated:""},{template:h(()=>[s(p,{variant:"p",class:"title"}),s(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):((v=(d=e.tasks)==null?void 0:d.items)==null?void 0:v.length)&&((n=(w=e.tasks)==null?void 0:w.items)==null?void 0:n.length)>0?(i(),_("div",Ut,[(i(!0),_(N,null,G((U=e.tasks)==null?void 0:U.items,(P,A)=>(i(),E(c,{key:A,"model-value":P,class:"preview"},null,8,["model-value"]))),128))])):k("v-if",!0),((R=(C=e.tasks)==null?void 0:C.items)==null?void 0:R.length)===0?(i(),_("p",At,u(e.$t("hailuo.message.noTasks")),1)):k("v-if",!0)],544)}var Gt=S(Tt,[["render",Nt],["__scopeId","data-v-7bff9d40"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/RecentPanel.vue"]]);const Dt="https://webhook.acedata.cloud/hailuo",Lt=V({name:"HailuoIndex",components:{ConfigPanel:tt,Layout:Ee,RecentPanel:Gt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.hailuo)==null?void 0:e.status)==null?void 0:t.getApplications)===O.Request},service(){return this.$store.state.hailuo.service},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},initializing(){return this.$store.state.hailuo.status.getApplications===O.Request},needApply(){return this.$store.state.hailuo.status.getApplications===O.Success&&!this.application},application(){return this.$store.state.hailuo.application},applications(){return this.$store.state.hailuo.applications},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){var o,l;((o=e==null?void 0:e.items)==null?void 0:o.length)>((l=t==null?void 0:t.items)==null?void 0:l.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,t,o;console.debug("reached top"),await this.onGetTasks({createdAtMax:(o=(t=(e=this.tasks)==null?void 0:e.items)==null?void 0:t[0])==null?void 0:o.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()},onApply(){re.create({application:this.application}).then(({data:e})=>{this.application=e,I.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var t,o;((o=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:o.code)===ce&&I.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:t=5,createdAtMin:o,createdAtMax:l}=e||{};console.debug("limit",t,"createdAtMin",o,"createdAtMax",l),await this.$store.dispatch("hailuo/getTasks",{limit:t,createdAtMin:o,createdAtMax:l})},async onGenerate(){var o;const e={...this.config,callback_url:Dt},t=(o=this.credential)==null?void 0:o.token;if(!t){console.error("no token specified");return}I.info(this.$t("hailuo.message.startingTask")),ue.generate(e,{token:t}).then(()=>{I.success(this.$t("hailuo.message.startTaskSuccess")),this.$store.commit("hailuo/setConfig",{config:void 0})}).catch(l=>{var g,p;const f=(g=l==null?void 0:l.response)==null?void 0:g.data;((p=f==null?void 0:f.error)==null?void 0:p.code)===pe?I.error(this.$t("hailuo.message.usedUp")):I.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ot(e,t,o,l,f,g){const p=a("config-panel"),m=a("recent-panel"),c=a("layout");return i(),E(c,null,{config:h(()=>[s(p,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:h(()=>[s(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var Xt=S(Lt,[["render",Ot],["__scopeId","data-v-1f8aa246"],["__file","/home/runner/work/Nexior/Nexior/src/pages/hailuo/Index.vue"]]);export{Xt as default};
|