@acedatacloud/nexior 3.5.0 → 3.5.1
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.0c0816f7.js → Auth.a90cc399.js} +1 -1
- package/dist/assets/{Callback.4ee50c3a.js → Callback.a82acc75.js} +1 -1
- package/dist/assets/{Chatdoc.0d355719.js → Chatdoc.5263125f.js} +1 -1
- package/dist/assets/{Console.1508b2bb.js → Console.83a7d90a.js} +1 -1
- package/dist/assets/{Conversation.7750a789.js → Conversation.33a8676d.js} +1 -1
- package/dist/assets/Conversation.fc58efa8.js +1 -0
- package/dist/assets/{CopyToClipboard.2d20734e.js → CopyToClipboard.dcbf7182.js} +1 -1
- package/dist/assets/{Detail.4e297711.js → Detail.24cd6940.js} +1 -1
- package/dist/assets/{EditArray.4e85afd6.js → EditArray.fc90290f.js} +1 -1
- package/dist/assets/{Extra.d5cd3529.js → Extra.d9e8ad3d.js} +1 -1
- package/dist/assets/{History.49f74045.js → History.d91b1f04.js} +1 -1
- package/dist/assets/{ImagePreview.d6abc713.js → ImagePreview.025cfc09.js} +1 -1
- package/dist/assets/{Index.35aec0de.js → Index.19d318b4.js} +1 -1
- package/dist/assets/Index.3d4c7011.js +1 -0
- package/dist/assets/Index.40702b91.js +1 -0
- package/dist/assets/{Index.bc14909f.js → Index.49dc3c46.js} +1 -1
- package/dist/assets/Index.503e0f7b.js +1 -0
- package/dist/assets/Index.5a7e5cc0.js +3 -0
- package/dist/assets/{Index.a960a1be.js → Index.646d79c3.js} +1 -1
- package/dist/assets/{Index.3c60148f.js → Index.6edc0543.js} +1 -1
- package/dist/assets/Index.76db79a3.js +1 -0
- package/dist/assets/{Index.e470bccd.js → Index.77acf7ce.js} +1 -1
- package/dist/assets/{Index.9a0bc85d.js → Index.7dada60b.js} +1 -1
- package/dist/assets/Index.9edce037.js +1 -0
- package/dist/assets/{Index.01f67d91.js → Index.f10f48b2.js} +1 -1
- package/dist/assets/{InfoIcon.5a350f1f.js → InfoIcon.b6bd8d58.js} +1 -1
- package/dist/assets/{Invitees.7decaaca.js → Invitees.9fba250b.js} +1 -1
- package/dist/assets/{List.91afc11f.js → List.011b2c71.js} +1 -1
- package/dist/assets/{List.86d591dc.js → List.67c11343.js} +1 -1
- package/dist/assets/{List.cebbf55e.js → List.69d56b67.js} +1 -1
- package/dist/assets/{Login.2228fb31.js → Login.4c26f374.js} +1 -1
- package/dist/assets/{Main.54e04e19.js → Main.421f61bd.js} +1 -1
- package/dist/assets/{Manage.db7fe09d.js → Manage.f12c92bd.js} +1 -1
- package/dist/assets/{MarkdownRenderer.2bf00ae2.js → MarkdownRenderer.3fb8276a.js} +1 -1
- package/dist/assets/{Navigator.778b9aca.js → Navigator.3204ea1d.js} +1 -1
- package/dist/assets/{Pagination.e3c91ab4.js → Pagination.3c242094.js} +1 -1
- package/dist/assets/{Setting.8a4e8a39.js → Setting.6cf3ec08.js} +1 -1
- package/dist/assets/Status.ce9bc4cb.js +1 -0
- package/dist/assets/{Subscribe.a2f42d1b.js → Subscribe.8bf14b5c.js} +1 -1
- package/dist/assets/{distribution.62c0b679.js → distribution.fd10b951.js} +1 -1
- package/dist/assets/{index.60bb4e0a.js → index.97386539.js} +3 -3
- package/dist/assets/{order.1ca24c7f.js → order.f1773d29.js} +1 -1
- package/dist/assets/{price.c9d715ac.js → price.cb59d1b0.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -1
- package/dist/assets/Conversation.ea9a6ab9.js +0 -1
- package/dist/assets/Index.15439550.js +0 -1
- package/dist/assets/Index.279159eb.js +0 -1
- package/dist/assets/Index.34f31b25.js +0 -1
- package/dist/assets/Index.7dc5f524.js +0 -1
- package/dist/assets/Index.7e50d1f1.js +0 -3
- package/dist/assets/Index.c25e9222.js +0 -1
- package/dist/assets/Status.54e386d8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var i=Object.defineProperty;var n=(r,t,e)=>t in r?i(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>(n(r,typeof t!="symbol"?t+"":t,e),e);import{B as a}from"./index.
|
|
1
|
+
var i=Object.defineProperty;var n=(r,t,e)=>t in r?i(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>(n(r,typeof t!="symbol"?t+"":t,e),e);import{B as a}from"./index.97386539.js";class y{constructor(){s(this,"key","orders")}async getAll(t){return await a.get(`/${this.key}/`,{params:t})}async get(t){return await a.get(`/${this.key}/${t}`)}async create(t){return await a.post(`/${this.key}/`,t)}async update(t,e){return await a.put(`/${this.key}/${t}`,e)}async refresh(t){return await a.post(`/${this.key}/${t}/refresh/`)}async pay(t,e){return await a.post(`/${this.key}/${t}/pay/`,e)}async updatePrice(t,e){return await a.post(`/${this.key}/${t}/update-price/`,e)}async finish(t){return await a.post(`/${this.key}/${t}/finish/`)}async delete(t){return await a.delete(`/${this.key}/${t}`)}}const c=new y;export{c as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as a,D as i}from"./index.
|
|
1
|
+
import{C as a,D as i}from"./index.97386539.js";const l=o=>{const e=a.state.exchange;let{value:t,currency:r=a.state.currency||"usd"}=o;const c=i[r];if(!e)return{value:t,currency:r,label:c};const n=`usd-${r}`,s=e[n];return s&&(t=t*s),console.log("new price",{value:t,currency:r}),{value:t,currency:r,label:c}},g=o=>{var n;let{value:e,defaultValue:t,fractionDigits:r=2}=o;if(e===void 0&&(e=t),e===void 0)return"";const c=l({value:e});return`${c.label}${(n=c.value)==null?void 0:n.toFixed(r)}`};export{g};
|
package/dist/index.html
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
s.parentNode.insertBefore(hm, s);
|
|
17
17
|
})();
|
|
18
18
|
</script>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index.
|
|
19
|
+
<script type="module" crossorigin src="/assets/index.97386539.js"></script>
|
|
20
20
|
<link rel="modulepreload" href="/assets/vendor-@vue.6c0309d3.js">
|
|
21
21
|
<link rel="modulepreload" href="/assets/vendor-element-plus.1fa87efb.js">
|
|
22
22
|
<link rel="modulepreload" href="/assets/vendor-markdown.cf3e96ae.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acedatacloud/nexior",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"author": "Ace Data Cloud <office@acedata.cloud>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"eslint-plugin-node": "^11.1.0",
|
|
102
102
|
"eslint-plugin-prettier": "^4.0.0",
|
|
103
103
|
"eslint-plugin-promise": "^5.0.0",
|
|
104
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
104
105
|
"eslint-plugin-vue": "^8.5.0",
|
|
105
106
|
"husky": "^7.0.2",
|
|
106
107
|
"postcss": "^8.4.32",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as le}from"./vendor-axios.168e6950.js";import{al as de}from"./vendor-others.cdfefb59.js";import{_ as D,N as J,O as N,P as oe,Q as ne,T as B,U as ce,V as ue,W as pe,X as me,Y as he,Z,$ as O,H as ge,A as _e,a0 as j,a1 as x,a2 as ee,K as Q,a3 as H,a4 as K,a5 as fe,a6 as $e,a7 as ye}from"./index.60bb4e0a.js";import{H as I,o as n,e as u,al as l,L as f,M as C,V as m,f as r,O as M,W,T as R,R as w,av as ve,U as L,ai as U,as as X,$ as T,S as z,P as G,aw as we,a0 as Ce,I as se}from"./vendor-@vue.6c0309d3.js";import{M as ke}from"./MarkdownRenderer.2bf00ae2.js";import{C as be}from"./CopyToClipboard.2d20734e.js";import{ar as A}from"./vendor-fortawesome.2b54ad1b.js";import{s as Y,S as Ee,I as Re,u as ae,m as Se,t as ie,x as qe,y as te,h as De,i as Ie,j as Ne,H as Ge,T as Ae}from"./vendor-element-plus.1fa87efb.js";import{I as Oe}from"./ImagePreview.d6abc713.js";import"./vendor-markdown.cf3e96ae.js";import"./vendor-qrcode.6ab44f81.js";import"./vendor-highlight.js.6ee9ffbc.js";const Te=I({name:"AnsweringMark",data(){return{}},computed:{conversationId(){var e,s;return(s=(e=this.$route.params)==null?void 0:e.id)==null?void 0:s.toString()}}}),Me={class:"mark"};function Le(e,s,o,p,h,a){return n(),u("div",Me)}var Ue=D(Te,[["render",Le],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/AnsweringMark.vue"]]);const Pe=I({name:"CopyToClipboard",components:{FontAwesomeIcon:A,ElTooltip:Y},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:["restart"],data(){return{copied:!1}},methods:{onRestart(){this.$emit("restart")}}});function Ve(e,s,o,p,h,a){const i=l("font-awesome-icon"),c=l("el-tooltip");return n(),f(c,{effect:"dark",content:e.$t("common.button.restart"),placement:"bottom"},{default:C(()=>[m(i,{icon:"fa-solid fa-sync",class:"icon-sync",onClick:e.onRestart},null,8,["onClick"])]),_:1},8,["content"])}var Fe=D(Pe,[["render",Ve],["__scopeId","data-v-18116778"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/RestartToGenerate.vue"]]);const He=I({name:"EditMessage",components:{FontAwesomeIcon:A,ElTooltip:Y},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:["click"],data(){return{copied:!1}},methods:{onEdit(){this.$emit("click")}}});function Be(e,s,o,p,h,a){const i=l("font-awesome-icon"),c=l("el-tooltip");return n(),u("span",null,[m(c,{effect:"dark",content:e.$t("common.button.restart"),placement:"bottom"},{default:C(()=>[m(i,{icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:e.onEdit},null,8,["onClick"])]),_:1},8,["content"])])}var We=D(He,[["render",Be],["__scopeId","data-v-5c26bf56"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/EditMessage.vue"]]);const je=I({name:"FilePreview",components:{FontAwesomeIcon:A,ElProgress:Ee},props:{name:{type:String,required:!0},percentage:{type:Number,required:!0},closable:{type:Boolean,required:!1,default:!0}},emits:["remove"],methods:{isImageUrl:J}}),Ke={class:"file"},ze={class:"left"},Qe={class:"wrapper"},Je={class:"right"},Xe={class:"text-xs font-bold truncate"},Ye={key:0,class:"close"};function Ze(e,s,o,p,h,a){const i=l("font-awesome-icon"),c=l("el-progress");return n(),u("div",Ke,[r("div",ze,[r("div",Qe,[m(i,{icon:"fa-regular fa-file-alt"}),M(m(c,{type:"circle","stroke-width":3,percentage:e.percentage,width:25},null,8,["percentage"]),[[W,e.percentage&&e.percentage<100]])])]),r("div",Je,[r("span",Xe,R(e.name),1)]),e.closable?(n(),u("div",Ye,[m(i,{icon:"fa-solid fa-xmark",class:"icon icon-close",onClick:s[0]||(s[0]=$=>e.$emit("remove"))})])):w("v-if",!0)])}var re=D(je,[["render",Ze],["__scopeId","data-v-0b782a78"],["__file","/home/runner/work/Nexior/Nexior/src/components/common/FilePreview.vue"]]);const xe=I({name:"Message",components:{EditMessage:We,CopyToClipboard:be,RestartToGenerate:Fe,AnsweringMark:Ue,MarkdownRenderer:ke,ElAlert:Re,FilePreview:re,ElButton:ae,ElImage:Se,ElInput:ie},props:{messages:{type:Array,required:!1,default:()=>[]},message:{type:Object,required:!0},application:{type:Object,required:!0}},emits:["stop","edit","restart"],data(){return{copied:!1,isEditing:!1,questionValue:this.message.content,messageState:N}},computed:{modelGroup(){return this.$store.state.chat.modelGroup},errorText(){var e,s,o;if(console.debug("error",this.message.error),!(!this.message.error||!((e=this.message.error)!=null&&e.code))){if((s=this.message.error)!=null&&s.message)return this.message.error.message;switch((o=this.message.error)==null?void 0:o.code){case Z:return this.$t("chat.message.errorUsedUp");case he:return this.$t("chat.message.errorApiError");case me:return this.$t("chat.message.errorBadRequest");case pe:return this.$t("chat.message.errorTimeout");case ue:return this.$t("chat.message.errorTooManyRequests");case ce:return this.$t("chat.message.errorContentTooLarge");case B:return this.$t("chat.message.errorNotApplied");case ne:return;case oe:default:return this.$t("chat.message.errorUnknown")}}},showBuyMore(){var e;return this.message.role===O&&((e=this.message.error)==null?void 0:e.code)===Z}},watch:{},methods:{startEditing(){this.isEditing=!0,this.questionValue=this.message.content,console.debug("start to get answer",this.message)},cancelEdit(){this.isEditing=!1},onRestart(){this.$emit("restart",this.message)},onEdit(){this.isEditing=!1,this.onSubmit()},onSubmit(){this.$emit("edit",this.message,this.questionValue)},onCopy(){de(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){var e;this.$router.push({name:ge,params:{id:(e=this.application)==null?void 0:e.id}})}}}),es=["role"],ss={class:"author"},ts={key:0,class:"main"},os={initial:{opacity:0,y:5},enter:{opacity:1,y:0,scale:1},delay:200,duration:300,layout:!0,transition:{enter:{delay:.2,duration:.5},layout:{duration:.3,easing:"ease-in-out"}},class:"content"},ns={key:0,class:"message-content"},as={key:1},is=["src"],rs={key:1,class:"edits"},ls={class:"flex justify-end"},ds={class:"operations"};function cs(e,s,o,p,h,a){var E;const i=l("el-image"),c=l("markdown-renderer"),$=l("file-preview"),y=l("el-input"),d=l("el-button"),t=l("answering-mark"),k=l("edit-message"),S=l("copy-to-clipboard"),g=l("restart-to-generate"),_=l("el-alert"),q=ve("motion");return n(),u("div",{class:G({message:!0,[e.message.role]:!0}),role:e.message.role},[r("div",ss,[e.message.role==="assistant"?(n(),f(i,{key:0,src:e.modelGroup.icon,fit:"cover",class:"avatar"},null,8,["src"])):w("v-if",!0)]),e.errorText?(n(),f(_,{key:1,class:"error",title:e.errorText,type:"error",closable:!1},null,8,["title"])):(n(),u("div",ts,[M((n(),u("div",os,[e.isEditing?(n(),u("div",rs,[m(y,{modelValue:e.questionValue,"onUpdate:modelValue":s[0]||(s[0]=v=>e.questionValue=v),type:"textarea",class:"mb-2",onKeydown:X(T(e.onEdit,["exact","prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),r("div",ls,[m(d,{round:"",onClick:e.cancelEdit},{default:C(()=>[z(R(e.$t("common.button.cancel")),1)]),_:1},8,["onClick"]),m(d,{type:"primary",class:"btn-confirm",round:"",onClick:e.onEdit},{default:C(()=>[z(R(e.$t("common.button.confirm")),1)]),_:1},8,["onClick"])])])):(n(),u("div",ns,[Array.isArray(e.message.content)?(n(),u("div",as,[(n(!0),u(L,null,U(e.message.content,(v,P)=>{var V,F;return n(),u("div",{key:P},[v.type==="image_url"?(n(),u("img",{key:0,src:typeof(v==null?void 0:v.image_url)=="string"?v.image_url:(V=v.image_url)==null?void 0:V.url,fit:"cover",class:"image"},null,8,is)):w("v-if",!0),v.file_url?(n(),f($,{key:1,name:typeof(v==null?void 0:v.file_url)=="string"?v.file_url:(F=v.file_url)==null?void 0:F.url,percentage:0,closable:!1,class:"mt-2"},null,8,["name"])):w("v-if",!0),v.type==="text"?(n(),f(c,{key:P,content:v.text},null,8,["content"])):w("v-if",!0)])}),128))])):(n(),f(c,{key:0,content:(E=e.message)==null?void 0:E.content},null,8,["content"]))])),e.message.state===e.messageState.PENDING?(n(),f(t,{key:2})):w("v-if",!0)])),[[q]]),r("div",ds,[e.message.role==="user"&&!e.isEditing&&!Array.isArray(e.message.content)?(n(),f(k,{key:0,class:"btn-edit",onClick:e.startEditing},null,8,["onClick"])):w("v-if",!0),!Array.isArray(e.message.content)&&(e.message.state===e.messageState.FINISHED||e.message.state===e.messageState.FAILED)?(n(),f(S,{key:1,content:e.message.content,class:"btn-copy"},null,8,["content"])):w("v-if",!0),!Array.isArray(e.message.content)&&(e.message.state===e.messageState.FINISHED||e.message.state===e.messageState.FAILED)&&e.message.role==="assistant"&&e.message===e.messages[e.messages.length-1]?(n(),f(g,{key:2,class:"btn-restart",messages:e.messages,onRestart:e.onRestart},null,8,["messages","onRestart"])):w("v-if",!0)])])),e.showBuyMore?(n(),f(d,{key:2,round:"",type:"primary",class:"btn btn-buy",size:"small",onClick:e.onBuyMore},{default:C(()=>[z(R(e.$t("common.button.buyMore")),1)]),_:1},8,["onClick"])):w("v-if",!0)],10,es)}var us=D(xe,[["render",cs],["__scopeId","data-v-f0476f80"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Message.vue"]]);const ps=I({name:"Composer",components:{FilePreview:re,ImagePreview:Oe,ElTooltip:Y,FontAwesomeIcon:A,ElUpload:qe},props:{disabled:{type:Boolean,required:!1,default:!1},references:{type:Array,required:!1,default:()=>[]},question:{type:String,required:!0}},emits:["update:question","update:references","submit","stop"],data(){return{inputHeight:"35px",questionValue:this.question,fileList:[],uploadUrl:_e()+"/api/v1/files/"}},computed:{model(){return this.$store.state.chat.model},modelGroup(){return this.$store.state.chat.modelGroup},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})}},watch:{urls(e){console.debug("File URLs:",e),e.length>0&&this.$emit("update:references",e)},questionValue(e){this.$emit("update:question",e)},question(e){e!==this.questionValue&&(this.questionValue=e)},references(e){console.debug("References updated:",e),e.length===0&&(this.fileList=[])}},methods:{isImageUrl:J,adjustTextareaHeight(){this.$nextTick(()=>{const e=this.$refs.textarea;e&&(e.style.height="35px",e.style.height=e.scrollHeight+"px")})},onSubmit(){!this.question||this.$emit("submit")},onStop(){this.$emit("stop")},onProgress(e,s,o){console.debug("File upload progress:",s.name,e.loaded,e.total)},onExceed(){te.warning(this.$t("chat.message.uploadReferencesExceed"))},onError(){te.error(this.$t("chat.message.uploadReferencesError"))}}}),ms={class:"composer"},hs={class:"tools"},gs=["disabled","placeholder"];function _s(e,s,o,p,h,a){const i=l("image-preview"),c=l("file-preview"),$=l("font-awesome-icon"),y=l("el-tooltip"),d=l("el-upload");return n(),u("div",ms,[r("div",hs,[m(d,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=t=>e.fileList=t),class:G({upload:!0,disabled:!e.model.isFileSupported||e.disabled}),disabled:!e.model.isFileSupported||e.disabled,name:"file",limit:10,multiple:!0,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-progress":e.onProgress,headers:e.headers},{file:C(({file:t})=>{var k;return[e.isImageUrl(t.name)?(n(),f(i,{key:0,url:t.url||((k=t.response)==null?void 0:k.file_url),name:t.name,percentage:t.percentage,onRemove:S=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,["url","name","percentage","onRemove"])):(n(),f(c,{key:1,name:t.name,percentage:t.percentage,onRemove:S=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,["name","percentage","onRemove"]))]}),default:C(()=>[m(y,{class:"box-item",effect:"dark",content:e.$t("chat.message.uploadFile"),placement:"bottom"},{default:C(()=>[r("span",{class:G({btn:!0,"btn-upload":!0,disabled:!e.model.isFileSupported||e.disabled})},[m($,{icon:"fa-solid fa-plus",class:"icon icon-attachment"})],2)]),_:1},8,["content"])]),_:1},8,["file-list","class","disabled","action","on-exceed","on-error","on-progress","headers"])]),M(r("span",{class:G({btn:!0,"btn-send":!0,disabled:!e.questionValue}),onClick:s[1]||(s[1]=(...t)=>e.onSubmit&&e.onSubmit(...t))},[m($,{icon:"fa-solid fa-location-arrow",class:"icon icon-send"})],2),[[W,!e.disabled]]),M(r("span",{class:G({btn:!0,"btn-stop":!0,disabled:!e.disabled}),onClick:s[2]||(s[2]=(...t)=>e.onStop&&e.onStop(...t))},[m($,{icon:"fa-solid fa-stop",class:"icon icon-stop"})],2),[[W,e.disabled]]),M(r("textarea",{ref:"textarea","onUpdate:modelValue":s[3]||(s[3]=t=>e.questionValue=t),disabled:e.disabled,class:"input",placeholder:e.$t("chat.message.newMessagePlaceholder"),style:Ce({height:e.inputHeight}),onKeydown:s[4]||(s[4]=X(T((...t)=>e.onSubmit&&e.onSubmit(...t),["exact","prevent"]),["enter"])),onInput:s[5]||(s[5]=(...t)=>e.adjustTextareaHeight&&e.adjustTextareaHeight(...t))},null,44,gs),[[we,e.questionValue]])])}var fs=D(ps,[["render",_s],["__scopeId","data-v-a443d292"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Composer.vue"]]);const $s=I({name:"ModelSelector",components:{ElDropdown:De,ElDropdownMenu:Ie,ElDropdownItem:Ne,FontAwesomeIcon:A},emits:["update:modelValue","select","model-group-changed","model-changed"],data(){return{options:[j,x,ee]}},computed:{model(){return console.log("model",this.$store.state.chat.model),this.$store.state.chat.model},modelGroup(){var e;return((e=this.$route.meta)==null?void 0:e.modelGroup)||j}},watch:{modelGroup(e){console.debug("modelGroup from route changed",e),this.$store.dispatch("chat/setModelGroup",e),this.$store.dispatch("chat/setModel",e.models[0])}},mounted(){console.debug("ModelSelector mounted, checking model group");const s=[j,x,ee].find(o=>o.name===this.modelGroup.name);console.debug("Found model group:",s),s&&(this.$store.dispatch("chat/setModelGroup",s),this.$store.dispatch("chat/setModel",s.models[0]))},methods:{onModelGroupChange(e){this.$store.dispatch("chat/setModelGroup",e),this.$emit("model-group-changed",e)},onModelChange(e){this.$store.dispatch("chat/setModel",e),this.$emit("model-changed",e)}}}),ys={class:"selector"},vs={class:"flex justify-center mr-1"},ws={class:"icon"},Cs=["src"],ks={class:"name"},bs={class:"angle"},Es={class:"item"},Rs={class:"icon"},Ss=["src"],qs={class:"info"},Ds={class:"name"},Is={class:"description"},Ns={class:"flex justify-center"},Gs={class:"name"},As={class:"angle"},Os={class:"item"},Ts={class:"info"},Ms={key:0,class:"name"},Ls={key:1,class:"description"};function Us(e,s,o,p,h,a){const i=l("font-awesome-icon"),c=l("el-dropdown-item"),$=l("el-dropdown-menu"),y=l("el-dropdown");return n(),u("div",ys,[M(m(y,{trigger:"click","popper-class":"popper"},{dropdown:C(()=>[m($,null,{default:C(()=>[(n(!0),u(L,null,U(e.options,(d,t)=>(n(),f(c,{key:t,onClick:k=>e.onModelGroupChange(d)},{default:C(()=>[r("div",Es,[r("div",Rs,[r("img",{src:d.icon},null,8,Ss)]),r("div",qs,[r("p",Ds,R(d.getDisplayName()),1),r("p",Is,R(d.getDescription()),1)])])]),_:2},1032,["onClick"]))),128))]),_:1})]),default:C(()=>{var d;return[r("div",vs,[r("span",ws,[r("img",{src:e.modelGroup.icon},null,8,Cs)]),r("span",ks,R((d=e.modelGroup)==null?void 0:d.getDisplayName()),1),r("span",bs,[m(i,{icon:"fa-solid fa-angle-down"})])])]}),_:1},512),[[W,!1]]),m(y,{trigger:"click","popper-class":"popper"},{dropdown:C(()=>[e.modelGroup&&e.modelGroup.models?(n(),f($,{key:0},{default:C(()=>[(n(!0),u(L,null,U(e.modelGroup.models,(d,t)=>(n(),f(c,{key:t,onClick:k=>e.onModelChange(d)},{default:C(()=>[r("div",Os,[r("div",Ts,[d.getDisplayName?(n(),u("p",Ms,R(d.getDisplayName()),1)):w("v-if",!0),d.getDescription?(n(),u("p",Ls,R(d.getDescription()),1)):w("v-if",!0)])])]),_:2},1032,["onClick"]))),128))]),_:1})):w("v-if",!0)]),default:C(()=>{var d;return[r("div",Ns,[r("span",Gs,R((d=e.model)==null?void 0:d.getDisplayName()),1),r("span",As,[m(i,{icon:"fa-solid fa-angle-down"})])])]}),_:1})])}var Ps=D($s,[["render",Us],["__scopeId","data-v-358d65be"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/ModelSelector.vue"]]);const Vs={},Fs={class:"disclaimer"};function Hs(e,s){return n(),u("p",Fs,R(e.$t("chat.message.howToUse")),1)}var Bs=D(Vs,[["render",Hs],["__scopeId","data-v-42e751f2"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Disclaimer.vue"]]);const Ws=I({name:"SidePanel",components:{ElInput:ie,FontAwesomeIcon:A,ElSkeleton:Ge},props:{},emits:["change-conversation"],computed:{modelGroup(){return this.$store.state.chat.modelGroup},conversationId(){var e,s,o;return console.debug("conversationId in side",(e=this.$route.params)==null?void 0:e.id),(o=(s=this.$route.params)==null?void 0:s.id)==null?void 0:o.toString()},conversationGroups(){var i,c,$,y,d,t,k,S;let e=this.$store.state.chat.conversations;console.debug("conversations",e),console.debug("modelGroup",this.modelGroup),e=e==null?void 0:e.filter(g=>{var _,q;return g.model&&((q=(_=this.modelGroup.models)==null?void 0:_.map(E=>E.name))==null?void 0:q.includes(g.model))}),console.debug("filtered conversations",e);const s=new Date;s.setHours(0,0,0,0);const o=new Date(s);o.setDate(o.getDate()-1);const p=new Date(s);p.setDate(p.getDate()-s.getDay());const h=new Date(p);h.setDate(h.getDate()-7);const a=e==null?void 0:e.reduce((g,_)=>{const q=new Date(_.updated_at*1e3);return q>=s?g.today.push(_):q>=o?g.yesterday.push(_):q>=p?g.thisWeek.push(_):g.earlier.push(_),g},{today:[],yesterday:[],thisWeek:[],earlier:[]});return{...((i=a==null?void 0:a.today)==null?void 0:i.length)>0?{today:(c=a==null?void 0:a.today)==null?void 0:c.sort((g,_)=>_.updated_at-g.updated_at)}:{},...(($=a==null?void 0:a.yesterday)==null?void 0:$.length)>0?{yesterday:(y=a==null?void 0:a.yesterday)==null?void 0:y.sort((g,_)=>_.updated_at-g.updated_at)}:{},...((d=a==null?void 0:a.thisWeek)==null?void 0:d.length)>0?{thisWeek:(t=a==null?void 0:a.thisWeek)==null?void 0:t.sort((g,_)=>_.updated_at-g.updated_at)}:{},...((k=a==null?void 0:a.earlier)==null?void 0:k.length)>0?{earlier:(S=a==null?void 0:a.earlier)==null?void 0:S.sort((g,_)=>_.updated_at-g.updated_at)}:{}}},application(){return this.$store.state.chat.application},loading(){return this.$store.state.chat.status.getConversations===Q.Request},token(){var e,s;return(s=(e=this.$store.state.chat)==null?void 0:e.credential)==null?void 0:s.token}},methods:{async onNewConversation(){console.debug("onNewConversation from side panel"),this.$emit("change-conversation",void 0)},async onConfirm(e){const s=this.token;if(!s){console.error("Token is not found");return}(e==null?void 0:e.deleting)&&e.id?(await H.deleteConversation(e.id,{token:s}),await this.$store.dispatch("chat/getConversations")):e!=null&&e.editing?(await H.updateConversation(e,{token:s}),await this.$store.dispatch("chat/getConversations")):e.editing=!0},onClickConversation(e){console.debug("onClickConversation in side panel",e),this.$emit("change-conversation",e)}}}),js={class:"panel"},Ks={key:1,class:"conversations"},zs={class:"icons"},Qs={class:"title"},Js={class:"key"},Xs=["onClick"],Ys={class:"title"},Zs={key:0},xs={key:1},et={key:2},st={class:"operations"};function tt(e,s,o,p,h,a){const i=l("el-skeleton"),c=l("font-awesome-icon"),$=l("el-input");return n(),u("div",js,[e.loading&&e.conversationGroups===void 0?(n(),f(i,{key:0})):(n(),u("div",Ks,[r("div",{class:"conversation",onClick:s[0]||(s[0]=(...y)=>e.onNewConversation&&e.onNewConversation(...y))},[r("div",zs,[m(c,{icon:"fa-solid fa-plus",class:"icon"})]),r("div",Qs,R(e.$t("chat.message.startNewChat")),1)]),(n(!0),u(L,null,U(e.conversationGroups,(y,d)=>(n(),u("div",{key:d,class:"group"},[r("div",Js,R(e.$t(`chat.group.${d}`)),1),(n(!0),u(L,null,U(y,(t,k)=>{var S,g,_,q;return n(),u("div",{key:k,class:G({conversation:!0,active:t.id===e.conversationId}),onClick:E=>e.onClickConversation(t.id)},[r("div",Ys,[t!=null&&t.deleting?(n(),u("span",Zs,R(`${e.$t("chat.message.confirmDelete")}?`),1)):t!=null&&t.editing?(n(),u("span",xs,[m($,{modelValue:t.title,"onUpdate:modelValue":E=>t.title=E,onKeydown:X(E=>e.onConfirm(t),["enter"])},null,8,["modelValue","onUpdate:modelValue","onKeydown"])])):(t==null?void 0:t.title)||(t==null?void 0:t.messages)?(n(),u("span",et,R((t==null?void 0:t.title)||((g=(S=t==null?void 0:t.messages)==null?void 0:S[(t==null?void 0:t.messages.length)-1])==null?void 0:g.content)||((q=(_=t==null?void 0:t.messages)==null?void 0:_[0])==null?void 0:q.content)),1)):w("v-if",!0)]),r("div",st,[!(t!=null&&t.editing)&&!t.deleting?(n(),f(c,{key:0,icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:T(E=>t.editing=!0,["stop"])},null,8,["onClick"])):w("v-if",!0),!(t!=null&&t.editing)&&!t.deleting?(n(),f(c,{key:1,icon:"fa-solid fa-trash",class:"icon icon-delete",onClick:T(E=>t.deleting=!0,["stop"])},null,8,["onClick"])):w("v-if",!0),(t==null?void 0:t.editing)||t.deleting?(n(),f(c,{key:2,icon:"fa-solid fa-check",class:"icon icon-confirm",onClick:T(E=>e.onConfirm(t),["stop"])},null,8,["onClick"])):w("v-if",!0),(t==null?void 0:t.editing)||t.deleting?(n(),f(c,{key:3,icon:"fa-solid fa-xmark",class:"icon icon-cancel",onClick:T(E=>{t.editing=!1,t.deleting=!1},["stop"])},null,8,["onClick"])):w("v-if",!0)])],10,Xs)}),128))]))),128))]))])}var ot=D(Ws,[["render",tt],["__scopeId","data-v-d866c834"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/SidePanel.vue"]]);const nt=I({name:"LayoutChat",components:{SidePanel:ot,ElDrawer:Ae,ElButton:ae,FontAwesomeIcon:A},emits:["change-conversation"],data(){return{drawer:!1}},methods:{onChangeConversation(e){console.debug("onChangeConversation in layout",e),this.$emit("change-conversation",e)}}}),at={class:"main"},it={class:"side"},rt={class:"chat"};function lt(e,s,o,p,h,a){const i=l("side-panel"),c=l("font-awesome-icon"),$=l("el-button"),y=l("el-drawer");return n(),u("div",at,[r("div",it,[se(e.$slots,"side",{},()=>[m(i,{onChangeConversation:e.onChangeConversation},null,8,["onChangeConversation"])],!0)]),r("div",rt,[se(e.$slots,"chat",{},void 0,!0)]),m($,{round:"",class:"menu",onClick:s[0]||(s[0]=d=>e.drawer=!0)},{default:C(()=>[m(c,{icon:"fa-solid fa-bars",class:"icon-menu"})]),_:1}),m(y,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=d=>e.drawer=d),"with-header":!1,size:"290px",class:"drawer"},{default:C(()=>[m(i)]),_:1},8,["modelValue"])])}var dt=D(nt,[["render",lt],["__scopeId","data-v-8d7a06d2"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Chat.vue"]]);const ct=I({name:"ChatConversation",components:{Composer:fs,Disclaimer:Bs,ModelSelector:Ps,Message:us,Layout:dt},data(){var e,s;return{drawer:!1,question:"",references:[],upload:!1,answering:!1,canceler:void 0,messages:((s=(e=this.$store.state.chat.conversations)==null?void 0:e.find(o=>{var p;return o.id===((p=this.$route.params.id)==null?void 0:p.toString())}))==null?void 0:s.messages)||[]}},computed:{modelGroup(){return this.$store.state.chat.modelGroup},model(){return this.$store.state.chat.model},conversationId(){var e;return(e=this.$route.params.id)==null?void 0:e.toString()},conversation(){var e;return(e=this.$store.state.chat.conversations)==null?void 0:e.find(s=>s.id===this.conversationId)},service(){return this.$store.state.chat.service},application(){return this.$store.state.chat.application},applications(){return this.$store.state.chat.applications},credential(){var e;return(e=this.$store.state.chat)==null?void 0:e.credential},needApply(){return this.$store.state.chat.status.getApplications===Q.Success&&!this.application},conversations(){return this.$store.state.chat.conversations},initializing(){return this.$store.state.chat.status.getApplications===Q.Request}},watch:{async references(e){console.log("references changed",e)},async modelGroup(e){console.debug("modelGroup changed",e)},async conversationId(e){console.debug("conversationId changed",e)}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onGetConversations()},methods:{async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("chat/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("chat/getApplications"),console.debug("end onGetApplication")},async onGetConversations(){console.debug("start onGetConversations"),await this.$store.dispatch("chat/getConversations"),console.debug("end onGetConversations")},async onDraft(e){this.question=e,this.onSubmit()},async onStop(){this.canceler&&(this.canceler.abort(),this.answering=!1)},async onRestart(e){var c,$,y,d,t,k,S,g,_,q,E,v,P,V,F;const s=this.messages.findIndex(b=>b===e),o=this.messages[s-1];let p=[];if(s!==-1){if(p=this.messages.slice(0,s-1),this.messages=this.messages.slice(0,s),this.references=[],typeof o.content=="string")this.question=o.content;else if(Array.isArray(o.content))for(let b=0;b<(o==null?void 0:o.content.length);b++)o.content[b].type==="image_url"&&(typeof(($=(c=o==null?void 0:o.content)==null?void 0:c[b])==null?void 0:$.image_url)=="string"?this.references.push((d=(y=o==null?void 0:o.content)==null?void 0:y[b])==null?void 0:d.image_url):this.references.push((S=(k=(t=o==null?void 0:o.content)==null?void 0:t[b])==null?void 0:k.image_url)==null?void 0:S.url)),o.content[b].type==="file_url"&&(typeof((_=(g=o==null?void 0:o.content)==null?void 0:g[b])==null?void 0:_.file_url)=="string"?this.references.push((E=(q=o==null?void 0:o.content)==null?void 0:q[b])==null?void 0:E.file_url):this.references.push((V=(P=(v=o==null?void 0:o.content)==null?void 0:v[b])==null?void 0:P.file_url)==null?void 0:V.url)),o.content[b].type==="text"&&(this.question=o.content[b].text)}console.debug("onRestart!",this.question,JSON.stringify(this.references));const h=(F=this.credential)==null?void 0:F.token,a=this.question;if(!h||!a){console.error("no token or endpoint or question"),this.messages.push({error:{code:B},role:O,state:N.FAILED});return}let i=this.conversationId;H.updateConversation({id:this.conversationId,messages:p},{token:h}).then(async()=>{await this.$store.dispatch("chat/setConversation",{id:i,messages:this.messages}),console.debug("finished update conversation",this.messages),console.debug("onRestart",this.question),await this.onRequest()}).catch(b=>{this.handleRequestError(b)})},async onEdit(e,s){var a;const o=this.messages.findIndex(i=>i===e);o!==-1&&(this.messages=this.messages.slice(0,o)),this.question=s;const p=(a=this.credential)==null?void 0:a.token;if(!p){console.error("no token or endpoint or question"),this.messages.push({error:{code:B},role:O,state:N.FAILED});return}let h=this.conversationId;H.updateConversation({id:this.conversationId,messages:this.messages},{token:p}).then(async()=>{await this.$store.dispatch("chat/setConversation",{id:h,messages:this.messages}),console.debug("finished update conversation",this.messages),this.messages.push({content:this.question,role:K}),console.debug("onEdit",this.question),await this.onRequest()}).catch(i=>{this.handleRequestError(i)})},async onNewConversation(){this.$router.push({params:{id:""}}),this.messages=[],this.question="",this.references=[]},async onRestoreConversation(e){var i;console.debug("onRestoreConversation id",e),console.debug("onRestoreConversation route",this.$route);const s=this.$router.resolve({path:this.$route.path,params:{id:e}});console.debug("onRestoreConversation newRoute",s),this.$router.push(s);const o=(i=this.conversations)==null?void 0:i.find(c=>c.id===e),p=o==null?void 0:o.model;console.debug("conversation model",p);const h=fe.find(c=>c.name===p);console.debug("target model",h);const a=$e.find(c=>c.name===(h==null?void 0:h.modelGroup));console.debug("target model group",a),this.$store.dispatch("chat/setModelGroup",a),this.$store.dispatch("chat/setModel",h),this.messages=(o==null?void 0:o.messages)||[],this.onScrollDown()},async onChangeConversation(e){console.log("onChangeConversation in conversation",e),e?this.onRestoreConversation(e):this.onNewConversation()},async onSubmit(){if(this.references.length>0){let e=[];e.push({type:"text",text:this.question});for(let s=0;s<this.references.length;s++)J(this.references[s])?e.push({type:"image_url",image_url:this.references[s]}):e.push({type:"file_url",file_url:this.references[s]});this.messages.push({content:e,role:K})}else this.messages.push({content:this.question,role:K});console.debug("onSubmit",this.question,this.references),await this.onRequest()},async onRequest(){var h;console.debug("start to get answer",this.messages);const e=(h=this.credential)==null?void 0:h.token,s=this.question,o=this.references;if(console.debug("validated",s,o),this.question="",this.references=[],!e||!s){console.error("no token or endpoint or question"),this.messages.push({error:{code:B},role:O,state:N.FAILED});return}let p=this.conversationId;this.messages.push({content:"",role:O,state:N.PENDING}),console.debug("start to get answer",this.messages),this.onScrollDown(),this.answering=!0,this.canceler=new AbortController,H.chatConversation({question:s,model:this.model.name,references:o,id:this.conversationId,stateful:!0},{token:e,stream:a=>{console.debug("stream response",a);const i=this.messages[this.messages.length-1];this.messages[this.messages.length-1]={role:O,content:a.answer,state:(i==null?void 0:i.state)!==N.FINISHED?N.ANSWERING:i==null?void 0:i.state},p=a==null?void 0:a.id},signal:this.canceler.signal}).then(async()=>{console.debug("finished fetch answer",this.messages),this.messages[this.messages.length-1].state=N.FINISHED,console.debug("finished fetch answer",JSON.stringify(this.messages)),await this.$store.dispatch("chat/setConversation",{id:p,messages:this.messages}),this.answering=!1,p&&await this.$router.push({params:{id:p}}),this.onScrollDown(),await this.$store.dispatch("chat/getConversations"),await this.$store.dispatch("chat/getApplications")}).catch(a=>{this.handleRequestError(a)})},async handleRequestError(e){if(console.error("error happened",e),this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].state=N.FAILED),e.name==="AbortError"){console.error("aborted");return}else e instanceof ye?(console.debug("BaseError",e),this.messages[this.messages.length-1].error={code:e.code,message:e.detail}):le.isCancel(e)?this.messages[this.messages.length-1].error={code:ne}:this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error={code:oe});this.answering=!1},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".messages");!e||!this.messages||this.messages.length===0||(e.scrollTop=e==null?void 0:e.scrollHeight)},0)}}}),ut={key:0,class:"messages"},pt={class:"starter"};function mt(e,s,o,p,h,a){const i=l("model-selector"),c=l("message"),$=l("composer"),y=l("disclaimer"),d=l("layout");return n(),f(d,{onChangeConversation:s[4]||(s[4]=t=>e.onChangeConversation(t))},{chat:C(()=>[m(i,{class:"selector",onModelGroupChanged:s[0]||(s[0]=t=>e.onChangeConversation(void 0))}),r("div",{class:G({dialogue:!0,empty:e.messages.length===0})},[e.messages.length>0?(n(),u("div",ut,[(n(!0),u(L,null,U(e.messages,(t,k)=>(n(),f(c,{key:k,message:t,messages:e.messages,question:e.question,application:e.application,class:"message","onUpdate:question":s[1]||(s[1]=S=>e.question=S),onEdit:e.onEdit,onRestart:e.onRestart},null,8,["message","messages","question","application","onEdit","onRestart"]))),128))])):w("v-if",!0),r("div",pt,[m($,{question:e.question,"onUpdate:question":s[2]||(s[2]=t=>e.question=t),disabled:e.answering,references:e.references,"onUpdate:references":s[3]||(s[3]=t=>e.references=t),onSubmit:e.onSubmit,onStop:e.onStop},null,8,["question","disabled","references","onSubmit","onStop"]),m(y,{class:"disclaimer"})])],2)]),_:1})}var Rt=D(ct,[["render",mt],["__scopeId","data-v-3ab2fb26"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chat/Conversation.vue"]]);export{Rt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{an as ne}from"./vendor-others.cdfefb59.js";import{ar as j}from"./vendor-fortawesome.2b54ad1b.js";import{_ as S,aT as le,A as ie,K as O,F as re,M as ce,aU as ue,Z as pe}from"./index.60bb4e0a.js";import{T as de,u as L,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 n,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 D}from"./vendor-@vue.6c0309d3.js";import{I as ae}from"./InfoIcon.5a350f1f.js";import{I as we}from"./ImagePreview.d6abc713.js";import{C as be}from"./CopyToClipboard.2d20734e.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:L,FontAwesomeIcon:j},data(){return{drawer:!1}}}),Se={class:"main"},Ve={class:"config"},Pe={class:"result"};function Te(e,t,o,a,f,g){const p=n("font-awesome-icon"),m=n("el-button"),c=n("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,a,f,g){const p=n("el-option"),m=n("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 Le=V({name:"StartImageUrlInput",components:{ElUpload:he,ElButton:L,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(e){var o,a;const t=(o=this.urls)==null?void 0:o[0];this.$store.commit("hailuo/setConfig",{...(a=this.$store.state.hailuo)==null?void 0:a.config,first_image_url:t})}}},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()}}}),De={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,a,f,g){const p=n("info-icon"),m=n("image-preview"),c=n("el-button"),$=n("el-upload");return i(),_("div",De,[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(Le,[["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"},Ke={class:"box"},Ze={class:"title font-bold"};function Je(e,t,o,a,f,g){const p=n("info-icon"),m=n("el-input");return i(),_("div",Fe,[r("div",Ke,[r("h2",Ze,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 Qe=S(ze,[["render",Je],["__scopeId","data-v-d785889c"],["__file","/home/runner/work/Nexior/Nexior/src/components/hailuo/config/PromptInput.vue"]]);const We=V({name:"PresetPanel",components:{ElButton:L,FontAwesomeIcon:j,PromptInput:Qe,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")}}}),Xe={class:"panel"},Ye={class:"config"},xe={class:"actions"};function et(e,t,o,a,f,g){var v,w,l;const p=n("prompt-input"),m=n("model-selector"),c=n("start-image-url-input"),$=n("font-awesome-icon"),d=n("el-button");return i(),_("div",Xe,[r("div",Ye,[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||((l=e.config)==null?void 0:l.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(We,[["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,a,f,g){const p=n("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:L},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,a,f,g,p,m,c;let e=[];const t=(a=(o=this.modelValue)==null?void 0:o.request)==null?void 0:a.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),a=o.searchParams.get("retry");if(!a)o.searchParams.set("retry","1");else if(parseInt(a)<2)o.searchParams.set("retry",(parseInt(a)+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:D({content:!0,failed:!0})},gt={class:"image-wrapper"},$t={key:0,class:D({operations:!0,"mt-2":!0})},vt={class:"description"},yt={key:1,class:D({content:!0})},kt={class:"description"},wt={class:"description"},bt={class:"description"},It={key:2,class:D({content:!0})},St={class:"description"};function Vt(e,t,o,a,f,g){const p=n("el-image"),m=n("VideoPlayer"),c=n("el-button"),$=n("el-tooltip"),d=n("font-awesome-icon"),v=n("copy-to-clipboard"),w=n("el-alert");return i(!0),_(N,null,G(e.videos,(l,A)=>{var C,U,P,R,q,H,B,z,F,K,Z;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)),(l==null?void 0:l.state)==="processing"||(l==null?void 0:l.state)==="pending"||(l==null?void 0:l.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":l},null,8,["model-value"])]),l?(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,l==null?void 0:l.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 "),((K=(F=e.modelValue)==null?void 0:F.response)==null?void 0:K.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,J,Q,W,X,Y,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((W=(Q=(J=e.modelValue)==null?void 0:J.response)==null?void 0:Q.error)==null?void 0:W.message)+" ",1),s(v,{content:(x=(Y=(X=e.modelValue)==null?void 0:X.response)==null?void 0:Y.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 "),!((Z=e.modelValue)!=null&&Z.response)||(l==null?void 0:l.state)==="processing"||(l==null?void 0:l.state)==="pending"||(l==null?void 0:l.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,a;return{...(e=this.$store.state.hailuo)==null?void 0:e.tasks,items:(a=(o=(t=this.$store.state.hailuo)==null?void 0:t.tasks)==null?void 0:o.items)==null?void 0:a.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,a,f,g){var $,d,v,w,l,A,C,U;const p=n("el-skeleton-item"),m=n("el-skeleton"),c=n("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)&&((l=(w=e.tasks)==null?void 0:w.items)==null?void 0:l.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 Lt="https://webhook.acedata.cloud/hailuo",Dt=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,a;((o=e==null?void 0:e.items)==null?void 0:o.length)>((a=t==null?void 0:t.items)==null?void 0:a.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:a}=e||{};console.debug("limit",t,"createdAtMin",o,"createdAtMax",a),await this.$store.dispatch("hailuo/getTasks",{limit:t,createdAtMin:o,createdAtMax:a})},async onGenerate(){var o;const e={...this.config,callback_url:Lt},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(a=>{var g,p;const f=(g=a==null?void 0:a.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,a,f,g){const p=n("config-panel"),m=n("recent-panel"),c=n("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 Wt=S(Dt,[["render",Ot],["__scopeId","data-v-1f8aa246"],["__file","/home/runner/work/Nexior/Nexior/src/pages/hailuo/Index.vue"]]);export{Wt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./vendor-others.cdfefb59.js";import{ar as j}from"./vendor-fortawesome.2b54ad1b.js";import{_ as w,A as ne,K as L,F as ie,M as le,aV as re,Z as ce}from"./index.60bb4e0a.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 as n,e as c,f as d,I as M,V as t,M as u,T as l,S as v,U as A,ai as E,L as D,R as $,P as U,m as $e}from"./vendor-@vue.6c0309d3.js";import{I as ye}from"./InfoIcon.5a350f1f.js";import{A as be}from"./Status.54e386d8.js";import{C as ke}from"./CopyToClipboard.2d20734e.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,o,_,g){const p=r("font-awesome-icon"),h=r("el-button"),i=r("el-drawer");return n(),c("div",Ie,[d("div",Se,[M(e.$slots,"config",{},void 0,!0)]),d("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(p,{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 Ae=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"},Pe={class:"title font-bold"},Ge={class:"upload-wrapper"};function Re(e,s,a,o,_,g){const p=r("el-button"),h=r("el-upload"),i=r("info-icon");return n(),c("div",Ee,[d("h2",Pe,l(e.$t("headshots.name.endImageUrls")),1),d("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(p,{size:"small",type:"primary",round:""},{default:u(()=>[v(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 Ue=w(Ae,[["render",Re],["__scopeId","data-v-69ae8722"],["__file","/home/runner/work/Nexior/Nexior/src/components/headshots/config/ImageUrlsInput.vue"]]);const Ne="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=Ne)}}),Le={class:"field"},Me={class:"title font-bold"};function je(e,s,a,o,_,g){const p=r("el-radio-button"),h=r("el-radio-group");return n(),c("div",Le,[d("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(()=>[(n(!0),c(A,null,E(e.options,i=>(n(),D(p,{key:i.value,label:i.value},{default:u(()=>[v(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,o,_,g){const p=r("el-image"),h=r("el-tab-pane"),i=r("el-tabs");return n(),c("div",Be,[$(` <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(()=>[(n(!0),c(A,null,E(e.elements,(m,f)=>(n(),D(h,{key:f,label:m.displayName,name:f,class:"pane"},{default:u(()=>[(n(!0),c(A,null,E(m.items,(k,V)=>(n(),c("div",{key:V,class:U({item:!0,active:e.value===k.value}),onClick:C=>e.onToggle(k.value)},[t(p,{src:k.image,fit:"fill",class:"preview"},null,8,["src"]),d("span",qe,l(k.label),1)],10,He))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}var Ke=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:Ue,ElButton:O,FontAwesomeIcon:j,ElementsSelector:Ke},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"},Ze={class:"config"},Je={class:"actions"};function Qe(e,s,a,o,_,g){const p=r("elements-selector"),h=r("mode-selector"),i=r("image-urls-input"),m=r("font-awesome-icon"),f=r("el-button");return n(),c("div",Xe,[d("div",Ze,[t(p,{class:"mb-4"}),t(h,{class:"mb-4"}),t(i,{class:"mb-4"}),d("div",Je,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(m,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+l(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}var Ye=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 o,_,g;return((g=(_=(o=e.modelValue)==null?void 0:o.response)==null?void 0:_.data)==null?void 0:g.slice(0,2))||[]}),viewImage:o=>{window.open(o,"_blank")}}}}),es={class:"image-gallery"},ss=["src"],ts=["onClick"];function as(e,s,a,o,_,g){return n(),c("div",es,[(n(!0),c(A,null,E(e.images,(p,h)=>(n(),c("div",{key:h,class:"image-container"},[d("img",{src:p.image_url,alt:"Image"},null,8,ss),d("button",{class:"view-button",onClick:i=>e.viewImage(p.image_url)},l(e.$t("headshots.button.viewImage")),9,ts)]))),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),o=a.searchParams.get("retry");if(!o)a.searchParams.set("retry","1");else if(parseInt(o)<2)a.searchParams.set("retry",(parseInt(o)+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:U({content:!0,failed:!0})},gs={class:"image-wrapper"},fs={class:"description"},vs={key:1,class:U({content:!0})},$s={class:"description"},ys={class:"description"},bs={class:"description"},ks={key:2,class:U({content:!0})},ws={class:"description"},Is={key:3,class:U({content:!0})},Ss={class:"description"};function Ts(e,s,a,o,_,g){var k,V,C,P,G,R,S,N,z,B,H,q,F,K,W;const p=r("el-image"),h=r("image-gallery"),i=r("font-awesome-icon"),m=r("copy-to-clipboard"),f=r("el-alert");return n(),c("div",is,[d("div",ls,[t(p,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),d("div",rs,[d("div",cs,[v(l(e.$t("headshots.name.headshotsBot"))+" ",1),d("span",ds,l(e.$dayjs.format(""+new Date(parseFloat(((k=e.modelValue)==null?void 0:k.created_at)||"")*1e3))),1)]),d("div",ps,[(C=(V=e.modelValue)==null?void 0:V.request)!=null&&C.template?(n(),c("p",ms,[v(l((G=(P=e.modelValue)==null?void 0:P.request)==null?void 0:G.template)+" ",1),(R=e.modelValue)!=null&&R.response?$("v-if",!0):(n(),c("span",us," - ("+l(e.$t("headshots.status.pending"))+") ",1)),((N=(S=e.modelValue)==null?void 0:S.response)==null?void 0:N.status)==="unknown"?(n(),c("span",hs," - ("+l(e.$t("headshots.status.processing"))+") ",1)):$("v-if",!0)])):$("v-if",!0)]),$(" Display success message "),((B=(z=e.modelValue)==null?void 0:z.response)==null?void 0:B.success)===!0?(n(),c("div",_s,[d("div",gs,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:u(()=>{var y,b;return[d("p",fs,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+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})])):$("v-if",!0),$(" Display error message "),((q=(H=e.modelValue)==null?void 0:H.response)==null?void 0:q.success)===!1?(n(),c("div",vs,[t(f,{closable:!1,class:"failure"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b,X,Z,J,Q,Y,x,ee,se,te,ae;return[d("p",$s,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+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"])]),d("p",ys,[t(i,{icon:"fa-solid fa-circle-info",class:"mr-1"}),v(" "+l(e.$t("headshots.name.failureReason"))+": "+l((J=(Z=(X=e.modelValue)==null?void 0:X.response)==null?void 0:Z.error)==null?void 0:J.message)+" ",1),t(m,{content:(x=(Y=(Q=e.modelValue)==null?void 0:Q.response)==null?void 0:Y.error)==null?void 0:x.message,class:"btn-copy"},null,8,["content"])]),d("p",bs,[t(i,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+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})])):$("v-if",!0),$(" Display error message "),(F=e.modelValue)!=null&&F.response?$("v-if",!0):(n(),c("div",ks,[t(f,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[d("p",ws,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+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=(K=e.modelValue)==null?void 0:K.response)==null?void 0:W.status)==="unknown"?(n(),c("div",Is,[t(f,{closable:!1,class:"info"},{template:u(()=>[t(i,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+l(e.$t("headshots.name.failure")),1)]),default:u(()=>{var y,b;return[d("p",Ss,[t(i,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+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})])):$("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,o;return{...(e=this.$store.state.headshots)==null?void 0:e.tasks,items:(o=(a=(s=this.$store.state.headshots)==null?void 0:s.tasks)==null?void 0:a.items)==null?void 0:o.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),As={key:0,class:"tasks"},Es={class:"left"},Ps={class:"main"},Gs={key:1,class:"tasks"},Rs={key:2,class:"description"};function Us(e,s,a,o,_,g){var m,f,k,V,C,P,G,R;const p=r("el-skeleton-item"),h=r("el-skeleton"),i=r("task-preview");return n(),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?(n(),c("div",As,[(n(),c(A,null,E(3,S=>d("div",{key:S,class:"task placeholder"},[d("div",Es,[t(h,{animated:""},{template:u(()=>[t(p,{variant:"image",class:"avatar"})]),_:1})]),d("div",Ps,[t(h,{animated:""},{template:u(()=>[t(p,{variant:"p",class:"title"}),t(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):((k=(f=e.tasks)==null?void 0:f.items)==null?void 0:k.length)&&((C=(V=e.tasks)==null?void 0:V.items)==null?void 0:C.length)>0?(n(),c("div",Gs,[(n(!0),c(A,null,E((P=e.tasks)==null?void 0:P.items,(S,N)=>(n(),D(i,{key:N,"model-value":S,class:"preview"},null,8,["model-value"]))),128))])):$("v-if",!0),((R=(G=e.tasks)==null?void 0:G.items)==null?void 0:R.length)===0?(n(),c("p",Rs,l(e.$t("headshots.message.noTasks")),1)):$("v-if",!0)],544)}var Ns=w(Cs,[["render",Us],["__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:Ye,Layout:Ce,ApplicationStatus:be,RecentPanel:Ns},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,o;((a=e==null?void 0:e.items)==null?void 0:a.length)>((o=s==null?void 0:s.items)==null?void 0:o.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:o}=e||{};console.debug("limit",s,"createdAtMin",a,"createdAtMax",o),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:a,createdAtMax:o})},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(o=>{var g,p;const _=(g=o==null?void 0:o.response)==null?void 0:g.data;((p=_==null?void 0:_.error)==null?void 0:p.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,o,_,g){const p=r("config-panel"),h=r("application-status"),i=r("recent-panel"),m=r("layout");return n(),D(m,null,{config:u(()=>[t(p,{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]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(i,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),$(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var Js=w(Ls,[["render",Ms],["__scopeId","data-v-62da1b28"],["__file","/home/runner/work/Nexior/Nexior/src/pages/headshots/Index.vue"]]);export{Js as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./vendor-others.cdfefb59.js";import{ar as F}from"./vendor-fortawesome.2b54ad1b.js";import{_ as I,aR as ne,K as M,F as ae,M as le,aS as re,Z as ie}from"./index.60bb4e0a.js";import{T as ce,u as L,N as ue,O as de,t as pe,m as _e,I as me,s as fe,H as he,R as ve,y as T}from"./vendor-element-plus.1fa87efb.js";import{H as V,al as r,o as n,e as p,f as l,I as O,V as s,M as f,T as a,U as R,ai as E,L as A,S as g,R as k,P as D}from"./vendor-@vue.6c0309d3.js";import{I as $e}from"./InfoIcon.5a350f1f.js";import{C as ge}from"./CopyToClipboard.2d20734e.js";import"./vendor-markdown.cf3e96ae.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.6ab44f81.js";const ke=V({name:"LayoutFlux",components:{ElDrawer:ce,ElButton:L,FontAwesomeIcon:F},data(){return{drawer:!1}}}),ye={class:"main"},we={class:"config"},be={class:"result"};function xe(e,t,o,i,h,v){const u=r("font-awesome-icon"),_=r("el-button"),d=r("el-drawer");return n(),p("div",ye,[l("div",we,[O(e.$slots,"config",{},void 0,!0)]),l("div",be,[O(e.$slots,"result",{},void 0,!0)]),s(_,{round:"",class:"menu",onClick:t[0]||(t[0]=$=>e.drawer=!0)},{default:f(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(d,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=$=>e.drawer=$),"with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[O(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ie=I(ke,[["render",xe],["__scopeId","data-v-324e8ab0"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Flux.vue"]]);const Ve=V({name:"ModelSelector",components:{ElSelect:ue,ElOption:de},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux",label:"flux"},{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"}]}},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.flux)==null?void 0:e.config)==null?void 0:t.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=ne)}}),Se={class:"field"},Te={class:"title font-bold"};function Ce(e,t,o,i,h,v){const u=r("el-option"),_=r("el-select");return n(),p("div",Se,[l("h2",Te,a(e.$t("flux.name.model")),1),s(_,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(n(!0),p(R,null,E(e.options,d=>(n(),A(u,{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var Ge=I(Ve,[["render",Ce],["__scopeId","data-v-8a0bbbfe"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/config/ModelSelector.vue"]]);const Ae="",Pe=V({name:"PromptInput",components:{ElInput:pe,InfoIcon:$e},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.flux)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...(t=this.$store.state.flux)==null?void 0:t.config,prompt:e})}}},mounted(){this.value||(this.value=Ae)}}),Ne={class:"field"},Re={class:"box"},Ee={class:"title font-bold"};function De(e,t,o,i,h,v){const u=r("info-icon"),_=r("el-input");return n(),p("div",Ne,[l("div",Re,[l("h2",Ee,a(e.$t("flux.name.prompt")),1),s(u,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),s(_,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=d=>e.prompt=d),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Me=I(Pe,[["render",De],["__scopeId","data-v-76c331df"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/config/PromptInput.vue"]]);const Oe=V({name:"PresetPanel",components:{ElButton:L,FontAwesomeIcon:F,PromptInput:Me,ModelSelector:Ge},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.flux)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Fe={class:"panel"},Le={class:"config"},Ue={class:"actions"};function qe(e,t,o,i,h,v){var m,y;const u=r("prompt-input"),_=r("model-selector"),d=r("font-awesome-icon"),$=r("el-button");return n(),p("div",Fe,[l("div",Le,[s(u,{class:"mb-4"}),s(_,{class:"mb-4"}),l("div",Ue,[((m=e.config)==null?void 0:m.video_url)!==void 0||((y=e.config)==null?void 0:y.custom)?(n(),A($,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[s(d,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+a(e.$t("flux.button.extend")),1)]),_:1},8,["onClick"])):(n(),A($,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[s(d,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+a(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"]))])])])}var je=I(Oe,[["render",qe],["__scopeId","data-v-707be6ac"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/ConfigPanel.vue"]]);const Be=V({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{viewImage:o=>{window.open(o,"_blank")}}}}),He={class:"image-gallery"},ze={class:"image-container"},Ke=["src"];function Xe(e,t,o,i,h,v){return n(),p("div",He,[l("div",ze,[l("img",{src:e.modelValue.image_url,alt:"Image"},null,8,Ke),l("button",{class:"view-button",onClick:t[0]||(t[0]=u=>e.viewImage(e.modelValue.image_url))},a(e.$t("flux.button.viewImage")),1)])])}var Ze=I(Be,[["render",Xe],["__scopeId","data-v-74374cc6"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/ImageGallery.vue"]]);const Je=V({name:"TaskPreview",components:{ElImage:_e,CopyToClipboard:ge,FontAwesomeIcon:F,ElAlert:me,ElTooltip:fe,ElButton:L,ImageGallery:Ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.flux)==null?void 0:e.application},config(){var e;return(e=this.$store.state.flux)==null?void 0:e.config},images(){var o,i,h,v,u,_,d;let e=[];const t=(i=(o=this.modelValue)==null?void 0:o.request)==null?void 0:i.action;return Array.isArray((v=(h=this.modelValue)==null?void 0:h.response)==null?void 0:v.data)&&((d=(_=(u=this.modelValue)==null?void 0:u.response)==null?void 0:_.data)==null||d.forEach($=>{let m=$;t&&(m.action=t),e.push(m)})),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Qe={class:"left"},We={class:"main"},Ye={class:"bot"},et={class:"datetime"},tt={class:"info"},st={key:0,class:"prompt mt-2"},ot={key:0},nt={key:1},at={key:0,class:D({content:!0,failed:!0})},lt={class:"image-wrapper"},rt={key:0,class:D({operations:!0,"mt-2":!0})},it={class:"description"},ct={key:1,class:D({content:!0})},ut={class:"description"},dt={class:"description"},pt={class:"description"},_t={key:2,class:D({content:!0})},mt={class:"description"};function ft(e,t,o,i,h,v){const u=r("el-image"),_=r("image-gallery"),d=r("el-button"),$=r("el-tooltip"),m=r("font-awesome-icon"),y=r("copy-to-clipboard"),S=r("el-alert");return n(!0),p(R,null,E(e.images,(c,P)=>{var C,G,b,N,U,q,j,B,H,z,K;return n(),p("div",{key:P,class:"preview"},[l("div",Qe,[s(u,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),l("div",We,[l("div",Ye,[g(a(e.$t("flux.name.fluxBot"))+" ",1),l("span",et,a(e.$dayjs.format(""+new Date(parseFloat(((C=e.modelValue)==null?void 0:C.created_at)||"")*1e3))),1)]),l("div",tt,[(b=(G=e.modelValue)==null?void 0:G.request)!=null&&b.prompt?(n(),p("p",st,[g(a((U=(N=e.modelValue)==null?void 0:N.request)==null?void 0:U.prompt)+" ",1),(q=e.modelValue)!=null&&q.response?k("v-if",!0):(n(),p("span",ot," - ("+a(e.$t("flux.status.pending"))+") ",1)),(c==null?void 0:c.state)==="processing"||(c==null?void 0:c.state)==="pending"||(c==null?void 0:c.state)==="completed"?(n(),p("span",nt," - ("+a(e.$t("flux.status.processing"))+") ",1)):k("v-if",!0)])):k("v-if",!0)]),k(" Display success message "),((B=(j=e.modelValue)==null?void 0:j.response)==null?void 0:B.success)===!0?(n(),p("div",at,[l("div",lt,[s(_,{"model-value":c},null,8,["model-value"])]),c?(n(),p("div",rt,[s($,{class:"box-item",effect:"dark",content:e.$t("flux.message.downloadImage"),placement:"top-start"},{default:f(()=>[s(d,{type:"info",size:"small",class:"btn-action",onClick:w=>e.onDownload(w,c==null?void 0:c.image_url)},{default:f(()=>[g(a(e.$t("flux.button.download")),1)]),_:2},1032,["onClick"])]),_:2},1032,["content"])])):k("v-if",!0),s(S,{closable:!1,class:"mt-2 success"},{default:f(()=>{var w,x;return[l("p",it,[s(m,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("flux.name.taskId"))+": "+a((w=e.modelValue)==null?void 0:w.id)+" ",1),s(y,{content:(x=e.modelValue)==null?void 0:x.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),((z=(H=e.modelValue)==null?void 0:H.response)==null?void 0:z.success)===!1?(n(),p("div",ct,[s(S,{closable:!1,class:"failure"},{template:f(()=>[s(m,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("flux.name.failure")),1)]),default:f(()=>{var w,x,X,Z,J,Q,W,Y,ee,te,se,oe;return[l("p",ut,[s(m,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("flux.name.taskId"))+": "+a((w=e.modelValue)==null?void 0:w.id)+" ",1),s(y,{content:(x=e.modelValue)==null?void 0:x.id,class:"btn-copy"},null,8,["content"])]),l("p",dt,[s(m,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+a(e.$t("flux.name.failureReason"))+": "+a((J=(Z=(X=e.modelValue)==null?void 0:X.response)==null?void 0:Z.error)==null?void 0:J.message)+" ",1),s(y,{content:(Y=(W=(Q=e.modelValue)==null?void 0:Q.response)==null?void 0:W.error)==null?void 0:Y.message,class:"btn-copy"},null,8,["content"])]),l("p",pt,[s(m,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+a(e.$t("flux.name.traceId"))+": "+a((te=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:te.trace_id)+" ",1),s(y,{content:(oe=(se=e.modelValue)==null?void 0:se.response)==null?void 0:oe.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),!((K=e.modelValue)!=null&&K.response)||(c==null?void 0:c.state)==="processing"||(c==null?void 0:c.state)==="pending"?(n(),p("div",_t,[s(S,{closable:!1,class:"info"},{template:f(()=>[s(m,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+a(e.$t("flux.name.failure")),1)]),default:f(()=>{var w,x;return[l("p",mt,[s(m,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+a(e.$t("flux.name.taskId"))+": "+a((w=e.modelValue)==null?void 0:w.id)+" ",1),s(y,{content:(x=e.modelValue)==null?void 0:x.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0)])])}),128)}var ht=I(Je,[["render",ft],["__scopeId","data-v-bb276cb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/task/Preview.vue"]]);const vt=V({name:"RecentPanel",components:{TaskPreview:ht,ElSkeleton:he,ElSkeletonItem:ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,o,i;return{...(e=this.$store.state.flux)==null?void 0:e.tasks,items:(i=(o=(t=this.$store.state.flux)==null?void 0:t.tasks)==null?void 0:o.items)==null?void 0:i.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),$t={key:0,class:"tasks"},gt={class:"left"},kt={class:"main"},yt={key:1,class:"tasks"},wt={key:2,class:"description"};function bt(e,t,o,i,h,v){var $,m,y,S,c,P,C,G;const u=r("el-skeleton-item"),_=r("el-skeleton"),d=r("task-preview");return n(),p("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...b)=>e.onHandleScroll&&e.onHandleScroll(...b))},[(($=e.tasks)==null?void 0:$.items)===void 0?(n(),p("div",$t,[(n(),p(R,null,E(3,b=>l("div",{key:b,class:"task placeholder"},[l("div",gt,[s(_,{animated:""},{template:f(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",kt,[s(_,{animated:""},{template:f(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"image",class:"icon"})]),_:1})])])),64))])):((y=(m=e.tasks)==null?void 0:m.items)==null?void 0:y.length)&&((c=(S=e.tasks)==null?void 0:S.items)==null?void 0:c.length)>0?(n(),p("div",yt,[(n(!0),p(R,null,E((P=e.tasks)==null?void 0:P.items,(b,N)=>(n(),A(d,{key:N,"model-value":b,class:"preview"},null,8,["model-value"]))),128))])):k("v-if",!0),((G=(C=e.tasks)==null?void 0:C.items)==null?void 0:G.length)===0?(n(),p("p",wt,a(e.$t("flux.message.noTasks")),1)):k("v-if",!0)],544)}var xt=I(vt,[["render",bt],["__scopeId","data-v-2ae6e09a"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/RecentPanel.vue"]]);const It="https://webhook.acedata.cloud/flux",Vt=V({name:"FluxIndex",components:{ConfigPanel:je,Layout:Ie,RecentPanel:xt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.flux)==null?void 0:e.status)==null?void 0:t.getApplications)===M.Request},service(){var e;return(e=this.$store.state.flux)==null?void 0:e.service},credential(){var e;return(e=this.$store.state.flux)==null?void 0:e.credential},config(){var e;return(e=this.$store.state.flux)==null?void 0:e.config},initializing(){var e,t;return((t=(e=this.$store.state.flux)==null?void 0:e.status)==null?void 0:t.getApplications)===M.Request},needApply(){var e,t;return((t=(e=this.$store.state.flux)==null?void 0:e.status)==null?void 0:t.getApplications)===M.Success&&!this.application},application(){var e;return(e=this.$store.state.flux)==null?void 0:e.application},applications(){var e;return(e=this.$store.state.flux)==null?void 0:e.applications},tasks(){var e;return(e=this.$store.state.flux)==null?void 0:e.tasks}},watch:{tasks:{handler(e,t){var o,i;((o=e==null?void 0:e.items)==null?void 0:o.length)>((i=t==null?void 0:t.items)==null?void 0:i.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("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){ae.create({application:this.application}).then(({data:e})=>{this.application=e,T.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)===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:t=5,createdAtMin:o,createdAtMax:i}=e||{};console.debug("limit",t,"createdAtMin",o,"createdAtMax",i),await this.$store.dispatch("flux/getTasks",{limit:t,createdAtMin:o,createdAtMax:i})},async onGenerate(){var o;const e={...this.config,callback_url:It},t=(o=this.credential)==null?void 0:o.token;if(!t){console.error("no token specified");return}T.info(this.$t("flux.message.startingTask")),re.generate(e,{token:t}).then(()=>{T.success(this.$t("flux.message.startTaskSuccess")),this.$store.commit("flux/setConfig",{config:void 0})}).catch(i=>{var v,u;const h=(v=i==null?void 0:i.response)==null?void 0:v.data;((u=h==null?void 0:h.error)==null?void 0:u.code)===ie?T.error(this.$t("flux.message.usedUp")):T.error(this.$t("flux.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function St(e,t,o,i,h,v){const u=r("config-panel"),_=r("recent-panel"),d=r("layout");return n(),A(d,null,{config:f(()=>[s(u,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:f(()=>[s(_,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var Ot=I(Vt,[["render",St],["__scopeId","data-v-e3c77ee0"],["__file","/home/runner/work/Nexior/Nexior/src/pages/flux/Index.vue"]]);export{Ot as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{an as le}from"./vendor-others.cdfefb59.js";import{ar as q}from"./vendor-fortawesome.2b54ad1b.js";import{_ as y,aH as re,aI as ce,aJ as pe,A as de,K as L,F as ue,M as _e,aK as me,Z as fe}from"./index.60bb4e0a.js";import{T as he,u as G,p as ge,N as ne,O as ie,M as ke,L as $e,x as ve,y as E,t as ye,m as be,I as we,s as Ie,H as Se,R as Ve}from"./vendor-element-plus.1fa87efb.js";import{H as b,al as n,o as i,e as u,f as p,I as O,V as s,M as m,T as c,U,ai as R,L as P,R as k,S as $,P as M}from"./vendor-@vue.6c0309d3.js";import{I as B}from"./InfoIcon.5a350f1f.js";import{C as Ee}from"./CopyToClipboard.2d20734e.js";import"./vendor-markdown.cf3e96ae.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.6ab44f81.js";const Pe=b({name:"LayoutPika",components:{ElDrawer:he,ElButton:G,FontAwesomeIcon:q},data(){return{drawer:!1}}}),Te={class:"main"},Ce={class:"config"},Ne={class:"result"};function Ae(e,t,o,l,f,h){const r=n("font-awesome-icon"),d=n("el-button"),a=n("el-drawer");return i(),u("div",Te,[p("div",Ce,[O(e.$slots,"config",{},void 0,!0)]),p("div",Ne,[O(e.$slots,"result",{},void 0,!0)]),s(d,{round:"",class:"menu",onClick:t[0]||(t[0]=v=>e.drawer=!0)},{default:m(()=>[s(r,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(a,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=v=>e.drawer=v),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[O(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ue=y(Pe,[["render",Ae],["__scopeId","data-v-449d36ce"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Pika.vue"]]);const Re=b({name:"IngredientsSelector",components:{ElSwitch:ge,InfoIcon:B},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.pika)==null?void 0:e.config)==null?void 0:t.ingredients},set(e){var t,o;console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...(t=this.$store.state.pika)==null?void 0:t.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...(o=this.$store.state.pika)==null?void 0:o.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=re)}}),De={class:"field"},Ge={class:"title font-bold"};function Me(e,t,o,l,f,h){const r=n("el-switch"),d=n("info-icon");return i(),u("div",De,[p("h2",Ge,c(e.$t("pika.name.ingredients")),1),s(r,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value"},null,8,["modelValue"]),s(d,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}var Le=y(Re,[["render",Me],["__scopeId","data-v-798cb974"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/IngredientsSelector.vue"]]);const Oe=b({name:"EffectSelector",components:{ElSelect:ne,ElOption:ie},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){var e,t;return(t=(e=this.$store.state.pika)==null?void 0:e.config)==null?void 0:t.effect},set(e){var t;this.$store.commit("pika/setConfig",{...(t=this.$store.state.pika)==null?void 0:t.config,effect:e})}}},watch:{},mounted(){}}),qe={class:"field"},Be={class:"title font-bold"},je={class:"float-left"};function Fe(e,t,o,l,f,h){const r=n("el-option"),d=n("el-select");return i(),u("div",qe,[p("h2",Be,c(e.$t("pika.name.effect")),1),s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(i(!0),u(U,null,R(e.options,a=>(i(),P(r,{key:a.value,label:a.label,value:a.value},{default:m(()=>[p("span",je,c(a.label),1),k(' <span class="float-right">{{ item.value }}</span> ')]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var ze=y(Oe,[["render",Fe],["__scopeId","data-v-db9ed4a6"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/EffectSelector.vue"]]);const He=b({name:"IngredientsModelSelector",components:{ElRadioButton:ke,ElRadioGroup:$e},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.pika)==null?void 0:e.config)==null?void 0:t.ingredients_mode},set(e){var t;this.$store.commit("pika/setConfig",{...(t=this.$store.state.pika)==null?void 0:t.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=ce)}}),Ke={class:"field"},Je={class:"title font-bold"};function Ze(e,t,o,l,f,h){const r=n("el-radio-button"),d=n("el-radio-group");return i(),u("div",Ke,[p("h2",Je,c(e.$t("pika.name.ingredientsModel")),1),s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),size:"small",class:"quality"},{default:m(()=>[(i(!0),u(U,null,R(e.options,a=>(i(),P(r,{key:a.value,label:a.value},{default:m(()=>[$(c(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}var Qe=y(He,[["render",Ze],["__scopeId","data-v-12df6463"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/IngredientsModelSelector.vue"]]);const We=b({name:"ModelSelector",components:{ElSelect:ne,ElOption:ie},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.pika)==null?void 0:e.config)==null?void 0:t.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=pe)}}),Xe={class:"field"},Ye={class:"title font-bold"};function xe(e,t,o,l,f,h){const r=n("el-option"),d=n("el-select");return i(),u("div",Xe,[p("h2",Ye,c(e.$t("pika.name.model")),1),s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(i(!0),u(U,null,R(e.options,a=>(i(),P(r,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var et=y(We,[["render",xe],["__scopeId","data-v-1df4d99b"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/ModelSelector.vue"]]);const tt=b({name:"ImageUrlInput",components:{ElUpload:ve,ElButton:G,InfoIcon:B},data(){return{fileList:[],uploadUrl:de()+"/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.pika)==null?void 0:e.config)==null?void 0:t.image_url},set(e){var t,o;(t=this.urls)==null||t[0],this.$store.commit("pika/setConfig",{...(o=this.$store.state.pika)==null?void 0:o.config,image_url:this.urls})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){E.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){E.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){var e;this.$store.commit("pika/setConfig",{...(e=this.$store.state.pika)==null?void 0:e.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),st={class:"field"},ot={class:"title font-bold"},at={class:"upload-wrapper"};function nt(e,t,o,l,f,h){const r=n("el-button"),d=n("el-upload"),a=n("info-icon");return i(),u("div",st,[p("h2",ot,c(e.$t("pika.name.imageUrl")),1),p("div",at,[s(d,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=v=>e.fileList=v),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:3,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[s(r,{size:"small",type:"primary",round:""},{default:m(()=>[$(c(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),s(a,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}var it=y(tt,[["render",nt],["__scopeId","data-v-5daf4a89"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/ImageUrlInput.vue"]]);const lt="",rt=b({name:"PromptInput",components:{ElInput:ye,InfoIcon:B},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.pika)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("pika/setConfig",{...(t=this.$store.state.pika)==null?void 0:t.config,prompt:e})}}},mounted(){this.value||(this.value=lt)}}),ct={class:"field"},pt={class:"box"},dt={class:"title font-bold"};function ut(e,t,o,l,f,h){const r=n("info-icon"),d=n("el-input");return i(),u("div",ct,[p("div",pt,[p("h2",dt,c(e.$t("pika.name.prompt")),1),s(r,{content:e.$t("pika.description.prompt"),class:"info"},null,8,["content"])]),s(d,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pika.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var _t=y(rt,[["render",ut],["__scopeId","data-v-3f49f00e"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/PromptInput.vue"]]);const mt=b({name:"PresetPanel",components:{ImageUrlInput:it,ElButton:G,FontAwesomeIcon:q,PromptInput:_t,IngredientsSelector:Le,IngredientsModelSelector:Qe,ModelSelector:et,EffectSelector:ze},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.pika)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),ft={class:"panel"},ht={class:"config"},gt={class:"actions"};function kt(e,t,o,l,f,h){var A,T,C,w;const r=n("prompt-input"),d=n("model-selector"),a=n("ingredients-selector"),v=n("effect-selector"),g=n("image-url-input"),I=n("ingredients-model-selector"),V=n("font-awesome-icon"),_=n("el-button");return i(),u("div",ft,[p("div",ht,[s(r,{class:"mb-4"}),s(d,{class:"mb-4"}),s(a,{class:"mb-4"}),s(v,{class:"mb-4"}),(A=e.config)!=null&&A.ingredients?(i(),P(g,{key:0,class:"mb-4"})):k("v-if",!0),(T=e.config)!=null&&T.ingredients?(i(),P(I,{key:1,class:"mb-4"})):k("v-if",!0),p("div",gt,[((C=e.config)==null?void 0:C.video_url)!==void 0||((w=e.config)==null?void 0:w.custom)?(i(),P(_,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[s(V,{icon:"fa-solid fa-magic",class:"mr-2"}),$(" "+c(e.$t("pika.button.extend")),1)]),_:1},8,["onClick"])):(i(),P(_,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[s(V,{icon:"fa-solid fa-magic",class:"mr-2"}),$(" "+c(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"]))])])])}var $t=y(mt,[["render",kt],["__scopeId","data-v-26d959d2"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/ConfigPanel.vue"]]);const vt=b({name:"VideoPlayer",components:{VuePlyr:le},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),yt=["data-poster"],bt=["src"];function wt(e,t,o,l,f,h){const r=n("vue-plyr");return i(),u("div",null,[s(r,{options:e.options,class:"video"},{default:m(()=>{var d,a;return[p("video",{controls:"",crossorigin:"",playsinline:"","data-poster":(d=e.modelValue)==null?void 0:d.image_url},[p("source",{size:"1080",src:(a=e.modelValue)==null?void 0:a.video_url,type:"video/mp4"},null,8,bt)],8,yt)]}),_:1},8,["options"])])}var It=y(vt,[["render",wt],["__scopeId","data-v-3697e02c"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/VideoPlayer.vue"]]);const St=b({name:"TaskPreview",components:{ElImage:be,CopyToClipboard:Ee,FontAwesomeIcon:q,ElAlert:we,VideoPlayer:It,ElTooltip:Ie,ElButton:G},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.pika)==null?void 0:e.application},config(){var e;return(e=this.$store.state.pika)==null?void 0:e.config},videos(){var o,l,f,h,r,d,a;let e=[];const t=(l=(o=this.modelValue)==null?void 0:o.request)==null?void 0:l.action;return Array.isArray((h=(f=this.modelValue)==null?void 0:f.response)==null?void 0:h.data)&&((a=(d=(r=this.modelValue)==null?void 0:r.response)==null?void 0:d.data)==null||a.forEach(v=>{let g=v;t&&(g.action=t),e.push(g)})),e}},methods:{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")}}}),Vt={class:"left"},Et={class:"main"},Pt={class:"bot"},Tt={class:"datetime"},Ct={class:"info"},Nt={key:0,class:"prompt mt-2"},At={key:0},Ut={key:1},Rt={key:0,class:M({content:!0,failed:!0})},Dt={class:"image-wrapper"},Gt={key:0,class:M({operations:!0,"mt-2":!0})},Mt={class:"description"},Lt={key:1,class:M({content:!0})},Ot={class:"description"},qt={class:"description"},Bt={class:"description"},jt={key:2,class:M({content:!0})},Ft={class:"description"};function zt(e,t,o,l,f,h){const r=n("el-image"),d=n("VideoPlayer"),a=n("el-button"),v=n("el-tooltip"),g=n("font-awesome-icon"),I=n("copy-to-clipboard"),V=n("el-alert");return i(!0),u(U,null,R(e.videos,(_,A)=>{var T,C,w,D,j,F,z,H,K,J,Z;return i(),u("div",{key:A,class:"preview"},[p("div",Vt,[s(r,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),p("div",Et,[p("div",Pt,[$(c(e.$t("pika.name.pikaBot"))+" ",1),p("span",Tt,c(e.$dayjs.format(""+new Date(parseFloat(((T=e.modelValue)==null?void 0:T.created_at)||"")*1e3))),1)]),p("div",Ct,[(w=(C=e.modelValue)==null?void 0:C.request)!=null&&w.prompt?(i(),u("p",Nt,[$(c((j=(D=e.modelValue)==null?void 0:D.request)==null?void 0:j.prompt)+" ",1),(F=e.modelValue)!=null&&F.response?k("v-if",!0):(i(),u("span",At," - ("+c(e.$t("pika.status.pending"))+") ",1)),(_==null?void 0:_.state)==="processing"||(_==null?void 0:_.state)==="pending"||(_==null?void 0:_.state)==="completed"?(i(),u("span",Ut," - ("+c(e.$t("pika.status.processing"))+") ",1)):k("v-if",!0)])):k("v-if",!0)]),k(" Display success message "),((H=(z=e.modelValue)==null?void 0:z.response)==null?void 0:H.success)===!0?(i(),u("div",Rt,[p("div",Dt,[s(d,{"model-value":_},null,8,["model-value"])]),_?(i(),u("div",Gt,[s(v,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[s(a,{type:"info",size:"small",class:"btn-action",onClick:S=>e.onDownload(S,_==null?void 0:_.video_url)},{default:m(()=>[$(c(e.$t("pika.button.download")),1)]),_:2},1032,["onClick"])]),_:2},1032,["content"])])):k("v-if",!0),s(V,{closable:!1,class:"mt-2 success"},{default:m(()=>{var S,N;return[p("p",Mt,[s(g,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+c(e.$t("pika.name.taskId"))+": "+c((S=e.modelValue)==null?void 0:S.id)+" ",1),s(I,{content:(N=e.modelValue)==null?void 0:N.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),((J=(K=e.modelValue)==null?void 0:K.response)==null?void 0:J.success)===!1?(i(),u("div",Lt,[s(V,{closable:!1,class:"failure"},{template:m(()=>[s(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+c(e.$t("pika.name.failure")),1)]),default:m(()=>{var S,N,Q,W,X,Y,x,ee,te,se,oe,ae;return[p("p",Ot,[s(g,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+c(e.$t("pika.name.taskId"))+": "+c((S=e.modelValue)==null?void 0:S.id)+" ",1),s(I,{content:(N=e.modelValue)==null?void 0:N.id,class:"btn-copy"},null,8,["content"])]),p("p",qt,[s(g,{icon:"fa-solid fa-circle-info",class:"mr-1"}),$(" "+c(e.$t("pika.name.failureReason"))+": "+c((X=(W=(Q=e.modelValue)==null?void 0:Q.response)==null?void 0:W.error)==null?void 0:X.message)+" ",1),s(I,{content:(ee=(x=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:x.error)==null?void 0:ee.message,class:"btn-copy"},null,8,["content"])]),p("p",Bt,[s(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),$(" "+c(e.$t("pika.name.traceId"))+": "+c((se=(te=e.modelValue)==null?void 0:te.response)==null?void 0:se.trace_id)+" ",1),s(I,{content:(ae=(oe=e.modelValue)==null?void 0:oe.response)==null?void 0:ae.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0),k(" Display error message "),!((Z=e.modelValue)!=null&&Z.response)||(_==null?void 0:_.state)==="processing"||(_==null?void 0:_.state)==="pending"?(i(),u("div",jt,[s(V,{closable:!1,class:"info"},{template:m(()=>[s(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+c(e.$t("pika.name.failure")),1)]),default:m(()=>{var S,N;return[p("p",Ft,[s(g,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+c(e.$t("pika.name.taskId"))+": "+c((S=e.modelValue)==null?void 0:S.id)+" ",1),s(I,{content:(N=e.modelValue)==null?void 0:N.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):k("v-if",!0)])])}),128)}var Ht=y(St,[["render",zt],["__scopeId","data-v-90858984"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/task/Preview.vue"]]);const Kt=b({name:"RecentPanel",components:{TaskPreview:Ht,ElSkeleton:Se,ElSkeletonItem:Ve},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,o,l;return{...(e=this.$store.state.pika)==null?void 0:e.tasks,items:(l=(o=(t=this.$store.state.pika)==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")}}}),Jt={key:0,class:"tasks"},Zt={class:"left"},Qt={class:"main"},Wt={key:1,class:"tasks"},Xt={key:2,class:"description"};function Yt(e,t,o,l,f,h){var v,g,I,V,_,A,T,C;const r=n("el-skeleton-item"),d=n("el-skeleton"),a=n("task-preview");return i(),u("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...w)=>e.onHandleScroll&&e.onHandleScroll(...w))},[((v=e.tasks)==null?void 0:v.items)===void 0?(i(),u("div",Jt,[(i(),u(U,null,R(3,w=>p("div",{key:w,class:"task placeholder"},[p("div",Zt,[s(d,{animated:""},{template:m(()=>[s(r,{variant:"image",class:"avatar"})]),_:1})]),p("div",Qt,[s(d,{animated:""},{template:m(()=>[s(r,{variant:"p",class:"title"}),s(r,{variant:"image",class:"icon"})]),_:1})])])),64))])):((I=(g=e.tasks)==null?void 0:g.items)==null?void 0:I.length)&&((_=(V=e.tasks)==null?void 0:V.items)==null?void 0:_.length)>0?(i(),u("div",Wt,[(i(!0),u(U,null,R((A=e.tasks)==null?void 0:A.items,(w,D)=>(i(),P(a,{key:D,"model-value":w,class:"preview"},null,8,["model-value"]))),128))])):k("v-if",!0),((C=(T=e.tasks)==null?void 0:T.items)==null?void 0:C.length)===0?(i(),u("p",Xt,c(e.$t("pika.message.noTasks")),1)):k("v-if",!0)],544)}var xt=y(Kt,[["render",Yt],["__scopeId","data-v-be2bfa4e"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/RecentPanel.vue"]]);const es="https://webhook.acedata.cloud/pika",ts=b({name:"PikaIndex",components:{ConfigPanel:$t,Layout:Ue,RecentPanel:xt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.pika)==null?void 0:e.status)==null?void 0:t.getApplications)===L.Request},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===L.Request},needApply(){return this.$store.state.pika.status.getApplications===L.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,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(),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("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){ue.create({application:this.application}).then(({data:e})=>{this.application=e,E.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)===_e&&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:o,createdAtMax:l}=e||{};console.debug("limit",t,"createdAtMin",o,"createdAtMax",l),await this.$store.dispatch("pika/getTasks",{limit:t,createdAtMin:o,createdAtMax:l})},async onGenerate(){var o;const e={...this.config,callback_url:es},t=(o=this.credential)==null?void 0:o.token;if(!t){console.error("no token specified");return}E.info(this.$t("pika.message.startingTask")),me.generate(e,{token:t}).then(()=>{E.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(l=>{var h,r;const f=(h=l==null?void 0:l.response)==null?void 0:h.data;((r=f==null?void 0:f.error)==null?void 0:r.code)===fe?E.error(this.$t("pika.message.usedUp")):E.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ss(e,t,o,l,f,h){const r=n("config-panel"),d=n("recent-panel"),a=n("layout");return i(),P(a,null,{config:m(()=>[s(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[s(d,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var _s=y(ts,[["render",ss],["__scopeId","data-v-307eef94"],["__file","/home/runner/work/Nexior/Nexior/src/pages/pika/Index.vue"]]);export{_s as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{ao as ye,ap as Z,aq as ke,ar as ve,as as we,at as be}from"./vendor-others.cdfefb59.js";import{ar as ne}from"./vendor-fortawesome.2b54ad1b.js";import{_ as k,aW as fe,A as Ce,aX as de,K as oe,F as Pe,M as Ae}from"./index.60bb4e0a.js";import{T as Se,u as ie,N as Ie,O as Te,p as $e,x as Ne,y as L,t as ae,m as le,k as re,V as Ee,Z as pe,_ as _e,s as Ve,h as Ue,i as Fe,j as Le,U as ge,$ as je,H as De,R as Ge,a0 as Re,a1 as Me,a2 as qe}from"./vendor-element-plus.1fa87efb.js";import{H as w,al as u,o as c,e as _,R as $,f as l,I as te,V as a,M as h,T as f,U as X,ai as se,L as y,S as G,av as me,O as ce,m as Q,u as j,s as Oe,Q as ze,W as Be}from"./vendor-@vue.6c0309d3.js";import{I as J}from"./InfoIcon.5a350f1f.js";import"./vendor-markdown.cf3e96ae.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.6ab44f81.js";const xe=w({name:"LayoutSuno",components:{ElDrawer:Se,ElButton:ie,FontAwesomeIcon:ne},data(){return{drawer:!1,preview:!1}},computed:{isPlaying(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.player)==null?void 0:t.isPlaying}}}),He={class:"main"},We={class:"config"},Ke={class:"result"},Qe={class:"preview"};function Xe(e,t,n,o,r,d){const i=u("font-awesome-icon"),p=u("el-button"),m=u("el-drawer");return c(),_("div",He,[$(" \u6700\u5DE6\u4FA7\u914D\u7F6E\u680F "),l("div",We,[te(e.$slots,"config",{},void 0,!0)]),$(" \u4E2D\u95F4\u6B4C\u66F2\u5217\u8868\u680F "),l("div",Ke,[te(e.$slots,"result",{},void 0,!0)]),$(" \u6700\u53F3\u8FB9\u6B4C\u66F2\u9884\u89C8\u680F "),l("div",Qe,[te(e.$slots,"preview",{},void 0,!0)]),a(p,{round:"",class:"menu",onClick:t[0]||(t[0]=v=>e.drawer=!0)},{default:h(()=>[a(i,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),a(m,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=v=>e.drawer=v),"with-header":!1,size:"340px",class:"drawer"},{default:h(()=>[te(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"]),$(` <el-drawer v-model="isPlaying" :with-header="false" size="340px" class="preview_drawer">
|
|
2
|
-
<slot name="preview" />
|
|
3
|
-
</el-drawer> `)])}var Ye=k(xe,[["render",Xe],["__scopeId","data-v-0621513c"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Suno.vue"]]);const Ze=w({name:"VersionSelector",components:{ElSelect:Ie,ElOption:Te,ElSwitch:$e},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.custom},set(e){var t;console.debug("set custom",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,custom:e})}},model:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.model},set(e){var t;console.debug("set model",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,model:e})}}},mounted(){this.model||(console.debug("set default type",fe),this.model=fe)}}),Je={class:"field"},et={class:"title font-bold"};function tt(e,t,n,o,r,d){const i=u("el-switch"),p=u("el-option"),m=u("el-select");return c(),_("div",Je,[l("h2",et,f(e.$t("suno.name.type")),1),a(i,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=v=>e.custom=v),class:"value"},null,8,["modelValue"]),a(m,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=v=>e.model=v),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:h(()=>[(c(!0),_(X,null,se(e.options,v=>(c(),y(p,{key:v.value,label:v.label,value:v.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var ot=k(Ze,[["render",tt],["__scopeId","data-v-6d5f21aa"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/TypeSelector.vue"]]);const st=w({name:"UploadAudio",components:{ElUpload:Ne,ElButton:ie,InfoIcon:J,FontAwesomeIcon:ne},emits:["change"],data(){return{fileList:[],uploadUrl:Ce()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},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.suno)==null?void 0:e.config)==null?void 0:t.audio_id},set(e){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){var t;const e=(t=this.urls)==null?void 0:t[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){var o;const t={audio_url:e},n=(o=this.credential)==null?void 0:o.token;if(!n){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),de.upload(t,{token:n}).then(r=>{var i,p;console.debug("get upload music success",r.data);const d=(i=r.data)==null?void 0:i.data.audio_id;this.$store.commit("suno/setConfig",{...(p=this.$store.state.suno)==null?void 0:p.config,audio_id:d,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(r=>{var d,i,p;L.error(((p=(i=(d=r==null?void 0:r.response)==null?void 0:d.data)==null?void 0:i.error)==null?void 0:p.message)||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),nt={class:"relative"},it={class:"flex justify-between"},at={class:"flex justify-start items-center"},lt={class:"text-sm font-bold"};function rt(e,t,n,o,r,d){const i=u("info-icon"),p=u("font-awesome-icon"),m=u("el-button"),v=u("el-upload");return c(),_("div",nt,[l("div",it,[l("div",at,[l("span",lt,f(e.$t("suno.name.referenceAudios")),1),a(i,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),a(v,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=C=>e.fileList=C),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:h(()=>[a(m,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:h(()=>[a(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),G(" "+f(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}var ct=k(st,[["render",rt],["__scopeId","data-v-3fef3e18"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/UploadAudio.vue"]]);const ut="",dt=w({name:"PromptInput",components:{ElInput:ae,ElSwitch:$e,InfoIcon:J},data(){return{}},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,prompt:e})}},instrumental:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.instrumental},set(e){var t;console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,instrumental:e})}}},mounted(){this.value||(this.value=ut)}}),pt={class:"field"},_t={class:"box"},mt={class:"title-info"},ht={class:"title font-bold"},ft={class:"instrumental"},vt={class:"title inline-block"};function $t(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-switch"),m=u("el-input");return c(),_("div",pt,[l("div",_t,[l("div",mt,[l("h2",ht,f(e.$t("suno.name.prompt")),1),a(i,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",ft,[a(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=v=>e.instrumental=v),class:"value mr-2"},null,8,["modelValue"]),l("h2",vt,f(e.$t("suno.name.instrumental")),1)])]),a(m,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=v=>e.prompt=v),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var gt=k(dt,[["render",$t],["__scopeId","data-v-11b65236"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/PromptInput.vue"]]);const yt="",kt=w({name:"LyricInput",components:{ElInput:ae,InfoIcon:J},data(){return{}},computed:{lyric:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.lyric},set(e){var t;console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,lyric:e})}},config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}},mounted(){this.value||(this.value=yt)}}),wt={class:"field"},bt={class:"box"},Ct={class:"title font-bold"};function Pt(e,t,n,o,r,d){var m;const i=u("info-icon"),p=u("el-input");return c(),_("div",wt,[l("div",bt,[l("h2",Ct,f(e.$t("suno.name.lyrics")),1),a(i,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),((m=e.config)==null?void 0:m.action)!=="extend"?(c(),y(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=v=>e.lyric=v),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(c(),y(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=v=>e.lyric=v),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}var At=k(kt,[["render",Pt],["__scopeId","data-v-b47f1748"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/LyricInput.vue"]]);const St=w({name:"StyleInput",components:{ElInput:ae,InfoIcon:J},data(){return{}},computed:{style:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.style},set(e){var t;console.debug("set style",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,style:e})}},config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}}}),It={class:"field"},Tt={class:"title-container"},Nt={class:"titlefont-bold"};function Et(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-input");return c(),_("div",It,[l("div",Tt,[l("h2",Nt,f(e.$t("suno.name.style")),1),a(i,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),a(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=m=>e.style=m),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Vt=k(St,[["render",Et],["__scopeId","data-v-075e574a"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/StyleInput.vue"]]);const Ut="",Ft=w({name:"TitleInput",components:{ElInput:ae,InfoIcon:J},data(){return{}},computed:{title:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.title},set(e){var t;console.debug("set title",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,title:e})}},instrumental:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.instrumental},set(e){var t;console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,instrumental:e})}}},mounted(){this.value||(this.value=Ut)}}),Lt={class:"field"},jt={class:"title-container"},Dt={class:"title font-bold"};function Gt(e,t,n,o,r,d){const i=u("info-icon"),p=u("el-input");return c(),_("div",Lt,[l("div",jt,[l("h2",Dt,f(e.$t("suno.name.title")),1),a(i,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),a(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=m=>e.title=m),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Rt=k(Ft,[["render",Gt],["__scopeId","data-v-f9bac2fa"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/TitleInput.vue"]]);function Y(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const n=e%60,o=n<10?`0${n}`:n,r=t<10?`0${t}`:t;return o+":"+r}const Mt=w({name:"ExtendFromInput",components:{ElImage:le,ElIcon:re,ElInputNumber:Ee,VideoPlay:pe,VideoPause:_e},data(){return{}},computed:{audio(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.audio},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.continue_at},set(e){var t;console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){var t,n;e<0?this.value=0:e>((t=this.audio)==null?void 0:t.duration)?this.value=(n=this.audio)==null?void 0:n.duration:this.value=e},useFormatDuring:Y,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ot={class:"box"},zt={class:"title font-bold"},Bt={class:"input-wrapper"},xt={class:"task"},Ht={class:"left"},Wt={key:2,class:"duration"},Kt={class:"info"},Qt={class:"title"},Xt={class:"style"};function Yt(e,t,n,o,r,d){var P,b,A,S,N,s,F,E,V,U,I,D,R,M,q,O,z,B,x,H,W,K,g,he;const i=u("el-input-number"),p=u("el-image"),m=u("video-pause"),v=u("el-icon"),C=u("video-play"),T=me("loading");return c(),_("div",qt,[l("div",Ot,[l("h2",zt,f(e.$t("suno.name.extend")),1),l("div",Bt,[a(i,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=ee=>e.value=ee),class:"value",min:0,max:(P=e.audio)==null?void 0:P.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",xt,[e.audio?(c(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=ee=>e.onClick(e.audio))},[ce((c(),_("div",Ht,[a(p,{src:(b=e.audio)==null?void 0:b.image_url,class:"cover",fit:"cover"},null,8,["src"]),((A=e.audio)==null?void 0:A.audio_url)&&((s=(N=(S=e.$store.state)==null?void 0:S.suno)==null?void 0:N.audio)==null?void 0:s.id)===e.audio.id&&((V=(E=(F=e.$store.state)==null?void 0:F.suno)==null?void 0:E.audio)==null?void 0:V.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=ee=>e.onPause(e.audio))},[a(v,null,{default:h(()=>[a(m)]),_:1})])):$("v-if",!0),((U=e.audio)==null?void 0:U.audio_url)&&(((R=(D=(I=e.$store.state)==null?void 0:I.suno)==null?void 0:D.audio)==null?void 0:R.id)!==e.audio.id||((O=(q=(M=e.$store.state)==null?void 0:M.suno)==null?void 0:q.audio)==null?void 0:O.id)===e.audio.id&&((x=(B=(z=e.$store.state)==null?void 0:z.suno)==null?void 0:B.audio)==null?void 0:x.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=ee=>e.onPlay(e.audio))},[a(v,null,{default:h(()=>[a(C)]),_:1})])):$("v-if",!0),(H=e.audio)!=null&&H.duration?(c(),_("div",Wt,f(e.useFormatDuring((W=e.audio)==null?void 0:W.duration)),1)):$("v-if",!0)])),[[T,!((K=e.audio)!=null&&K.audio_url)]]),l("div",Kt,[l("h2",Qt,f((g=e.audio)==null?void 0:g.title),1),l("p",Xt,f((he=e.audio)==null?void 0:he.style),1)])])):$("v-if",!0)])])}var Zt=k(Mt,[["render",Yt],["__scopeId","data-v-040b76e5"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/ExtendFromInput.vue"]]);const Jt=w({name:"CoverFromInput",components:{ElImage:le,ElIcon:re,VideoPlay:pe,VideoPause:_e},data(){return{}},computed:{audio(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.audio},value:{get(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.config)==null?void 0:t.continue_at},set(e){var t;console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...(t=this.$store.state.suno)==null?void 0:t.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){var t,n;e<0?this.value=0:e>((t=this.audio)==null?void 0:t.duration)?this.value=(n=this.audio)==null?void 0:n.duration:this.value=e},useFormatDuring:Y,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})}}}),eo={class:"field"},to={class:"box"},oo={class:"title font-bold"},so={class:"task"},no={class:"left"},io={key:2,class:"duration"},ao={class:"info"},lo={class:"title"},ro={class:"style"};function co(e,t,n,o,r,d){var T,P,b,A,S,N,s,F,E,V,U,I,D,R,M,q,O,z,B,x,H,W,K;const i=u("el-image"),p=u("video-pause"),m=u("el-icon"),v=u("video-play"),C=me("loading");return c(),_("div",eo,[l("div",to,[l("h2",oo,f(e.$t("suno.name.cover")),1)]),l("div",so,[e.audio?(c(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=g=>e.onClick(e.audio))},[ce((c(),_("div",no,[a(i,{src:(T=e.audio)==null?void 0:T.image_url,class:"cover",fit:"cover"},null,8,["src"]),((P=e.audio)==null?void 0:P.audio_url)&&((S=(A=(b=e.$store.state)==null?void 0:b.suno)==null?void 0:A.audio)==null?void 0:S.id)===e.audio.id&&((F=(s=(N=e.$store.state)==null?void 0:N.suno)==null?void 0:s.audio)==null?void 0:F.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=g=>e.onPause(e.audio))},[a(m,null,{default:h(()=>[a(p)]),_:1})])):$("v-if",!0),((E=e.audio)==null?void 0:E.audio_url)&&(((I=(U=(V=e.$store.state)==null?void 0:V.suno)==null?void 0:U.audio)==null?void 0:I.id)!==e.audio.id||((M=(R=(D=e.$store.state)==null?void 0:D.suno)==null?void 0:R.audio)==null?void 0:M.id)===e.audio.id&&((z=(O=(q=e.$store.state)==null?void 0:q.suno)==null?void 0:O.audio)==null?void 0:z.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=g=>e.onPlay(e.audio))},[a(m,null,{default:h(()=>[a(v)]),_:1})])):$("v-if",!0),(B=e.audio)!=null&&B.duration?(c(),_("div",io,f(e.useFormatDuring((x=e.audio)==null?void 0:x.duration)),1)):$("v-if",!0)])),[[C,!((H=e.audio)!=null&&H.audio_url)]]),l("div",ao,[l("h2",lo,f((W=e.audio)==null?void 0:W.title),1),l("p",ro,f((K=e.audio)==null?void 0:K.style),1)])])):$("v-if",!0)])])}var uo=k(Jt,[["render",co],["__scopeId","data-v-68ea6e7a"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/config/CoverFromInput.vue"]]);const po=w({name:"PresetPanel",components:{TypeSelector:ot,PromptInput:gt,LyricInput:At,StyleInput:Vt,TitleInput:Rt,ExtendFromInput:Zt,CoverFromInput:uo,UploadAudio:ct,FontAwesomeIcon:ne,ElButton:ie},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.suno)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),_o={class:"panel"},mo={class:"config"},ho={class:"actions"};function fo(e,t,n,o,r,d){var N,s,F,E,V,U,I;const i=u("type-selector"),p=u("upload-audio"),m=u("prompt-input"),v=u("lyric-input"),C=u("style-input"),T=u("title-input"),P=u("extend-from-input"),b=u("cover-from-input"),A=u("font-awesome-icon"),S=u("el-button");return c(),_("div",_o,[l("div",mo,[a(i,{class:"mb-4"}),a(p,{class:"mb-4"}),(N=e.config)!=null&&N.custom?$("v-if",!0):(c(),y(m,{key:0,class:"mb-4"})),((s=e.config)==null?void 0:s.custom)&&!e.config.instrumental?(c(),y(v,{key:1,class:"mb-4"})):$("v-if",!0),(F=e.config)!=null&&F.custom?(c(),y(C,{key:2,class:"mb-4"})):$("v-if",!0),(E=e.config)!=null&&E.custom?(c(),y(T,{key:3,class:"mb-4"})):$("v-if",!0),((V=e.config)==null?void 0:V.action)==="extend"?(c(),y(P,{key:4,class:"mb-4"})):$("v-if",!0),((U=e.config)==null?void 0:U.action)==="cover"?(c(),y(b,{key:5,class:"mb-4"})):$("v-if",!0),l("div",ho,[((I=e.config)==null?void 0:I.action)!=="extend"?(c(),y(S,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[a(A,{icon:"fa-solid fa-magic",class:"mr-2"}),G(" "+f(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(c(),y(S,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:h(()=>[a(A,{icon:"fa-solid fa-magic",class:"mr-2"}),G(" "+f(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}var vo=k(po,[["render",fo],["__scopeId","data-v-38bb3c66"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/ConfigPanel.vue"]]);const $o="https://webhook.acedata.cloud/suno",go=w({name:"TaskPreview",components:{ElImage:le,ElIcon:re,ElTooltip:Ve,ElButton:ie,FontAwesomeIcon:ne,VideoPlay:pe,VideoPause:_e,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Le},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){var e,t;return((t=(e=this.$store.state.suno)==null?void 0:e.status)==null?void 0:t.getApplications)===oe.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){var e;return(e=this.$store.state.suno)==null?void 0:e.tasks},audios(){var n,o,r,d,i,p,m;let e=[];const t=(o=(n=this.modelValue)==null?void 0:n.request)==null?void 0:o.action;return Array.isArray((d=(r=this.modelValue)==null?void 0:r.response)==null?void 0:d.data)&&((m=(p=(i=this.modelValue)==null?void 0:i.response)==null?void 0:p.data)==null||m.forEach(v=>{let C=v;t&&(C.action=t),e.push(C)})),e},application(){var e;return(e=this.$store.state.suno)==null?void 0:e.application},active(){var e,t;return(t=(e=this.$store.state.suno)==null?void 0:e.tasks)==null?void 0:t.active}},methods:{useFormatDuring:Y,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){var t,n,o;((o=(n=(t=this.$store.state)==null?void 0:t.suno)==null?void 0:n.audio)==null?void 0:o.id)!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){var n;e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...(n=this.$store.state.suno)==null?void 0:n.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{ye.exports.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e,t){e.stopPropagation(),console.log("on get stems",t),await this.onGenerateAudioUrl("stems",t)},onCover(e,t){var n;e.stopPropagation(),console.log("on cover"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...(n=this.$store.state.suno)==null?void 0:n.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"cover",audio:t,audio_id:t.id})},async onConcatMusic(e,t){e.stopPropagation(),console.log("on get concat",t),await this.onGenerateAudioUrl("concat",t)},async onGenerateAudioUrl(e,t){var r;const n={action:e,audio_id:t,callback_url:$o},o=(r=this.credential)==null?void 0:r.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),de.audio(n,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(d=>{var i,p,m;L.error(((m=(p=(i=d==null?void 0:d.response)==null?void 0:i.data)==null?void 0:p.error)==null?void 0:m.message)||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),yo={class:"task"},ko=["onClick"],wo={class:"left"},bo=["onClick"],Co=["onClick"],Po={key:2,class:"duration"},Ao={class:"info"},So={class:"title"},Io={class:"style"},To={class:"right"},No={class:"el-dropdown-link"},Eo={class:"el-dropdown-link"};function Vo(e,t,n,o,r,d){const i=u("el-image"),p=u("video-pause"),m=u("el-icon"),v=u("video-play"),C=u("el-button"),T=u("font-awesome-icon"),P=u("el-tooltip"),b=u("el-dropdown-item"),A=u("el-dropdown-menu"),S=u("el-dropdown"),N=me("loading");return c(),_("div",yo,[(c(!0),_(X,null,se(e.audios,(s,F)=>{var E,V,U,I,D,R,M,q,O,z,B,x,H,W,K;return c(),_("div",{key:F,class:"audio",onClick:g=>e.onClick(s)},[ce((c(),_("div",wo,[a(i,{src:s==null?void 0:s.image_url,class:"cover",fit:"cover"},null,8,["src"]),(s==null?void 0:s.audio_url)&&((U=(V=(E=e.$store.state)==null?void 0:E.suno)==null?void 0:V.audio)==null?void 0:U.id)===s.id&&((R=(D=(I=e.$store.state)==null?void 0:I.suno)==null?void 0:D.audio)==null?void 0:R.state)==="playing"?(c(),_("div",{key:0,class:"overlay",onClick:g=>e.onPause(s)},[a(m,null,{default:h(()=>[a(p)]),_:1})],8,bo)):$("v-if",!0),(s==null?void 0:s.audio_url)&&(((O=(q=(M=e.$store.state)==null?void 0:M.suno)==null?void 0:q.audio)==null?void 0:O.id)!==s.id||((x=(B=(z=e.$store.state)==null?void 0:z.suno)==null?void 0:B.audio)==null?void 0:x.id)===s.id&&((K=(W=(H=e.$store.state)==null?void 0:H.suno)==null?void 0:W.audio)==null?void 0:K.state)==="paused")?(c(),_("div",{key:1,class:"overlay",onClick:g=>e.onPlay(s)},[a(m,null,{default:h(()=>[a(v)]),_:1})],8,Co)):$("v-if",!0),s!=null&&s.duration?(c(),_("div",Po,f(e.useFormatDuring(s==null?void 0:s.duration)),1)):$("v-if",!0)])),[[N,!(s!=null&&s.audio_url)]]),l("div",Ao,[l("h2",So,f(s==null?void 0:s.title),1),l("p",Io,f(s==null?void 0:s.style),1)]),l("div",To,[s!=null&&s.audio_url?(c(),y(C,{key:0,size:"small",round:"",onClick:g=>e.onExtend(g,s)},{default:h(()=>[G(f(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):$("v-if",!0),a(P,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:h(()=>[s!=null&&s.video_url?(c(),y(T,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:g=>e.onPreview(g,s==null?void 0:s.video_url)},null,8,["onClick"])):$("v-if",!0)]),_:2},1032,["content"]),a(S,null,{dropdown:h(()=>[a(A,null,{default:h(()=>[s!=null&&s.video_url?(c(),y(b,{key:0,onClick:g=>e.onDownload(g,s==null?void 0:s.video_url)},{default:h(()=>[G(f(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):$("v-if",!0),s!=null&&s.audio_url?(c(),y(b,{key:1,onClick:g=>e.onDownload(g,s==null?void 0:s.audio_url)},{default:h(()=>[G(f(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):$("v-if",!0)]),_:2},1024)]),default:h(()=>[l("span",No,[a(P,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:h(()=>[(s==null?void 0:s.audio_url)||(s==null?void 0:s.video_url)?(c(),y(T,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):$("v-if",!0)]),_:2},1032,["content"])])]),_:2},1024),a(S,null,{dropdown:h(()=>[a(A,null,{default:h(()=>[a(b,{onClick:g=>e.onGetStems(g,s==null?void 0:s.id)},{default:h(()=>[G(f(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"]),a(b,{onClick:g=>e.onCover(g,s)},{default:h(()=>[G(f(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),(s==null?void 0:s.action)==="extend"?(c(),y(b,{key:0,onClick:g=>e.onConcatMusic(g,s==null?void 0:s.id)},{default:h(()=>[G(f(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):$("v-if",!0)]),_:2},1024)]),default:h(()=>[l("span",Eo,[a(P,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:h(()=>[(s==null?void 0:s.audio_url)||(s==null?void 0:s.video_url)?(c(),y(T,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):$("v-if",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,ko)}),128))])}var Uo=k(go,[["render",Vo],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/task/Preview.vue"]]);const Fo={class:"player-slider"},Lo=w({__name:"PlayerSlider",setup(e){const t=Z(),n=Q({get:()=>{var i,p;return(p=(i=t.state.suno)==null?void 0:i.audio)==null?void 0:p.progress},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:i})}),o=Q({get:()=>{var i,p;return(p=(i=t.state.suno)==null?void 0:i.audio)==null?void 0:p.duration},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:i})}),r=()=>{},d=i=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:i});return(i,p)=>(c(),_("div",Fo,[a(j(ge),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}});var jo=k(Lo,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerSlider.vue"]]),Do="/assets/disk.4907c891.png";const Go={class:"flex player-song"},Ro=["src"],Mo={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Oo={class:"flex"},zo={class:"ml-2 text-dc"},Bo=w({__name:"PlayerSong",setup(e){const t=Z(),n=Q({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return Oe(n,(o,r)=>{if((o==null?void 0:o.audio_url)!==(r==null?void 0:r.audio_url)){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if((o==null?void 0:o.progress)!==(r==null?void 0:r.progress)&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else(o==null?void 0:o.state)!==(r==null?void 0:r.state)&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));(o==null?void 0:o.volume)!==(r==null?void 0:r.volume)&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>{var d,i,p;return c(),_("div",Go,[l("img",{alt:"",class:"w-11 h-11 rounded",src:((d=n.value)==null?void 0:d.image_url)||j(Do)},null,8,Ro),l("div",Mo,[l("div",qo,[l("div",Oo,[l("span",null,f(((i=n.value)==null?void 0:i.title)||"Music"),1),l("span",zo,"- "+f(((p=n.value)==null?void 0:p.style)||"SmallRuralDog"),1)])])])])}}});var xo=k(Bo,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerSong.vue"]]);const Ho={class:"flex justify-end items-center gap-x-2.5"},Wo={class:"text-xs"},Ko=w({__name:"PlayerAction",setup(e){const t=Z(),n=Q({get:()=>{var r,d;return(d=(r=t.state.suno)==null?void 0:r.audio)==null?void 0:d.progress},set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=Q({get:()=>{var r,d;return(d=(r=t.state.suno)==null?void 0:r.audio)==null?void 0:d.duration},set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(c(),_("div",Ho,[l("span",Wo,f(j(Y)(n.value))+" / "+f(j(Y)(o.value)),1)]))}});var Qo=k(Ko,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerAction.vue"]]);const Xo=w({__name:"IconPark",props:{icon:{type:null,required:!0},theme:{type:String,required:!1},size:{type:[Number,String],required:!1},spin:{type:Boolean,required:!1},fill:{type:[String,Array],required:!1},strokeLinecap:{type:String,required:!1},strokeLinejoin:{type:String,required:!1},strokeWidth:{type:Number,required:!1}},setup(e){return(t,n)=>(c(),y(ze(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}});var ue=k(Xo,[["__file","/home/runner/work/Nexior/Nexior/src/components/common/IconPark.vue"]]);const Yo={class:"player-volume flex flex-col items-center pt-2"},Zo={class:"text-sm mt-3"},Jo={class:"mt-2"},es=w({__name:"PlayerVolumeSlider",setup(e){const t=Z(),n=Q({get:()=>{var i;return(i=t.state.suno.audio)==null?void 0:i.volume},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:i})}),o=Q({get:()=>{var i;return(i=t.state.suno.audio)==null?void 0:i.muted},set:i=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:i})}),r=()=>t.dispatch("suno/toggleMuted"),d=i=>t.dispatch("suno/setVolume",i);return(i,p)=>(c(),_("div",Yo,[l("div",null,[a(j(ge),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",Zo,f(n.value),1),l("div",Jo,[a(ue,{icon:o.value?j(ke):j(ve),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}});var ts=k(es,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerVolumeSlider.vue"]]);const os={class:"flex items-center justify-center gap-x-3"},ss=w({__name:"PlayerController",setup(e){const t=Z(),n=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=Q(()=>t.state.suno.audio);return(r,d)=>{var i;return c(),_("div",os,[a(ue,{icon:((i=o.value)==null?void 0:i.state)==="playing"?j(we):j(be),size:"45",theme:"filled",class:"control",onClick:n},null,8,["icon"]),a(j(je),{placement:"top",width:"50px"},{reference:h(()=>[a(ue,{icon:j(ve),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:h(()=>[a(ts)]),_:1})])}}});var ns=k(ss,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/PlayerController.vue"]]);const is={class:"flex flex-col items-stretch h-20"},as={class:"flex grow px-5 items-center"},ls={class:"flex-1"},rs={class:"flex-1"},cs={class:"flex-1"},us=w({__name:"Player",setup(e){return(t,n)=>(c(),_("div",is,[a(jo),l("div",as,[l("div",ls,[a(xo)]),l("div",rs,[a(ns)]),l("div",cs,[a(Qo)])])]))}});var ds=k(us,[["__file","/home/runner/work/Nexior/Nexior/src/components/suno/player/Player.vue"]]);const ps=w({name:"RecentPanel",components:{TaskPreview:Uo,ElSkeleton:De,ElSkeletonItem:Ge,Player:ds},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,n,o;return{...(e=this.$store.state.suno)==null?void 0:e.tasks,items:(o=(n=(t=this.$store.state.suno)==null?void 0:t.tasks)==null?void 0:n.items)==null?void 0:o.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),_s={key:0,class:"tasks"},ms={class:"left"},hs={class:"main"},fs={key:1,class:"tasks"},vs={key:2,class:"description"},$s={class:"flex-1 flex flex-col"},gs={class:"h-20"};function ys(e,t,n,o,r,d){var C,T,P,b,A,S,N,s,F,E,V,U;const i=u("el-skeleton-item"),p=u("el-skeleton"),m=u("task-preview"),v=u("player");return c(),_(X,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...I)=>e.onHandleScroll&&e.onHandleScroll(...I))},[((C=e.tasks)==null?void 0:C.items)===void 0?(c(),_("div",_s,[(c(),_(X,null,se(3,I=>l("div",{key:I,class:"task placeholder"},[l("div",ms,[a(p,{animated:""},{template:h(()=>[a(i,{variant:"image",class:"avatar"})]),_:1})]),l("div",hs,[a(p,{animated:""},{template:h(()=>[a(i,{variant:"p",class:"title"}),a(i,{variant:"text",style:{"margin-right":"16px"}}),a(i,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):((P=(T=e.tasks)==null?void 0:T.items)==null?void 0:P.length)&&((A=(b=e.tasks)==null?void 0:b.items)==null?void 0:A.length)>0?(c(),_("div",fs,[(c(!0),_(X,null,se((S=e.tasks)==null?void 0:S.items,(I,D)=>(c(),y(m,{key:D,"model-value":I,class:"preview"},null,8,["model-value"]))),128))])):$("v-if",!0),((s=(N=e.tasks)==null?void 0:N.items)==null?void 0:s.length)===0?(c(),_("p",vs,f(e.$t("suno.message.noTasks")),1)):$("v-if",!0)],544),ce(l("div",$s,[l("div",gs,[a(v)])],512),[[Be,!!((U=(V=(E=(F=e.$store)==null?void 0:F.state)==null?void 0:E.suno)==null?void 0:V.audio)!=null&&U.object)]])],64)}var ks=k(ps,[["render",ys],["__scopeId","data-v-9a683526"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/RecentPanel.vue"]]);const ws=w({name:"TaskPreview",components:{ElScrollbar:Re,IconPicture:Me,ElImage:le,ElAvatar:qe,ElIcon:re},data(){return{showCloseIcon:!0}},computed:{audio(){var e;return(e=this.$store.state.suno)==null?void 0:e.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),bs={key:0,class:"card"},Cs={class:"image-container"},Ps={class:"image-slot"},As={class:"title"},Ss={class:"content"},Is={class:"artist"},Ts={class:"style"},Ns={class:"time"},Es={class:"lyrics"},Vs={key:1,class:"gradient-background"};function Us(e,t,n,o,r,d){const i=u("icon-picture"),p=u("el-icon"),m=u("el-image"),v=u("el-avatar"),C=u("el-scrollbar");return c(),y(C,{class:"right-panel"},{default:h(()=>{var T,P,b,A,S,N,s;return[(T=e.audio)!=null&&T.object?(c(),_("div",bs,[l("div",Cs,[a(m,{src:e.audio.image_url,fit:"cover"},{error:h(()=>[l("div",Ps,[a(p,null,{default:h(()=>[a(i)]),_:1})])]),_:1},8,["src"]),l("h2",As,f((P=e.audio)==null?void 0:P.title),1)]),l("div",Ss,[l("div",Is,[a(v,{size:30,src:(b=e.audio)==null?void 0:b.image_url},null,8,["src"]),l("span",null,f((A=e.audio)==null?void 0:A.prompt),1)]),l("p",Ts,f((S=e.audio)==null?void 0:S.style),1),l("p",Ns,f(e.$dayjs.format((N=e.audio)==null?void 0:N.created_at)),1),l("div",Es,[l("p",null,f((s=e.audio)==null?void 0:s.lyric),1)])])])):(c(),_("div",Vs))]}),_:1})}var Fs=k(ws,[["render",Us],["__scopeId","data-v-19e67a48"],["__file","/home/runner/work/Nexior/Nexior/src/components/suno/PreviewPanel.vue"]]);const Ls="https://webhook.acedata.cloud/suno",js=w({name:"SunoIndex",components:{Layout:Ye,ConfigPanel:vo,RecentPanel:ks,PreviewPanel:Fs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.suno)==null?void 0:e.status)==null?void 0:t.getApplications)===oe.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===oe.Request},needApply(){return this.$store.state.suno.status.getApplications===oe.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){var n,o;((n=e==null?void 0:e.items)==null?void 0:n.length)>((o=t==null?void 0:t.items)==null?void 0:o.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,n;console.debug("reached top"),await this.onGetTasks({createdAtMax:(n=(t=(e=this.tasks)==null?void 0:e.items)==null?void 0:t[0])==null?void 0:n.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Pe.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var t,n;((n=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:n.code)===Ae&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:n,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",n,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:n,createdAtMax:o})},async onGenerateAudio(){var n;const e={...this.config,callback_url:Ls},t=(n=this.credential)==null?void 0:n.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),de.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(o=>{var r,d,i;L.error(((i=(d=(r=o==null?void 0:o.response)==null?void 0:r.data)==null?void 0:d.error)==null?void 0:i.message)||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ds(e,t,n,o,r,d){const i=u("config-panel"),p=u("recent-panel"),m=u("preview-panel"),v=u("layout");return c(),y(v,null,{config:h(()=>[a(i,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:h(()=>[a(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:h(()=>[a(m)]),_:1})}var Ws=k(js,[["render",Ds],["__scopeId","data-v-11d62c6c"],["__file","/home/runner/work/Nexior/Nexior/src/pages/suno/Index.vue"]]);export{Ws as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{an as ve}from"./vendor-others.cdfefb59.js";import{ar as K}from"./vendor-fortawesome.2b54ad1b.js";import{_ as k,aD as ge,aE as $e,aF as ye,A as Z,K as B,F as be,M as ke,aG as we,Z as Ie}from"./index.60bb4e0a.js";import{T as Ve,u as R,p as J,x as Q,y,t as Se,m as Ee,I as Ue,s as Ce,H as Le,R as Pe}from"./vendor-element-plus.1fa87efb.js";import{H as w,al as n,o as r,e as p,f as l,I as H,V as s,M as m,T as i,S as v,L as P,R as g,P as q,U as fe,ai as he}from"./vendor-@vue.6c0309d3.js";import{I as A}from"./InfoIcon.5a350f1f.js";import{C as Ne}from"./CopyToClipboard.2d20734e.js";import"./vendor-markdown.cf3e96ae.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.6ab44f81.js";const Te=w({name:"LayoutLuma",components:{ElDrawer:Ve,ElButton:R,FontAwesomeIcon:K},data(){return{drawer:!1}}}),Ae={class:"main"},Re={class:"config"},Ge={class:"result"};function De(e,t,o,a,f,h){const c=n("font-awesome-icon"),u=n("el-button"),d=n("el-drawer");return r(),p("div",Ae,[l("div",Re,[H(e.$slots,"config",{},void 0,!0)]),l("div",Ge,[H(e.$slots,"result",{},void 0,!0)]),s(u,{round:"",class:"menu",onClick:t[0]||(t[0]=_=>e.drawer=!0)},{default:m(()=>[s(c,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(d,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=_=>e.drawer=_),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[H(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Me=k(Te,[["render",De],["__scopeId","data-v-234cfb9c"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Luma.vue"]]);const ze=w({name:"EnhancementSelector",components:{ElSwitch:J,InfoIcon:A},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.luma)==null?void 0:e.config)==null?void 0:t.enhancement},set(e){var t;console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...(t=this.$store.state.luma)==null?void 0:t.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=ge)}}),Fe={class:"field"},Oe={class:"title font-bold"};function je(e,t,o,a,f,h){const c=n("el-switch"),u=n("info-icon");return r(),p("div",Fe,[l("h2",Oe,i(e.$t("luma.name.enhancement")),1),s(c,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value"},null,8,["modelValue"]),s(u,{content:e.$t("luma.description.enhancement"),class:"info"},null,8,["content"])])}var qe=k(ze,[["render",je],["__scopeId","data-v-175365a0"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/EnhancementSelector.vue"]]);const Be=w({name:"CustomSelector",components:{ElSwitch:J,InfoIcon:A},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.luma)==null?void 0:e.config)==null?void 0:t.custom},set(e){var t;console.debug("set custom",e),this.$store.commit("luma/setConfig",{...(t=this.$store.state.luma)==null?void 0:t.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=$e)}}),He={class:"field"},Ke={class:"title font-bold"};function Ze(e,t,o,a,f,h){const c=n("el-switch"),u=n("info-icon");return r(),p("div",He,[l("h2",Ke,i(e.$t("luma.name.custom")),1),s(c,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value"},null,8,["modelValue"]),s(u,{content:e.$t("luma.description.custom"),class:"info"},null,8,["content"])])}var Je=k(Be,[["render",Ze],["__scopeId","data-v-5ac2addb"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/CustomSelector.vue"]]);const Qe=w({name:"LoopSelector",components:{ElSwitch:J,InfoIcon:A},computed:{value:{get(){var e,t;return(t=(e=this.$store.state.luma)==null?void 0:e.config)==null?void 0:t.loop},set(e){var t;console.debug("set loop",e),this.$store.commit("luma/setConfig",{...(t=this.$store.state.luma)==null?void 0:t.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=ye)}}),We={class:"field"},Xe={class:"title font-bold"};function Ye(e,t,o,a,f,h){const c=n("el-switch"),u=n("info-icon");return r(),p("div",We,[l("h2",Xe,i(e.$t("luma.name.loop")),1),s(c,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=d=>e.value=d),class:"value"},null,8,["modelValue"]),s(u,{content:e.$t("luma.description.loop"),class:"info"},null,8,["content"])])}var xe=k(Qe,[["render",Ye],["__scopeId","data-v-69cccd4e"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/LoopSelector.vue"]]);const et=w({name:"ContentInput",components:{ElUpload:Q,ElButton:R,InfoIcon:A},data(){return{fileList:[],uploadUrl:Z()+"/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.luma)==null?void 0:e.config)==null?void 0:t.end_image_url},set(e){var o,a;const t=(o=this.urls)==null?void 0:o[0];this.$store.commit("luma/setConfig",{...(a=this.$store.state.luma)==null?void 0:a.config,end_image_url:t})}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){y.warning(this.$t("luma.message.uploadEndImageExceed"))},onError(){y.error(this.$t("luma.message.uploadEndImageError"))},onSetEndImageUrl(){var t,o;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("luma/setConfig",{...(o=this.$store.state.luma)==null?void 0:o.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),tt={class:"field"},ot={class:"title font-bold"},st={class:"upload-wrapper"};function nt(e,t,o,a,f,h){const c=n("el-button"),u=n("el-upload"),d=n("info-icon");return r(),p("div",tt,[l("h2",ot,i(e.$t("luma.name.endImageUrl")),1),l("div",st,[s(u,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[s(c,{size:"small",type:"primary",round:""},{default:m(()=>[v(i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),s(d,{content:e.$t("luma.description.endImageUrl"),class:"info"},null,8,["content"])])}var at=k(et,[["render",nt],["__scopeId","data-v-97900bb4"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/EndImageUrlInput.vue"]]);const lt=w({name:"StartImageUrlInput",components:{ElUpload:Q,ElButton:R,InfoIcon:A},data(){return{fileList:[],uploadUrl:Z()+"/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.luma)==null?void 0:e.config)==null?void 0:t.start_image_url},set(e){var o,a;const t=(o=this.urls)==null?void 0:o[0];this.$store.commit("luma/setConfig",{...(a=this.$store.state.luma)==null?void 0:a.config,start_image_url:t})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){y.warning(this.$t("luma.message.uploadStartImageExceed"))},onError(){y.error(this.$t("luma.message.uploadStartImageError"))},async onRemove(){y.error(this.$t("luma.message.uploadStartImageError"))},onSetStartImageUrl(){var t,o;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("luma/setConfig",{...(o=this.$store.state.luma)==null?void 0:o.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),it={class:"field"},rt={class:"title font-bold"},ct={class:"upload-wrapper"};function ut(e,t,o,a,f,h){const c=n("el-button"),u=n("el-upload"),d=n("info-icon");return r(),p("div",it,[l("h2",rt,i(e.$t("luma.name.startImageUrl")),1),l("div",ct,[s(u,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[s(c,{size:"small",type:"primary",round:""},{default:m(()=>[v(i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),s(d,{content:e.$t("luma.description.startImageUrl"),class:"info"},null,8,["content"])])}var dt=k(lt,[["render",ut],["__scopeId","data-v-5440a4bf"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/StartImageUrlInput.vue"]]);const mt=w({name:"UploadVideo",components:{ElUpload:Q,ElButton:R,InfoIcon:A},data(){return{fileList:[],uploadUrl:Z()+"/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.luma)==null?void 0:e.config)==null?void 0:t.video_url},set(e){var o,a;const t=(o=this.urls)==null?void 0:o[0];this.$store.commit("luma/setConfig",{...(a=this.$store.state.luma)==null?void 0:a.config,video_url:t})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){y.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){y.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const t=e.type==="video/mp4",o=e.size/1024/1024<10;return t?o?!0:(y.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(y.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){var t,o;const e=(t=this.urls)==null?void 0:t[0];this.$store.commit("luma/setConfig",{...(o=this.$store.state.luma)==null?void 0:o.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),pt={class:"field"},_t={class:"title font-bold"},ft={class:"upload-wrapper"};function ht(e,t,o,a,f,h){const c=n("el-button"),u=n("el-upload"),d=n("info-icon");return r(),p("div",pt,[l("h2",_t,i(e.$t("luma.name.videoUrl")),1),l("div",ft,[s(u,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[s(c,{size:"small",type:"primary",round:""},{default:m(()=>[v(i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])]),s(d,{content:e.$t("luma.description.videoUrl"),class:"info"},null,8,["content"])])}var vt=k(mt,[["render",ht],["__scopeId","data-v-46c66c9f"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/UploadVideo.vue"]]);const gt="",$t=w({name:"PromptInput",components:{ElInput:Se,InfoIcon:A},computed:{prompt:{get(){var e,t;return(t=(e=this.$store.state.luma)==null?void 0:e.config)==null?void 0:t.prompt},set(e){var t;console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...(t=this.$store.state.luma)==null?void 0:t.config,prompt:e})}}},mounted(){this.value||(this.value=gt)}}),yt={class:"field"},bt={class:"box"},kt={class:"title font-bold"};function wt(e,t,o,a,f,h){const c=n("info-icon"),u=n("el-input");return r(),p("div",yt,[l("div",bt,[l("h2",kt,i(e.$t("luma.name.prompt")),1),s(c,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),s(u,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=d=>e.prompt=d),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var It=k($t,[["render",wt],["__scopeId","data-v-19a7446b"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/PromptInput.vue"]]);const Vt=w({name:"ExtendFromInput",components:{VuePlyr:ve},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){var e;return(e=this.$store.state.luma)==null?void 0:e.config}}}),St={class:"field"},Et={class:"box"},Ut={class:"title font-bold"},Ct={class:"task"},Lt=["data-poster"],Pt=["src"];function Nt(e,t,o,a,f,h){const c=n("vue-plyr");return r(),p("div",St,[l("div",Et,[l("h2",Ut,i(e.$t("luma.name.extend")),1)]),l("div",Ct,[l("div",null,[s(c,{options:e.options,class:"video"},{default:m(()=>{var u,d;return[l("video",{controls:"",crossorigin:"",playsinline:"","data-poster":(u=e.config)==null?void 0:u.thumbnail_url},[l("source",{size:"1080",src:(d=e.config)==null?void 0:d.video_url,type:"video/mp4"},null,8,Pt)],8,Lt)]}),_:1},8,["options"])])])])}var Tt=k(Vt,[["render",Nt],["__scopeId","data-v-1cefb16b"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/ExtendFromInput.vue"]]);const At=w({name:"PresetPanel",components:{LoopSelector:xe,StartImageUrlInput:dt,EndImageUrlInput:at,EnhancementSelector:qe,ElButton:R,FontAwesomeIcon:K,PromptInput:It,ExtendFromInput:Tt,CustomSelector:Je,UploadVideo:vt},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.luma)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Rt={class:"panel"},Gt={class:"config"},Dt={class:"actions"};function Mt(e,t,o,a,f,h){var L,V,T,G,D,M,z,F,O;const c=n("extend-from-input"),u=n("prompt-input"),d=n("custom-selector"),_=n("upload-video"),$=n("start-image-url-input"),S=n("end-image-url-input"),E=n("enhancement-selector"),N=n("loop-selector"),U=n("font-awesome-icon"),C=n("el-button");return r(),p("div",Rt,[l("div",Gt,[((L=e.config)==null?void 0:L.video_id)||((V=e.config)==null?void 0:V.video_url)?(r(),P(c,{key:0,class:"mb-4"})):g("v-if",!0),s(u,{class:"mb-4"}),(T=e.config)!=null&&T.video_id?g("v-if",!0):(r(),P(d,{key:1,class:"mb-4"})),(G=e.config)!=null&&G.custom?(r(),P(_,{key:2,class:"mb-4"})):g("v-if",!0),!(((D=e.config)==null?void 0:D.video_id)||((M=e.config)==null?void 0:M.video_url))&&!((z=e.config)!=null&&z.custom)?(r(),P($,{key:3,class:"mb-4"})):g("v-if",!0),s(S,{class:"mb-4"}),s(E,{class:"mb-4"}),s(N,{class:"mb-4"}),l("div",Dt,[((F=e.config)==null?void 0:F.video_url)!==void 0||((O=e.config)==null?void 0:O.custom)?(r(),P(C,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[s(U,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(r(),P(C,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[s(U,{icon:"fa-solid fa-magic",class:"mr-2"}),v(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])])}var zt=k(At,[["render",Mt],["__scopeId","data-v-951b4cc0"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/ConfigPanel.vue"]]);const Ft=w({name:"VideoPlayer",components:{VuePlyr:ve},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),Ot=["data-poster"],jt=["src"];function qt(e,t,o,a,f,h){const c=n("vue-plyr");return r(),p("div",null,[s(c,{options:e.options,class:"video"},{default:m(()=>{var u,d,_,$;return[l("video",{controls:"",crossorigin:"",playsinline:"","data-poster":(d=(u=e.modelValue)==null?void 0:u.response)==null?void 0:d.thumbnail_url},[l("source",{size:"1080",src:($=(_=e.modelValue)==null?void 0:_.response)==null?void 0:$.video_url,type:"video/mp4"},null,8,jt)],8,Ot)]}),_:1},8,["options"])])}var Bt=k(Ft,[["render",qt],["__scopeId","data-v-759e400c"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/VideoPlayer.vue"]]);const Ht=w({name:"TaskPreview",components:{ElImage:Ee,CopyToClipboard:Ne,FontAwesomeIcon:K,ElAlert:Ue,VideoPlayer:Bt,ElTooltip:Ce,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){var e;return(e=this.$store.state.luma)==null?void 0:e.application},config(){var e;return(e=this.$store.state.luma)==null?void 0:e.config}},methods:{onExtend(e,t){var o;e.stopPropagation(),console.debug("set config",t),this.$store.commit("luma/setConfig",{...(o=this.$store.state.luma)==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),a=o.searchParams.get("retry");if(!a)o.searchParams.set("retry","1");else if(parseInt(a)<2)o.searchParams.set("retry",(parseInt(a)+1).toString());else return;t.src=o.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),Kt={class:"preview"},Zt={class:"left"},Jt={class:"main"},Qt={class:"bot"},Wt={class:"datetime"},Xt={class:"info"},Yt={key:0,class:"prompt mt-2"},xt={key:0},eo={key:1},to={key:0,class:q({content:!0,failed:!0})},oo={class:"image-wrapper"},so={key:0,class:q({operations:!0,"mt-2":!0})},no={class:"description"},ao={key:1,class:q({content:!0})},lo={class:"description"},io={class:"description"},ro={class:"description"},co={key:2,class:q({content:!0})},uo={class:"description"};function mo(e,t,o,a,f,h){var N,U,C,L,V,T,G,D,M,z,F,O,W,X,Y,x,ee,te,oe,se,ne,ae,le;const c=n("el-image"),u=n("VideoPlayer"),d=n("el-button"),_=n("el-tooltip"),$=n("font-awesome-icon"),S=n("copy-to-clipboard"),E=n("el-alert");return r(),p("div",Kt,[l("div",Zt,[s(c,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),l("div",Jt,[l("div",Qt,[v(i(e.$t("luma.name.lumaBot"))+" ",1),l("span",Wt,i(e.$dayjs.format(""+new Date(parseFloat(((N=e.modelValue)==null?void 0:N.created_at)||"")*1e3))),1)]),l("div",Xt,[(C=(U=e.modelValue)==null?void 0:U.request)!=null&&C.prompt?(r(),p("p",Yt,[v(i((V=(L=e.modelValue)==null?void 0:L.request)==null?void 0:V.prompt)+" ",1),(T=e.modelValue)!=null&&T.response?g("v-if",!0):(r(),p("span",xt," - ("+i(e.$t("luma.status.pending"))+") ",1)),((D=(G=e.modelValue)==null?void 0:G.response)==null?void 0:D.state)==="processing"||((z=(M=e.modelValue)==null?void 0:M.response)==null?void 0:z.state)==="pending"?(r(),p("span",eo," - ("+i(e.$t("luma.status.processing"))+") ",1)):g("v-if",!0)])):g("v-if",!0)]),g(" Display success message "),((O=(F=e.modelValue)==null?void 0:F.response)==null?void 0:O.success)===!0?(r(),p("div",to,[l("div",oo,[s(u,{"model-value":e.modelValue},null,8,["model-value"])]),((W=e.modelValue)==null?void 0:W.response)&&!((X=e.config)!=null&&X.custom)?(r(),p("div",so,[s(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:m(()=>[s(d,{type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=I=>{var b;return e.onExtend(I,(b=e.modelValue)==null?void 0:b.response)})},{default:m(()=>[v(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),s(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:m(()=>[s(d,{type:"info",size:"small",class:"btn-action",onClick:t[1]||(t[1]=I=>{var b,j;return e.onDownload(I,(j=(b=e.modelValue)==null?void 0:b.response)==null?void 0:j.video_url)})},{default:m(()=>[v(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):g("v-if",!0),s(E,{closable:!1,class:"mt-2 success"},{default:m(()=>{var I,b;return[l("p",no,[s($,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("luma.name.taskId"))+": "+i((I=e.modelValue)==null?void 0:I.id)+" ",1),s(S,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),((x=(Y=e.modelValue)==null?void 0:Y.response)==null?void 0:x.state)==="failed"||((te=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:te.success)===!1?(r(),p("div",ao,[s(E,{closable:!1,class:"failure"},{template:m(()=>[s($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+i(e.$t("luma.name.failure")),1)]),default:m(()=>{var I,b,j,ie,re,ce,ue,de,me,pe,_e;return[l("p",lo,[s($,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("luma.name.taskId"))+": "+i((I=e.modelValue)==null?void 0:I.id)+" ",1),s(S,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])]),l("p",io,[s($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),v(" "+i(e.$t("luma.name.failureReason"))+": "+i((re=(ie=(j=e.modelValue)==null?void 0:j.response)==null?void 0:ie.error)==null?void 0:re.message)+" ",1),s(S,{content:(de=(ue=(ce=e.modelValue)==null?void 0:ce.response)==null?void 0:ue.error)==null?void 0:de.message,class:"btn-copy"},null,8,["content"])]),l("p",ro,[s($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),v(" "+i(e.$t("luma.name.traceId"))+": "+i((me=e.modelValue)==null?void 0:me.trace_id)+" ",1),s(S,{content:(_e=(pe=e.modelValue)==null?void 0:pe.response)==null?void 0:_e.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),!((oe=e.modelValue)!=null&&oe.response)||((ne=(se=e.modelValue)==null?void 0:se.response)==null?void 0:ne.state)==="processing"||((le=(ae=e.modelValue)==null?void 0:ae.response)==null?void 0:le.state)==="pending"?(r(),p("div",co,[s(E,{closable:!1,class:"info"},{template:m(()=>[s($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),v(" "+i(e.$t("luma.name.failure")),1)]),default:m(()=>{var I,b;return[l("p",uo,[s($,{icon:"fa-solid fa-magic",class:"mr-1"}),v(" "+i(e.$t("luma.name.taskId"))+": "+i((I=e.modelValue)==null?void 0:I.id)+" ",1),s(S,{content:(b=e.modelValue)==null?void 0:b.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0)])])}var po=k(Ht,[["render",mo],["__scopeId","data-v-077795a0"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/task/Preview.vue"]]);const _o=w({name:"RecentPanel",components:{TaskPreview:po,ElSkeleton:Le,ElSkeletonItem:Pe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,o,a;return{...(e=this.$store.state.luma)==null?void 0:e.tasks,items:(a=(o=(t=this.$store.state.luma)==null?void 0:t.tasks)==null?void 0:o.items)==null?void 0:a.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),fo={key:0,class:"tasks"},ho={class:"left"},vo={class:"main"},go={key:1,class:"tasks"},$o={key:2,class:"description"};function yo(e,t,o,a,f,h){var _,$,S,E,N,U,C,L;const c=n("el-skeleton-item"),u=n("el-skeleton"),d=n("task-preview");return r(),p("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...V)=>e.onHandleScroll&&e.onHandleScroll(...V))},[((_=e.tasks)==null?void 0:_.items)===void 0?(r(),p("div",fo,[(r(),p(fe,null,he(3,V=>l("div",{key:V,class:"task placeholder"},[l("div",ho,[s(u,{animated:""},{template:m(()=>[s(c,{variant:"image",class:"avatar"})]),_:1})]),l("div",vo,[s(u,{animated:""},{template:m(()=>[s(c,{variant:"p",class:"title"}),s(c,{variant:"image",class:"icon"})]),_:1})])])),64))])):((S=($=e.tasks)==null?void 0:$.items)==null?void 0:S.length)&&((N=(E=e.tasks)==null?void 0:E.items)==null?void 0:N.length)>0?(r(),p("div",go,[(r(!0),p(fe,null,he((U=e.tasks)==null?void 0:U.items,(V,T)=>(r(),P(d,{key:T,"model-value":V,class:"preview"},null,8,["model-value"]))),128))])):g("v-if",!0),((L=(C=e.tasks)==null?void 0:C.items)==null?void 0:L.length)===0?(r(),p("p",$o,i(e.$t("luma.message.noTasks")),1)):g("v-if",!0)],544)}var bo=k(_o,[["render",yo],["__scopeId","data-v-2f8302a7"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/RecentPanel.vue"]]);const ko="https://webhook.acedata.cloud/luma",wo=w({name:"LumaIndex",components:{ConfigPanel:zt,Layout:Me,RecentPanel:bo},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){var e,t;return((t=(e=this.$store.state.luma)==null?void 0:e.status)==null?void 0:t.getApplications)===B.Request},service(){return this.$store.state.luma.service},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},initializing(){return this.$store.state.luma.status.getApplications===B.Request},needApply(){return this.$store.state.luma.status.getApplications===B.Success&&!this.application},application(){return this.$store.state.luma.application},applications(){return this.$store.state.luma.applications},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,t){var o,a;((o=e==null?void 0:e.items)==null?void 0:o.length)>((a=t==null?void 0:t.items)==null?void 0:a.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,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("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){be.create({application:this.application}).then(({data:e})=>{this.application=e,y.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)===ke&&y.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:a}=e||{};console.debug("limit",t,"createdAtMin",o,"createdAtMax",a),await this.$store.dispatch("luma/getTasks",{limit:t,createdAtMin:o,createdAtMax:a})},async onGenerate(){var o;const e={...this.config,callback_url:ko},t=(o=this.credential)==null?void 0:o.token;if(!t){console.error("no token specified");return}y.info(this.$t("luma.message.startingTask")),we.generate(e,{token:t}).then(()=>{y.success(this.$t("luma.message.startTaskSuccess")),this.$store.commit("luma/setConfig",{config:void 0})}).catch(a=>{var h,c;const f=(h=a==null?void 0:a.response)==null?void 0:h.data;((c=f==null?void 0:f.error)==null?void 0:c.code)===Ie?y.error(this.$t("luma.message.usedUp")):y.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Io(e,t,o,a,f,h){const c=n("config-panel"),u=n("recent-panel"),d=n("layout");return r(),P(d,null,{config:m(()=>[s(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[s(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}var Ro=k(wo,[["render",Io],["__scopeId","data-v-c45e0af8"],["__file","/home/runner/work/Nexior/Nexior/src/pages/luma/Index.vue"]]);export{Ro as default};
|