@acedatacloud/nexior 2.20.0 → 2.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/assets/{Auth.d5d94122.js → Auth.6cca0fab.js} +1 -1
  2. package/dist/assets/{Callback.60b22029.js → Callback.14695fed.js} +1 -1
  3. package/dist/assets/{Chatdoc.6a3f9b4e.js → Chatdoc.ad673737.js} +1 -1
  4. package/dist/assets/{Console.c926fcfe.js → Console.8af9e37e.js} +1 -1
  5. package/dist/assets/Conversation.788f9175.js +1 -0
  6. package/dist/assets/Conversation.deb2cf30.js +1 -0
  7. package/dist/assets/{Conversation.75c902c2.css → Conversation.e721b0e3.css} +1 -1
  8. package/dist/assets/{CopyToClipboard.c63a2368.js → CopyToClipboard.52cd5f15.js} +1 -1
  9. package/dist/assets/{Detail.6c0ee70d.js → Detail.da5709c8.js} +1 -1
  10. package/dist/assets/{EditArray.84f406a3.js → EditArray.0b1a73f5.js} +1 -1
  11. package/dist/assets/{Extra.b8a114da.js → Extra.11fc923a.js} +1 -1
  12. package/dist/assets/{History.4b9321ad.js → History.5d5f9ba8.js} +1 -1
  13. package/dist/assets/{ImageNavigator.5d4b2ff4.js → ImageNavigator.21f9d870.js} +1 -1
  14. package/dist/assets/{Index.d1627d8c.js → Index.0703c443.js} +2 -2
  15. package/dist/assets/Index.0db094dc.js +1 -0
  16. package/dist/assets/{Index.936ff9dc.js → Index.2076f6c2.js} +1 -1
  17. package/dist/assets/Index.2c9ed623.js +1 -0
  18. package/dist/assets/Index.2f005d12.js +1 -0
  19. package/dist/assets/Index.3caa8f61.js +1 -0
  20. package/dist/assets/{Index.50c05336.js → Index.3e584b7e.js} +1 -1
  21. package/dist/assets/Index.7964ac96.js +1 -0
  22. package/dist/assets/Index.918b8fcd.js +1 -0
  23. package/dist/assets/Index.a1992c96.js +1 -0
  24. package/dist/assets/Index.c6cb1e50.js +1 -0
  25. package/dist/assets/{Index.18b018e7.js → Index.c9762e65.js} +1 -1
  26. package/dist/assets/Index.cc623c8c.js +1 -0
  27. package/dist/assets/Index.d075cd68.js +1 -0
  28. package/dist/assets/{Index.8e43e326.js → Index.ef23f2c2.js} +1 -1
  29. package/dist/assets/{InfoIcon.cde68aa8.js → InfoIcon.225370af.js} +1 -1
  30. package/dist/assets/{Invitees.35e07a5e.js → Invitees.94613c97.js} +1 -1
  31. package/dist/assets/{List.9659cfe8.js → List.1668d8a8.js} +1 -1
  32. package/dist/assets/{List.3d8bb74c.js → List.c9b56df2.js} +1 -1
  33. package/dist/assets/{List.939fb660.js → List.f3e655ed.js} +1 -1
  34. package/dist/assets/{Login.686a7676.js → Login.f8af00b7.js} +1 -1
  35. package/dist/assets/{Main.add4d79e.js → Main.9d06d035.js} +1 -1
  36. package/dist/assets/Manage.ca0b9d17.js +1 -0
  37. package/dist/assets/MarkdownRenderer.5ea5feeb.js +1 -0
  38. package/dist/assets/{Navigator.b99bdf58.js → Navigator.5cc4e1f4.js} +1 -1
  39. package/dist/assets/{Pagination.54b03eeb.js → Pagination.76f292a1.js} +1 -1
  40. package/dist/assets/{Setting.0ab4fe6a.js → Setting.c27e8802.js} +1 -1
  41. package/dist/assets/Status.9b29934c.js +1 -0
  42. package/dist/assets/{Subscribe.b962ce8c.js → Subscribe.33bb3a1e.js} +1 -1
  43. package/dist/assets/{VideoNavigator.d4612b51.js → VideoNavigator.834a1651.js} +1 -1
  44. package/dist/assets/{distribution.c91d4058.js → distribution.51fc0fc3.js} +1 -1
  45. package/dist/assets/index.65a34a3c.js +3 -0
  46. package/dist/assets/index.8f0a4606.css +1 -0
  47. package/dist/assets/{order.5533e7de.js → order.8abe108a.js} +1 -1
  48. package/dist/assets/{price.9f505fa1.js → price.5e7bcedb.js} +1 -1
  49. package/dist/index.html +2 -2
  50. package/package.json +1 -1
  51. package/dist/assets/Conversation.870d31ff.js +0 -1
  52. package/dist/assets/Conversation.b933aa7b.js +0 -1
  53. package/dist/assets/Index.087ec735.js +0 -1
  54. package/dist/assets/Index.0be32041.js +0 -1
  55. package/dist/assets/Index.37589032.js +0 -1
  56. package/dist/assets/Index.460286bf.js +0 -1
  57. package/dist/assets/Index.5d39fb31.js +0 -1
  58. package/dist/assets/Index.5f07823b.js +0 -1
  59. package/dist/assets/Index.78d6adc9.js +0 -1
  60. package/dist/assets/Index.9e749739.js +0 -1
  61. package/dist/assets/Index.b4f4ca95.js +0 -1
  62. package/dist/assets/Index.ece00551.js +0 -1
  63. package/dist/assets/Manage.3e60d3ba.js +0 -1
  64. package/dist/assets/MarkdownRenderer.94bcb2ef.js +0 -1
  65. package/dist/assets/Status.c273ddde.js +0 -1
  66. package/dist/assets/errorCode.310759b7.js +0 -1
  67. package/dist/assets/index.1562347c.css +0 -1
  68. package/dist/assets/index.42fb7c30.js +0 -3
@@ -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.42fb7c30.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
+ 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.65a34a3c.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.42fb7c30.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};
1
+ import{C as a,D as i}from"./index.65a34a3c.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.42fb7c30.js"></script>
19
+ <script type="module" crossorigin src="/assets/index.65a34a3c.js"></script>
20
20
  <link rel="modulepreload" href="/assets/vendor-@vue.66ea933c.js">
21
21
  <link rel="modulepreload" href="/assets/vendor-element-plus.6158e0fe.js">
22
22
  <link rel="modulepreload" href="/assets/vendor-others.2105a885.js">
@@ -24,7 +24,7 @@
24
24
  <link rel="modulepreload" href="/assets/vendor-qrcode.46bc4fb1.js">
25
25
  <link rel="modulepreload" href="/assets/vendor-fortawesome.fe21f86d.js">
26
26
  <link rel="stylesheet" href="/assets/vendor-others.fbff9a31.css">
27
- <link rel="stylesheet" href="/assets/index.1562347c.css">
27
+ <link rel="stylesheet" href="/assets/index.8f0a4606.css">
28
28
  </head>
29
29
  <body>
30
30
  <div id="app">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acedatacloud/nexior",
3
- "version": "2.20.0",
3
+ "version": "2.20.2",
4
4
  "author": "Ace Data Cloud <office@acedata.cloud>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- import{a as Ne}from"./vendor-axios.168e6950.js";import{ad as Te,a9 as _e,a3 as Re}from"./vendor-others.2105a885.js";import{_ as I,K as se,L as U,M as j,H as De,N as Ae,O as x,P as de,Q as ce,g as ge,S as qe,s as Oe,T as Q,b as Ge,A as Le,U as te,V as K,W as ee,h as Ue,j as ue,X as Me,Y as Fe,Z as Ve}from"./index.42fb7c30.js";import{H as N,o as a,e as _,al as i,L as y,M as h,V as n,f as r,O as M,W as B,T as g,R as S,av as Pe,U as G,ai as F,as as oe,$ as H,S as T,P,aw as He,a0 as Be,X as je,I as me}from"./vendor-@vue.66ea933c.js";import{M as We}from"./MarkdownRenderer.94bcb2ef.js";import{C as Ke}from"./CopyToClipboard.c63a2368.js";import{ar as L,as as ze,at as Qe,au as Je,av as Xe,ac as Ye}from"./vendor-fortawesome.fe21f86d.js";import{t as ne,M as fe,B as Ze,l as ve,s as ie,N as $e,O as xe,J as pe,d as ae,f as re,e as le,P as ye,Q as be,A as we,F as J,G as X,R as et,E as tt,r as st,y as ot,S as nt}from"./vendor-element-plus.6158e0fe.js";import{E as ke,a as Ce,b as z,c as it,d as at,e as rt,f as lt,g as dt,h as he}from"./errorCode.310759b7.js";import{d as ct}from"./avatar.34ead943.js";import{E as Y,a as Se,b as Ee}from"./EditArray.84f406a3.js";import"./vendor-qrcode.46bc4fb1.js";import"./vendor-markdown.b22db477.js";import"./vendor-highlight.js.6ee9ffbc.js";const ut=N({name:"AnsweringMark",data(){return{}},computed:{conversationId(){var e,t;return(t=(e=this.$route.params)==null?void 0:e.id)==null?void 0:t.toString()}}}),mt={class:"mark"};function pt(e,t,o,d,$,u){return a(),_("div",mt)}var ht=I(ut,[["render",pt],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/AnsweringMark.vue"]]);const _t=N({name:"CopyToClipboard",components:{FontAwesomeIcon:L,ElTooltip:ne},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:["restart"],data(){return{copied:!1}},methods:{onRestart(){this.$emit("restart")}}});function gt(e,t,o,d,$,u){const l=i("font-awesome-icon"),p=i("el-tooltip");return a(),y(p,{effect:"dark",content:e.$t("common.button.restart"),placement:"bottom"},{default:h(()=>[n(l,{icon:"fa-solid fa-sync",class:"icon-sync",onClick:e.onRestart},null,8,["onClick"])]),_:1},8,["content"])}var ft=I(_t,[["render",gt],["__scopeId","data-v-18116778"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/RestartToGenerate.vue"]]);const vt=N({name:"EditMessage",components:{FontAwesomeIcon:L,ElTooltip:ne},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:["click"],data(){return{copied:!1}},methods:{onEdit(){this.$emit("click")}}});function $t(e,t,o,d,$,u){const l=i("font-awesome-icon"),p=i("el-tooltip");return a(),_("span",null,[n(p,{effect:"dark",content:e.$t("common.button.restart"),placement:"bottom"},{default:h(()=>[n(l,{icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:e.onEdit},null,8,["onClick"])]),_:1},8,["content"])])}var yt=I(vt,[["render",$t],["__scopeId","data-v-5c26bf56"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/EditMessage.vue"]]);const bt=N({name:"FilePreview",components:{FontAwesomeIcon:L,ElProgress:fe},props:{name:{type:String,required:!0},percentage:{type:Number,required:!0},closable:{type:Boolean,required:!1,default:!0}},emits:["remove"],methods:{isImageUrl:se}}),wt={class:"file"},kt={class:"left"},Ct={class:"wrapper"},St={class:"right"},Et={class:"text-xs font-bold truncate"},It={key:0,class:"close"};function Nt(e,t,o,d,$,u){const l=i("font-awesome-icon"),p=i("el-progress");return a(),_("div",wt,[r("div",kt,[r("div",Ct,[n(l,{icon:"fa-regular fa-file-alt"}),M(n(p,{type:"circle","stroke-width":3,percentage:e.percentage,width:25},null,8,["percentage"]),[[B,e.percentage&&e.percentage<100]])])]),r("div",St,[r("span",Et,g(e.name),1)]),e.closable?(a(),_("div",It,[n(l,{icon:"fa-solid fa-xmark",class:"icon icon-close",onClick:t[0]||(t[0]=f=>e.$emit("remove"))})])):S("v-if",!0)])}var Ie=I(bt,[["render",Nt],["__scopeId","data-v-5e8b97e5"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/FilePreview.vue"]]);const Tt=N({name:"Message",components:{EditMessage:yt,CopyToClipboard:Ke,RestartToGenerate:ft,AnsweringMark:ht,MarkdownRenderer:We,ElAlert:Ze,FilePreview:Ie,ElButton:ve,ElImage:ie,ElInput:$e},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:U}},computed:{modelGroup(){return this.$store.state.chat.modelGroup},errorText(){var e,t;if(!(!this.message.error||!((e=this.message.error)!=null&&e.code)))switch((t=this.message.error)==null?void 0:t.code){case he:return this.$t("chat.message.errorUsedUp");case dt:return this.$t("chat.message.errorApiError");case lt:return this.$t("chat.message.errorBadRequest");case rt:return this.$t("chat.message.errorTimeout");case at:return this.$t("chat.message.errorTooManyRequests");case it:return this.$t("chat.message.errorContentTooLarge");case z:return this.$t("chat.message.errorNotApplied");case Ce:return;case ke:default:return this.$t("chat.message.errorUnknown")}},showBuyMore(){var e;return this.message.role===j&&((e=this.message.error)==null?void 0:e.code)===he}},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(){Te(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){var e;this.$router.push({name:De,params:{id:(e=this.application)==null?void 0:e.id}})}}}),Rt=["role"],Dt={class:"author"},At={key:0,class:"main"},qt={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"},Ot={key:0,class:"message-content"},Gt={key:1},Lt=["src"],Ut={key:1,class:"edits"},Mt={class:"flex justify-end"},Ft={class:"operations"};function Vt(e,t,o,d,$,u){var A;const l=i("el-image"),p=i("markdown-renderer"),f=i("file-preview"),v=i("el-input"),m=i("el-button"),s=i("answering-mark"),c=i("edit-message"),b=i("copy-to-clipboard"),w=i("restart-to-generate"),k=i("el-alert"),q=Pe("motion");return a(),_("div",{class:P({message:!0,[e.message.role]:!0}),role:e.message.role},[r("div",Dt,[e.message.role==="assistant"?(a(),y(l,{key:0,src:e.modelGroup.icon,fit:"cover",class:"avatar"},null,8,["src"])):S("v-if",!0)]),e.errorText?(a(),y(k,{key:1,class:"error",title:e.errorText,type:"error",closable:!1},null,8,["title"])):(a(),_("div",At,[M((a(),_("div",qt,[e.isEditing?(a(),_("div",Ut,[n(v,{modelValue:e.questionValue,"onUpdate:modelValue":t[0]||(t[0]=E=>e.questionValue=E),type:"textarea",class:"mb-2",onKeydown:oe(H(e.onEdit,["exact","prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),r("div",Mt,[n(m,{round:"",onClick:e.cancelEdit},{default:h(()=>[T(g(e.$t("common.button.cancel")),1)]),_:1},8,["onClick"]),n(m,{type:"primary",class:"btn-confirm",round:"",onClick:e.onEdit},{default:h(()=>[T(g(e.$t("common.button.confirm")),1)]),_:1},8,["onClick"])])])):(a(),_("div",Ot,[Array.isArray(e.message.content)?(a(),_("div",Gt,[(a(!0),_(G,null,F(e.message.content,(E,V)=>{var R,D;return a(),_("div",{key:V},[E.type==="image_url"?(a(),_("img",{key:0,src:typeof(E==null?void 0:E.image_url)=="string"?E.image_url:(R=E.image_url)==null?void 0:R.url,fit:"cover",class:"image"},null,8,Lt)):S("v-if",!0),E.file_url?(a(),y(f,{key:1,name:typeof(E==null?void 0:E.file_url)=="string"?E.file_url:(D=E.file_url)==null?void 0:D.url,percentage:0,closable:!1,class:"mt-2"},null,8,["name"])):S("v-if",!0),E.type==="text"?(a(),y(p,{key:V,content:E.text},null,8,["content"])):S("v-if",!0)])}),128))])):(a(),y(p,{key:0,content:(A=e.message)==null?void 0:A.content},null,8,["content"]))])),e.message.state===e.messageState.PENDING?(a(),y(s,{key:2})):S("v-if",!0)])),[[q]]),r("div",Ft,[e.message.role==="user"&&!e.isEditing&&!Array.isArray(e.message.content)?(a(),y(c,{key:0,class:"btn-edit",onClick:e.startEditing},null,8,["onClick"])):S("v-if",!0),!Array.isArray(e.message.content)&&(e.message.state===e.messageState.FINISHED||e.message.state===e.messageState.FAILED)?(a(),y(b,{key:1,content:e.message.content,class:"btn-copy"},null,8,["content"])):S("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]?(a(),y(w,{key:2,class:"btn-restart",messages:e.messages,onRestart:e.onRestart},null,8,["messages","onRestart"])):S("v-if",!0)])])),e.showBuyMore?(a(),y(m,{key:2,round:"",type:"primary",class:"btn btn-buy",size:"small",onClick:e.onBuyMore},{default:h(()=>[T(g(e.$t("common.button.buyMore")),1)]),_:1},8,["onClick"])):S("v-if",!0)],10,Rt)}var Pt=I(Tt,[["render",Vt],["__scopeId","data-v-f0476f80"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Message.vue"]]);const Ht=N({name:"ImagePreview",components:{FontAwesomeIcon:L,ElProgress:fe},props:{url:{type:String,required:!0},name:{type:String,required:!0},percentage:{type:Number,required:!0},closable:{type:Boolean,required:!1,default:!0}},emits:["remove"]}),Bt={class:"image"},jt=["src","alt"],Wt={key:0,class:"close"};function Kt(e,t,o,d,$,u){const l=i("el-progress"),p=i("font-awesome-icon");return a(),_("div",Bt,[r("img",{class:"size-10",src:e.url,alt:e.name},null,8,jt),M(n(l,{type:"circle","stroke-width":3,percentage:e.percentage,width:30},null,8,["percentage"]),[[B,e.percentage&&e.percentage<100]]),e.closable?(a(),_("div",Wt,[n(p,{icon:"fa-solid fa-xmark",class:"icon icon-close",onClick:t[0]||(t[0]=H(f=>e.$emit("remove"),["stop"]))})])):S("v-if",!0)])}var zt=I(Ht,[["render",Kt],["__scopeId","data-v-11203584"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/ImagePreview.vue"]]);const Qt=N({name:"Composer",components:{FilePreview:Ie,ImagePreview:zt,ElTooltip:ne,FontAwesomeIcon:L,ElUpload:xe},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:Ae()+"/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 t;return(t=e==null?void 0:e.response)==null?void 0:t.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:se,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,t,o){console.debug("File upload progress:",t.name,e.loaded,e.total)},onExceed(){pe.warning(this.$t("chat.message.uploadReferencesExceed"))},onError(){pe.error(this.$t("chat.message.uploadReferencesError"))}}}),Jt={class:"composer"},Xt={class:"tools"},Yt=["disabled","placeholder"];function Zt(e,t,o,d,$,u){const l=i("image-preview"),p=i("file-preview"),f=i("font-awesome-icon"),v=i("el-tooltip"),m=i("el-upload");return a(),_("div",Jt,[r("div",Xt,[n(m,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=s=>e.fileList=s),class:P({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:h(({file:s})=>{var c;return[e.isImageUrl(s.name)?(a(),y(l,{key:0,url:s.url||((c=s.response)==null?void 0:c.file_url),name:s.name,percentage:s.percentage,onRemove:b=>e.fileList.splice(e.fileList.indexOf(s),1)},null,8,["url","name","percentage","onRemove"])):(a(),y(p,{key:1,name:s.name,percentage:s.percentage,onRemove:b=>e.fileList.splice(e.fileList.indexOf(s),1)},null,8,["name","percentage","onRemove"]))]}),default:h(()=>[n(v,{class:"box-item",effect:"dark",content:e.$t("chat.message.uploadFile"),placement:"bottom"},{default:h(()=>[r("span",{class:P({btn:!0,"btn-upload":!0,disabled:!e.model.isFileSupported||e.disabled})},[n(f,{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:P({btn:!0,"btn-send":!0,disabled:!e.questionValue}),onClick:t[1]||(t[1]=(...s)=>e.onSubmit&&e.onSubmit(...s))},[n(f,{icon:"fa-solid fa-location-arrow",class:"icon icon-send"})],2),[[B,!e.disabled]]),M(r("span",{class:P({btn:!0,"btn-stop":!0,disabled:!e.disabled}),onClick:t[2]||(t[2]=(...s)=>e.onStop&&e.onStop(...s))},[n(f,{icon:"fa-solid fa-stop",class:"icon icon-stop"})],2),[[B,e.disabled]]),M(r("textarea",{ref:"textarea","onUpdate:modelValue":t[3]||(t[3]=s=>e.questionValue=s),disabled:e.disabled,class:"input",placeholder:e.$t("chat.message.newMessagePlaceholder"),style:Be({height:e.inputHeight}),onKeydown:t[4]||(t[4]=oe(H((...s)=>e.onSubmit&&e.onSubmit(...s),["exact","prevent"]),["enter"])),onInput:t[5]||(t[5]=(...s)=>e.adjustTextareaHeight&&e.adjustTextareaHeight(...s))},null,44,Yt),[[He,e.questionValue]])])}var xt=I(Qt,[["render",Zt],["__scopeId","data-v-a443d292"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Composer.vue"]]);const es=N({name:"ModelSelector",components:{ElDropdown:ae,ElDropdownMenu:re,ElDropdownItem:le,FontAwesomeIcon:L},emits:["update:modelValue","select","model-group-changed","model-changed"],data(){return{options:[x,de,ce]}},computed:{modelGroup(){return console.log("modelGroup",this.$store.state.chat.modelGroup),this.$store.state.chat.modelGroup},model(){return console.log("model",this.$store.state.chat.model),this.$store.state.chat.model}},watch:{modelGroup(e){console.debug("ModelSelector modelGroup changed",e),this.$store.dispatch("chat/setModel",e.models[0])}},mounted(){if(!this.modelGroup)console.debug("ModelSelector mounted, setting default model group"),this.$store.dispatch("chat/setModelGroup",x);else{console.debug("ModelSelector mounted, checking model group");const t=[x,de,ce].find(o=>o.name===this.modelGroup.name);t&&this.$store.dispatch("chat/setModelGroup",t)}},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)}}}),ts={class:"selector"},ss={class:"flex justify-center mr-1"},os={class:"icon"},ns=["src"],is={class:"name"},as={class:"angle"},rs={class:"item"},ls={class:"icon"},ds=["src"],cs={class:"info"},us={class:"name"},ms={class:"description"},ps={class:"flex justify-center"},hs={class:"name"},_s={class:"angle"},gs={class:"item"},fs={class:"info"},vs={key:0,class:"name"},$s={key:1,class:"description"};function ys(e,t,o,d,$,u){const l=i("font-awesome-icon"),p=i("el-dropdown-item"),f=i("el-dropdown-menu"),v=i("el-dropdown");return a(),_("div",ts,[n(v,{trigger:"click","popper-class":"popper"},{dropdown:h(()=>[n(f,null,{default:h(()=>[(a(!0),_(G,null,F(e.options,(m,s)=>(a(),y(p,{key:s,onClick:c=>e.onModelGroupChange(m)},{default:h(()=>[r("div",rs,[r("div",ls,[r("img",{src:m.icon},null,8,ds)]),r("div",cs,[r("p",us,g(m.getDisplayName()),1),r("p",ms,g(m.getDescription()),1)])])]),_:2},1032,["onClick"]))),128))]),_:1})]),default:h(()=>{var m;return[r("div",ss,[r("span",os,[r("img",{src:e.modelGroup.icon},null,8,ns)]),r("span",is,g((m=e.modelGroup)==null?void 0:m.getDisplayName()),1),r("span",as,[n(l,{icon:"fa-solid fa-angle-down"})])])]}),_:1}),n(v,{trigger:"click","popper-class":"popper"},{dropdown:h(()=>[e.modelGroup&&e.modelGroup.models?(a(),y(f,{key:0},{default:h(()=>[(a(!0),_(G,null,F(e.modelGroup.models,(m,s)=>(a(),y(p,{key:s,onClick:c=>e.onModelChange(m)},{default:h(()=>[r("div",gs,[r("div",fs,[m.getDisplayName?(a(),_("p",vs,g(m.getDisplayName()),1)):S("v-if",!0),m.getDescription?(a(),_("p",$s,g(m.getDescription()),1)):S("v-if",!0)])])]),_:2},1032,["onClick"]))),128))]),_:1})):S("v-if",!0)]),default:h(()=>{var m;return[r("div",ps,[r("span",hs,g((m=e.model)==null?void 0:m.getDisplayName()),1),r("span",_s,[n(l,{icon:"fa-solid fa-angle-down"})])])]}),_:1})])}var bs=I(es,[["render",ys],["__scopeId","data-v-358d65be"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/ModelSelector.vue"]]);const ws={},ks={class:"disclaimer"};function Cs(e,t){return a(),_("p",ks,g(e.$t("chat.message.howToUse")),1)}var Ss=I(ws,[["render",Cs],["__scopeId","data-v-42e751f2"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Disclaimer.vue"]]);const Es=N({name:"UserAvatar",data(){return{defaultAvatar:ct}},computed:{user(){var e;return(e=this.$store.getters)==null?void 0:e.user}}}),Is=["src"];function Ns(e,t,o,d,$,u){var l;return a(),_("img",{src:((l=e.user)==null?void 0:l.avatar)||e.defaultAvatar,class:"avatar"},null,8,Is)}var Ts=I(Es,[["render",Ns],["__scopeId","data-v-1dac1046"],["__file","/home/runner/work/Nexior/Nexior/src/components/user/Avatar.vue"]]);const Rs=N({name:"ThemeSelector",components:{ArrowDown:ye,ElDropdown:ae,ElDropdownMenu:re,ElDropdownItem:le,ElIcon:be},data(){return{theme:"light"}},computed:{currentLabel(){return this.theme==="dark"?this.$t("common.theme.dark"):this.$t("common.theme.light")}},mounted(){this.theme=this.loadFromCookie(),this.applyTheme()},methods:{onSelect(e){this.theme=e,this.applyTheme()},applyTheme(){_e("THEME",this.theme,{path:"/",domain:ge()}),this.theme==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},loadFromCookie(){return Re("THEME")==="dark"?"dark":"light"}}}),Ds={class:"el-dropdown-link"};function As(e,t,o,d,$,u){const l=i("arrow-down"),p=i("el-icon"),f=i("el-dropdown-item"),v=i("el-dropdown-menu"),m=i("el-dropdown");return a(),y(m,{trigger:"click",onCommand:e.onSelect},{dropdown:h(()=>[n(v,null,{default:h(()=>[n(f,{command:"light"},{default:h(()=>[T(g(e.$t("common.theme.light")),1)]),_:1}),n(f,{command:"dark"},{default:h(()=>[T(g(e.$t("common.theme.dark")),1)]),_:1})]),_:1})]),default:h(()=>[r("span",Ds,[T(g(e.currentLabel)+" ",1),n(p,{class:"el-icon--right"},{default:h(()=>[n(l)]),_:1})])]),_:1},8,["onCommand"])}var qs=I(Rs,[["render",As],["__scopeId","data-v-0dfaf416"],["__file","/home/runner/work/Nexior/Nexior/src/components/user/Theme.vue"]]);const Os=N({name:"LocaleSelector",components:{ElDropdown:ae,ElDropdownMenu:re,ElDropdownItem:le,ElIcon:be,ArrowDown:ye},data(){return{locales:qe}},computed:{value(){return this.$i18n.locale},currentLabel(){const e=this.locales.find(t=>t.value===this.value);return e?e.label:this.value}},methods:{async onSelectLocale(e){this.$router.push({query:{...this.$route.query,locale:void 0}}),await Oe(e),_e("LOCALE",e,{path:"/",domain:ge()})}}}),Gs={class:"el-dropdown-link"};function Ls(e,t,o,d,$,u){const l=i("arrow-down"),p=i("el-icon"),f=i("el-dropdown-item"),v=i("el-dropdown-menu"),m=i("el-dropdown");return a(),y(m,{trigger:"click",onCommand:e.onSelectLocale},{dropdown:h(()=>[n(v,null,{default:h(()=>[(a(!0),_(G,null,F(e.locales,(s,c)=>(a(),y(f,{key:c,command:s.value},{default:h(()=>[T(g(s.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:h(()=>[r("span",Gs,[T(g(e.currentLabel)+" ",1),n(p,{class:"el-icon--right"},{default:h(()=>[n(l)]),_:1})])]),_:1},8,["onCommand"])}var Us=I(Os,[["render",Ls],["__scopeId","data-v-572cdc5e"],["__file","/home/runner/work/Nexior/Nexior/src/components/user/Locale.vue"]]);const Ms=N({name:"GeneralSettings",components:{ThemeSwitcher:qs,LocaleSwitcher:Us}}),Fs={class:"flex justify-between items-center mb-4"},Vs={class:"block mb-2 text-sm font-medium"},Ps={class:"flex justify-between items-center mb-4"},Hs={class:"block mb-2 text-sm font-medium"};function Bs(e,t,o,d,$,u){const l=i("theme-switcher"),p=i("locale-switcher");return a(),_(G,null,[r("div",Fs,[r("label",Vs,g(e.$t("common.settings.theme")),1),n(l)]),r("div",Ps,[r("label",Hs,g(e.$t("common.settings.language")),1),n(p)])],64)}var js=I(Ms,[["render",Bs],["__file","/home/runner/work/Nexior/Nexior/src/components/setting/General.vue"]]);const Ws=N({name:"SiteIndex",components:{EditText:Y,EditImage:Se,EditArray:Ee,ElDivider:we,ElImage:ie,ElForm:J,ElFormItem:X},data(){return{editing:{title:!1}}},computed:{site(){return this.$store.getters.site}},methods:{onSave(e){var o;const t={...this.site,...e};Q.update((o=this.site)==null?void 0:o.id,t).then(()=>{var d;console.debug("getSite for id",(d=this.site)==null?void 0:d.id),this.$store.dispatch("getSite")})}}}),Ks={class:"block w-full"},zs={class:"block tip"},Qs={class:"block w-full"},Js={class:"block tip"},Xs={class:"block w-full"},Ys={class:"block tip"},Zs={class:"block w-full"},xs={class:"block tip"},eo={class:"block w-full"},to={class:"block tip"};function so(e,t,o,d,$,u){const l=i("el-form-item"),p=i("edit-text"),f=i("el-image"),v=i("edit-image"),m=i("el-divider"),s=i("edit-array"),c=i("el-form");return a(),y(c,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:h(()=>[n(l,{label:e.$t("site.field.origin")},{default:h(()=>[r("span",Ks,g(e.site.origin),1),r("span",zs,g(e.$t("site.message.originTip")),1)]),_:1},8,["label"]),n(l,{label:e.$t("site.field.title")},{default:h(()=>[r("span",Qs,[T(g(e.site.title)+" ",1),n(p,{"model-value":e.site.title,title:e.$t("site.title.editTitle"),placeholder:e.$t("site.placeholder.title"),onConfirm:t[0]||(t[0]=b=>e.onSave({title:b}))},null,8,["model-value","title","placeholder"])]),r("span",Js,g(e.$t("site.message.titleTip")),1)]),_:1},8,["label"]),n(l,{label:e.$t("site.field.logo")},{default:h(()=>[r("span",Xs,[n(f,{src:e.site.logo,class:"logo"},null,8,["src"]),n(v,{"model-value":e.site.logo,title:e.$t("site.title.editLogo"),tip:e.$t("site.message.editLogoTip"),onConfirm:t[1]||(t[1]=b=>e.onSave({logo:b}))},null,8,["model-value","title","tip"])]),r("span",Ys,g(e.$t("site.message.logoTip")),1)]),_:1},8,["label"]),n(l,{label:e.$t("site.field.favicon")},{default:h(()=>[r("span",Zs,[n(f,{src:e.site.favicon,class:"favicon"},null,8,["src"]),n(v,{"model-value":e.site.favicon,title:e.$t("site.title.editFavicon"),tip:e.$t("site.message.editFaviconTip"),onConfirm:t[2]||(t[2]=b=>e.onSave({favicon:b}))},null,8,["model-value","title","tip"])]),r("span",xs,g(e.$t("site.message.faviconTip")),1)]),_:1},8,["label"]),n(m,{"border-style":"dashed"}),n(l,{label:e.$t("site.field.admins")},{default:h(()=>{var b,w;return[r("span",eo,[T(g((b=e.site.admins)==null?void 0:b.join(", "))+" ",1),n(s,{"model-value":((w=e.site)==null?void 0:w.admins)||[],title:e.$t("site.title.editAdmins"),placeholder:e.$t("site.placeholder.admins"),tip:e.$t("site.message.adminsTip2"),min:1,"min-error-message":e.$t("site.message.atLeastOneAdmin"),onConfirm:t[3]||(t[3]=k=>e.onSave({admins:k}))},null,8,["model-value","title","placeholder","tip","min-error-message"])]),r("span",to,g(e.$t("site.message.adminsTip")),1)]}),_:1},8,["label"])]),_:1},8,["model"])}var oo=I(Ws,[["render",so],["__scopeId","data-v-e38df654"],["__file","/home/runner/work/Nexior/Nexior/src/components/setting/Site.vue"]]);const no=N({name:"SettingSeo",components:{EditText:Y,EditArray:Ee,ElForm:J,ElFormItem:X},data(){return{editing:{title:!1}}},computed:{site(){return this.$store.getters.site}},methods:{onSave(e){var o;const t={...this.site,...e};Q.update((o=this.site)==null?void 0:o.id,t).then(()=>{var d;console.debug("getSite for id",(d=this.site)==null?void 0:d.id),this.$store.dispatch("getSite")})}}}),io={class:"block w-full"},ao={class:"block tip"},ro={class:"block w-full"},lo={class:"block tip"};function co(e,t,o,d,$,u){const l=i("edit-text"),p=i("el-form-item"),f=i("edit-array"),v=i("el-form");return a(),y(v,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:h(()=>[n(p,{label:e.$t("site.field.description")},{default:h(()=>[r("span",io,[T(g(e.site.description)+" ",1),n(l,{"model-value":e.site.description,title:e.$t("site.title.editDescription"),placeholder:e.$t("site.placeholder.description"),onConfirm:t[0]||(t[0]=m=>e.onSave({description:m}))},null,8,["model-value","title","placeholder"])]),r("span",ao,g(e.$t("site.message.descriptionTip")),1)]),_:1},8,["label"]),n(p,{label:e.$t("site.field.keywords")},{default:h(()=>{var m,s;return[r("span",ro,[T(g((m=e.site.keywords)==null?void 0:m.join(", "))+" ",1),n(f,{"model-value":((s=e.site)==null?void 0:s.keywords)||[],title:e.$t("site.title.editKeywords"),placeholder:e.$t("site.placeholder.keywords"),tip:e.$t("site.message.keywordsTip2"),onConfirm:t[1]||(t[1]=c=>e.onSave({keywords:c}))},null,8,["model-value","title","placeholder","tip"])]),r("span",lo,g(e.$t("site.message.keywordsTip")),1)]}),_:1},8,["label"])]),_:1},8,["model"])}var uo=I(no,[["render",co],["__scopeId","data-v-57cb41c4"],["__file","/home/runner/work/Nexior/Nexior/src/components/setting/Seo.vue"]]);const mo=N({name:"SiteIndex",components:{EditText:Y,ElForm:J,ElFormItem:X},data(){return{editing:{title:!1}}},computed:{site(){return this.$store.getters.site}},methods:{onSave(e){var o;const t={...this.site,...e};Q.update((o=this.site)==null?void 0:o.id,t).then(()=>{var d;console.debug("getSite for id",(d=this.site)==null?void 0:d.id),this.$store.dispatch("getSite")})}}}),po={class:"block tip"},ho={class:"block tip"};function _o(e,t,o,d,$,u){const l=i("edit-text"),p=i("el-form-item"),f=i("el-form");return a(),y(f,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:h(()=>[n(p,{label:e.$t("site.field.distributionDefaultInviterId")},{default:h(()=>{var v,m;return[T(g((v=e.site.distribution)==null?void 0:v.default_inviter_id)+" ",1),n(l,{"model-value":(m=e.site.distribution)==null?void 0:m.default_inviter_id,title:e.$t("site.title.editDistributionDefaultInviterId"),placeholder:e.$t("site.placeholder.editDistributionDefaultInviterId"),onConfirm:t[0]||(t[0]=s=>e.onSave({distribution:{...e.site.distribution,default_inviter_id:s}}))},null,8,["model-value","title","placeholder"]),r("span",po,g(e.$t("site.message.distributionDefaultInviterIdTip")),1)]}),_:1},8,["label"]),n(p,{label:e.$t("site.field.distributionForceInviterId")},{default:h(()=>{var v,m;return[T(g((v=e.site.distribution)==null?void 0:v.force_inviter_id)+" ",1),n(l,{"model-value":(m=e.site.distribution)==null?void 0:m.force_inviter_id,title:e.$t("site.title.editDistributionForceInviterId"),placeholder:e.$t("site.placeholder.editDistributionForceInviterId"),onConfirm:t[1]||(t[1]=s=>e.onSave({distribution:{...e.site.distribution,force_inviter_id:s}}))},null,8,["model-value","title","placeholder"]),r("span",ho,g(e.$t("site.message.distributionForceInviterIdTip")),1)]}),_:1},8,["label"])]),_:1},8,["model"])}var go=I(mo,[["render",_o],["__scopeId","data-v-4ed92693"],["__file","/home/runner/work/Nexior/Nexior/src/components/setting/Distribution.vue"]]);const fo=N({name:"SiteIndex",components:{EditText:Y,EditImage:Se,ElImage:ie,ElForm:J,ElSwitch:et,ElFormItem:X},data(){return{editing:{title:!1}}},computed:{site(){return this.$store.getters.site}},methods:{onSave(e){var o;const t={...this.site,...e};Q.update((o=this.site)==null?void 0:o.id,t).then(()=>{var d;console.debug("getSite for id",(d=this.site)==null?void 0:d.id),this.$store.dispatch("getSite")})}}}),vo={class:"w-full"},$o={class:"block tip w-full"},yo={key:0},bo={class:"block w-full"},wo={class:"block w-full"};function ko(e,t,o,d,$,u){const l=i("el-switch"),p=i("el-form-item"),f=i("el-image"),v=i("edit-image"),m=i("edit-text"),s=i("el-form");return a(),y(s,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:h(()=>[(a(),_(G,null,F(["chat","midjourney","qrart","suno","luma","pika","kling","flux","hailuo","headshots","support"],(c,b)=>n(p,{key:b,label:e.$t("site.field.features"+c.charAt(0).toUpperCase()+c.slice(1))},{default:h(()=>{var w,k,q,A,E,V;return[r("div",vo,[n(l,{"model-value":((w=e.site.features[c])==null?void 0:w.enabled)||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":R=>e.onSave({features:{...e.site.features,[c]:{...e.site.features[c],enabled:R}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),r("span",$o,g(e.$t("site.message.features"+c.charAt(0).toUpperCase()+c.slice(1))),1),c==="support"?M((a(),_("div",yo,[n(p,{label:"WeChat"},{default:h(()=>{var R,D;return[n(l,{"model-value":((D=(R=e.site.features[c])==null?void 0:R.wechat)==null?void 0:D.enabled)||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":C=>{var O;return e.onSave({features:{...e.site.features,[c]:{...e.site.features[c],wechat:{...(O=e.site.features[c])==null?void 0:O.wechat,enabled:C}}}})}},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]}),_:2},1024),M(n(p,{label:e.$t("site.field.qr")},{default:h(()=>{var R,D,C,O;return[r("span",bo,[n(f,{src:(D=(R=e.site.features[c])==null?void 0:R.wechat)==null?void 0:D.qr},null,8,["src"]),n(v,{"model-value":(O=(C=e.site.features[c])==null?void 0:C.wechat)==null?void 0:O.qr,title:e.$t("site.title.editQR"),tip:e.$t("site.message.editQRTip"),onConfirm:Z=>{var W;return e.onSave({features:{...e.site.features,[c]:{...e.site.features[c],wechat:{...(W=e.site.features[c])==null?void 0:W.wechat,qr:Z}}}})}},null,8,["model-value","title","tip","onConfirm"])])]}),_:2},1032,["label"]),[[B,(q=(k=e.site.features[c])==null?void 0:k.wechat)==null?void 0:q.enabled]]),n(p,{label:"Discord"},{default:h(()=>{var R,D;return[n(l,{"model-value":((D=(R=e.site.features[c])==null?void 0:R.discord)==null?void 0:D.enabled)||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":C=>{var O;return e.onSave({features:{...e.site.features,[c]:{...e.site.features[c],discord:{...(O=e.site.features[c])==null?void 0:O.discord,enabled:C}}}})}},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]}),_:2},1024),M(n(p,{label:e.$t("site.field.url")},{default:h(()=>{var R,D,C,O;return[r("span",wo,[T(g((D=(R=e.site.features[c])==null?void 0:R.discord)==null?void 0:D.url)+" ",1),n(m,{"model-value":(O=(C=e.site.features[c])==null?void 0:C.discord)==null?void 0:O.url,title:e.$t("site.title.editUrl"),placeholder:e.$t("site.placeholder.editUrl"),onConfirm:Z=>{var W;return e.onSave({features:{...e.site.features,[c]:{...e.site.features[c],discord:{...(W=e.site.features[c])==null?void 0:W.discord,url:Z}}}})}},null,8,["model-value","title","placeholder","onConfirm"])])]}),_:2},1032,["label"]),[[B,(E=(A=e.site.features[c])==null?void 0:A.discord)==null?void 0:E.enabled]])],512)),[[B,(V=e.site.features[c])==null?void 0:V.enabled]]):S("v-if",!0)]}),_:2},1032,["label"])),64))]),_:1},8,["model"])}var Co=I(fo,[["render",ko],["__scopeId","data-v-7089d567"],["__file","/home/runner/work/Nexior/Nexior/src/components/setting/Function.vue"]]);const So=N({name:"UserSetting",components:{ElDialog:tt,FontAwesomeIcon:L,GeneralSetting:js,SiteSetting:oo,SeoSetting:uo,DistributionSetting:go,FunctionSetting:Co},props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],data(){return{activeTab:"general",showSuggestions:!0,navItems:[{key:"general",label:this.$t("common.settings.general"),icon:ze},{key:"site",label:this.$t("common.settings.site"),icon:Qe},{key:"seo",label:this.$t("common.settings.seo"),icon:Je},{key:"distribution",label:this.$t("common.settings.distribution"),icon:Xe},{key:"function",label:this.$t("common.settings.function"),icon:Ye}]}},computed:{currentTabTitle(){const e=this.navItems.find(t=>t.key===this.activeTab);return e?e.label:""},isSiteAdmin(){var e,t,o,d,$;return!!(($=(o=(t=(e=this.$store)==null?void 0:e.state)==null?void 0:t.site)==null?void 0:o.admins)!=null&&$.includes((d=this.$store.getters.user)==null?void 0:d.id))}},methods:{onClose(){this.$emit("update:visible",!1)}}}),Eo={class:"flex settings"},Io={class:"w-56 border-r"},No={class:"flex flex-col p-2 space-y-1"},To=["onClick"],Ro={class:"flex-1 p-6 overflow-y-auto"},Do={key:0},Ao={key:1},qo={key:2},Oo={key:3},Go={key:4};function Lo(e,t,o,d,$,u){const l=i("font-awesome-icon"),p=i("general-setting"),f=i("site-setting"),v=i("seo-setting"),m=i("distribution-setting"),s=i("function-setting"),c=i("el-dialog");return a(),y(c,{"model-value":e.visible,onClose:e.onClose},{default:h(()=>[r("div",Eo,[r("aside",Io,[r("nav",No,[(a(!0),_(G,null,F(e.navItems,(b,w)=>(a(),_("button",{key:w,class:P(["flex items-center px-4 py-2 text-sm rounded-lg cursor-pointer",e.activeTab===b.key?"active":""]),onClick:k=>e.activeTab=b.key},[n(l,{icon:b.icon,class:"mr-2"},null,8,["icon"]),T(" "+g(b.label),1)],10,To))),128))])]),r("main",Ro,[e.activeTab==="general"?(a(),_("div",Do,[n(p)])):e.activeTab==="site"&&e.isSiteAdmin?(a(),_("div",Ao,[n(f)])):e.activeTab==="seo"&&e.isSiteAdmin?(a(),_("div",qo,[n(v)])):e.activeTab==="distribution"&&e.isSiteAdmin?(a(),_("div",Oo,[n(m)])):e.activeTab==="function"&&e.isSiteAdmin?(a(),_("div",Go,[n(s)])):S("v-if",!0)])])]),_:1},8,["model-value","onClose"])}var Uo=I(So,[["render",Lo],["__scopeId","data-v-17be4dfc"],["__file","/home/runner/work/Nexior/Nexior/src/components/user/Setting.vue"]]);const Mo=N({name:"UserCenter",components:{UserAvatar:Ts,UserSetting:Uo,FontAwesomeIcon:L,ElDivider:we,ElCard:st},data(){return{showMenu:!1,showSetting:!1}},computed:{user(){var e;return(e=this.$store.getters)==null?void 0:e.user}},mounted(){document.addEventListener("click",this.closeMenu)},unmounted(){document.removeEventListener("click",this.closeMenu)},methods:{toggleMenu(){this.showMenu=!this.showMenu},closeMenu(e){const t=e.target;this.$el.contains(t)||(this.showMenu=!1)},async onLogout(){await this.$store.dispatch("logout")},onConsole(){this.$router.push({name:Ge})},onDistribution(){this.$router.push({name:Le})},onSettings(){this.showSetting=!0}}}),Fo={class:"relative inline-block text-left"},Vo={key:0,class:"px-4 py-2 text-sm font-medium"},Po={class:"py-1"};function Ho(e,t,o,d,$,u){const l=i("user-avatar"),p=i("el-divider"),f=i("font-awesome-icon"),v=i("el-card"),m=i("user-setting");return a(),_("div",Fo,[r("div",{onClick:t[0]||(t[0]=(...s)=>e.toggleMenu&&e.toggleMenu(...s))},[n(l,{class:"cursor-pointer"})]),n(je,{name:"fade"},{default:h(()=>[e.showMenu?(a(),y(v,{key:0,class:"absolute right-0 mt-2 min-w-[220px] z-50 p-0"},{default:h(()=>{var s;return[e.user.email?(a(),_("div",Vo,g((s=e.user)==null?void 0:s.email),1)):S("v-if",!0),e.user.email?(a(),y(p,{key:1,class:"mb-1 mt-1"})):S("v-if",!0),r("div",Po,[r("button",{class:"block w-full px-4 py-2 text-left text-sm rounded-lg",onClick:t[1]||(t[1]=(...c)=>e.onSettings&&e.onSettings(...c))},[n(f,{icon:"fa-solid fa-cog",class:"mr-1"}),T(" "+g(e.$t("common.nav.setting")),1)]),r("button",{class:"block w-full px-4 py-2 text-left text-sm rounded-lg",onClick:t[2]||(t[2]=(...c)=>e.onDistribution&&e.onDistribution(...c))},[n(f,{icon:"fa-solid fa-coins",class:"mr-1"}),T(" "+g(e.$t("common.nav.distribution")),1)]),r("button",{class:"block w-full px-4 py-2 text-left text-sm rounded-lg",onClick:t[3]||(t[3]=(...c)=>e.onConsole&&e.onConsole(...c))},[n(f,{icon:"fa-solid fa-compass",class:"mr-1"}),T(" "+g(e.$t("common.nav.console")),1)]),r("button",{class:"block w-full px-4 py-2 text-left text-sm rounded-lg",onClick:t[4]||(t[4]=(...c)=>e.onLogout&&e.onLogout(...c))},[n(f,{icon:"fa-solid fa-arrow-right-from-bracket",class:"mr-1"}),T(" "+g(e.$t("common.nav.logOut")),1)])])]}),_:1})):S("v-if",!0)]),_:1}),n(m,{visible:e.showSetting,"onUpdate:visible":t[5]||(t[5]=s=>e.showSetting=s)},null,8,["visible"])])}var Bo=I(Mo,[["render",Ho],["__scopeId","data-v-4e7424d9"],["__file","/home/runner/work/Nexior/Nexior/src/components/user/Center.vue"]]);const jo=N({name:"SidePanel",components:{ElInput:$e,FontAwesomeIcon:L,ElSkeleton:ot},props:{},emits:["change-conversation"],computed:{conversationId(){var e,t,o;return console.debug("conversationId in side",(e=this.$route.params)==null?void 0:e.id),(o=(t=this.$route.params)==null?void 0:t.id)==null?void 0:o.toString()},conversationGroups(){var l,p,f,v,m,s,c,b;const e=this.$store.state.chat.conversations,t=new Date;t.setHours(0,0,0,0);const o=new Date(t);o.setDate(o.getDate()-1);const d=new Date(t);d.setDate(d.getDate()-t.getDay());const $=new Date(d);$.setDate($.getDate()-7);const u=e==null?void 0:e.reduce((w,k)=>{const q=new Date(k.updated_at*1e3);return q>=t?w.today.push(k):q>=o?w.yesterday.push(k):q>=d?w.thisWeek.push(k):w.earlier.push(k),w},{today:[],yesterday:[],thisWeek:[],earlier:[]});return{...((l=u==null?void 0:u.today)==null?void 0:l.length)>0?{today:(p=u==null?void 0:u.today)==null?void 0:p.sort((w,k)=>k.updated_at-w.updated_at)}:{},...((f=u==null?void 0:u.yesterday)==null?void 0:f.length)>0?{yesterday:(v=u==null?void 0:u.yesterday)==null?void 0:v.sort((w,k)=>k.updated_at-w.updated_at)}:{},...((m=u==null?void 0:u.thisWeek)==null?void 0:m.length)>0?{thisWeek:(s=u==null?void 0:u.thisWeek)==null?void 0:s.sort((w,k)=>k.updated_at-w.updated_at)}:{},...((c=u==null?void 0:u.earlier)==null?void 0:c.length)>0?{earlier:(b=u==null?void 0:u.earlier)==null?void 0:b.sort((w,k)=>k.updated_at-w.updated_at)}:{}}},application(){return this.$store.state.chat.application},loading(){return this.$store.state.chat.status.getConversations===te.Request},token(){var e,t;return(t=(e=this.$store.state.chat)==null?void 0:e.credential)==null?void 0:t.token}},methods:{async onNewConversation(){console.debug("onNewConversation from side panel"),this.$emit("change-conversation",void 0)},async onConfirm(e){const t=this.token;if(!t){console.error("Token is not found");return}(e==null?void 0:e.deleting)&&e.id?(await K.deleteConversation(e.id,{token:t}),await this.$store.dispatch("chat/getConversations")):e!=null&&e.editing?(await K.updateConversation(e,{token:t}),await this.$store.dispatch("chat/getConversations")):e.editing=!0},onClickConversation(e){console.debug("onClickConversation in side panel",e),this.$emit("change-conversation",e)}}}),Wo={class:"panel"},Ko={key:1,class:"conversations"},zo={class:"icons"},Qo={class:"title"},Jo={class:"key"},Xo=["onClick"],Yo={class:"title"},Zo={key:0},xo={key:1},en={key:2},tn={class:"operations"};function sn(e,t,o,d,$,u){const l=i("el-skeleton"),p=i("font-awesome-icon"),f=i("el-input");return a(),_("div",Wo,[e.loading&&e.conversationGroups===void 0?(a(),y(l,{key:0})):(a(),_("div",Ko,[r("div",{class:"conversation",onClick:t[0]||(t[0]=(...v)=>e.onNewConversation&&e.onNewConversation(...v))},[r("div",zo,[n(p,{icon:"fa-solid fa-plus",class:"icon"})]),r("div",Qo,g(e.$t("chat.message.startNewChat")),1)]),(a(!0),_(G,null,F(e.conversationGroups,(v,m)=>(a(),_("div",{key:m,class:"group"},[r("div",Jo,g(e.$t(`chat.group.${m}`)),1),(a(!0),_(G,null,F(v,(s,c)=>{var b,w,k,q;return a(),_("div",{key:c,class:P({conversation:!0,active:s.id===e.conversationId}),onClick:A=>e.onClickConversation(s.id)},[r("div",Yo,[s!=null&&s.deleting?(a(),_("span",Zo,g(`${e.$t("chat.message.confirmDelete")}?`),1)):s!=null&&s.editing?(a(),_("span",xo,[n(f,{modelValue:s.title,"onUpdate:modelValue":A=>s.title=A,onKeydown:oe(A=>e.onConfirm(s),["enter"])},null,8,["modelValue","onUpdate:modelValue","onKeydown"])])):(s==null?void 0:s.title)||(s==null?void 0:s.messages)?(a(),_("span",en,g((s==null?void 0:s.title)||((w=(b=s==null?void 0:s.messages)==null?void 0:b[(s==null?void 0:s.messages.length)-1])==null?void 0:w.content)||((q=(k=s==null?void 0:s.messages)==null?void 0:k[0])==null?void 0:q.content)),1)):S("v-if",!0)]),r("div",tn,[!(s!=null&&s.editing)&&!s.deleting?(a(),y(p,{key:0,icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:H(A=>s.editing=!0,["stop"])},null,8,["onClick"])):S("v-if",!0),!(s!=null&&s.editing)&&!s.deleting?(a(),y(p,{key:1,icon:"fa-solid fa-trash",class:"icon icon-delete",onClick:H(A=>s.deleting=!0,["stop"])},null,8,["onClick"])):S("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(a(),y(p,{key:2,icon:"fa-solid fa-check",class:"icon icon-confirm",onClick:H(A=>e.onConfirm(s),["stop"])},null,8,["onClick"])):S("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(a(),y(p,{key:3,icon:"fa-solid fa-xmark",class:"icon icon-cancel",onClick:H(A=>{s.editing=!1,s.deleting=!1},["stop"])},null,8,["onClick"])):S("v-if",!0)])],10,Xo)}),128))]))),128))]))])}var on=I(jo,[["render",sn],["__scopeId","data-v-d866c834"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/SidePanel.vue"]]);const nn=N({name:"LayoutChat",components:{SidePanel:on,ElDrawer:nt,UserCenter:Bo,ElButton:ve,FontAwesomeIcon:L},emits:["change-conversation"],data(){return{drawer:!1}},methods:{onChangeConversation(e){console.debug("onChangeConversation in layout",e),this.$emit("change-conversation",e)}}}),an={class:"main"},rn={class:"side"},ln={class:"chat"};function dn(e,t,o,d,$,u){const l=i("side-panel"),p=i("user-center"),f=i("font-awesome-icon"),v=i("el-button"),m=i("el-drawer");return a(),_("div",an,[r("div",rn,[me(e.$slots,"side",{},()=>[n(l,{onChangeConversation:e.onChangeConversation},null,8,["onChangeConversation"])],!0)]),r("div",ln,[me(e.$slots,"chat",{},void 0,!0)]),n(p,{class:"absolute right-2 top-2"}),n(v,{round:"",class:"menu",onClick:t[0]||(t[0]=s=>e.drawer=!0)},{default:h(()=>[n(f,{icon:"fa-solid fa-bars",class:"icon-menu"})]),_:1}),n(m,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=s=>e.drawer=s),"with-header":!1,size:"290px",class:"drawer"},{default:h(()=>[n(l)]),_:1},8,["modelValue"])])}var cn=I(nn,[["render",dn],["__scopeId","data-v-8d7a06d2"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Chat.vue"]]);const un=N({name:"ChatConversation",components:{Composer:xt,Disclaimer:Ss,ModelSelector:bs,Message:Pt,Layout:cn},data(){var e,t;return{drawer:!1,question:"",references:[],upload:!1,answering:!1,canceler:void 0,messages:((t=(e=this.$store.state.chat.conversations)==null?void 0:e.find(o=>{var d;return o.id===((d=this.$route.params.id)==null?void 0:d.toString())}))==null?void 0:t.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(t=>t.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===te.Success&&!this.application},conversations(){return this.$store.state.chat.conversations},initializing(){return this.$store.state.chat.status.getApplications===te.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 p,f,v,m,s,c,b,w,k,q,A,E,V,R,D;const t=this.messages.findIndex(C=>C===e),o=this.messages[t-1];let d=[];if(t!==-1){if(d=this.messages.slice(0,t-1),this.messages=this.messages.slice(0,t),this.references=[],typeof o.content=="string")this.question=o.content;else if(Array.isArray(o.content))for(let C=0;C<(o==null?void 0:o.content.length);C++)o.content[C].type==="image_url"&&(typeof((f=(p=o==null?void 0:o.content)==null?void 0:p[C])==null?void 0:f.image_url)=="string"?this.references.push((m=(v=o==null?void 0:o.content)==null?void 0:v[C])==null?void 0:m.image_url):this.references.push((b=(c=(s=o==null?void 0:o.content)==null?void 0:s[C])==null?void 0:c.image_url)==null?void 0:b.url)),o.content[C].type==="file_url"&&(typeof((k=(w=o==null?void 0:o.content)==null?void 0:w[C])==null?void 0:k.file_url)=="string"?this.references.push((A=(q=o==null?void 0:o.content)==null?void 0:q[C])==null?void 0:A.file_url):this.references.push((R=(V=(E=o==null?void 0:o.content)==null?void 0:E[C])==null?void 0:V.file_url)==null?void 0:R.url)),o.content[C].type==="text"&&(this.question=o.content[C].text)}console.debug("onRestart!",this.question,JSON.stringify(this.references));const $=(D=this.credential)==null?void 0:D.token,u=this.question;if(!$||!u){console.error("no token or endpoint or question"),this.messages.push({error:{code:z},role:j,state:U.FAILED});return}let l=this.conversationId;K.updateConversation({id:this.conversationId,messages:d},{token:$}).then(async()=>{await this.$store.dispatch("chat/setConversation",{id:l,messages:this.messages}),console.debug("finished update conversation",this.messages),console.debug("onRestart",this.question),await this.onRequest()}).catch(C=>{this.handleRequestError(C)})},async onEdit(e,t){var u;const o=this.messages.findIndex(l=>l===e);o!==-1&&(this.messages=this.messages.slice(0,o)),this.question=t;const d=(u=this.credential)==null?void 0:u.token;if(!d){console.error("no token or endpoint or question"),this.messages.push({error:{code:z},role:j,state:U.FAILED});return}let $=this.conversationId;K.updateConversation({id:this.conversationId,messages:this.messages},{token:d}).then(async()=>{await this.$store.dispatch("chat/setConversation",{id:$,messages:this.messages}),console.debug("finished update conversation",this.messages),this.messages.push({content:this.question,role:ee}),console.debug("onEdit",this.question),await this.onRequest()}).catch(l=>{this.handleRequestError(l)})},async onNewConversation(){this.$router.push({name:Ue}),this.messages=[],this.question="",this.references=[]},async onRestoreConversation(e){var u;this.$router.push({name:ue,params:{id:e}});const t=(u=this.conversations)==null?void 0:u.find(l=>l.id===e),o=t==null?void 0:t.model;console.debug("conversation model",o);const d=Me.find(l=>l.name===o);console.debug("target model",d);const $=Fe.find(l=>l.name===(d==null?void 0:d.modelGroup));console.debug("target model group",$),this.$store.dispatch("chat/setModelGroup",$),this.$store.dispatch("chat/setModel",d),this.messages=(t==null?void 0:t.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 t=0;t<this.references.length;t++)se(this.references[t])?e.push({type:"image_url",image_url:this.references[t]}):e.push({type:"file_url",file_url:this.references[t]});this.messages.push({content:e,role:ee})}else this.messages.push({content:this.question,role:ee});console.debug("onSubmit",this.question,this.references),await this.onRequest()},async onRequest(){var $;console.debug("start to get answer",this.messages);const e=($=this.credential)==null?void 0:$.token,t=this.question,o=this.references;if(console.debug("validated",t,o),this.question="",this.references=[],!e||!t){console.error("no token or endpoint or question"),this.messages.push({error:{code:z},role:j,state:U.FAILED});return}let d=this.conversationId;this.messages.push({content:"",role:j,state:U.PENDING}),console.debug("start to get answer",this.messages),this.onScrollDown(),this.answering=!0,this.canceler=new AbortController,K.chatConversation({question:t,model:this.model.name,references:o,id:this.conversationId,stateful:!0},{token:e,stream:u=>{console.debug("stream response",u);const l=this.messages[this.messages.length-1];this.messages[this.messages.length-1]={role:j,content:u.answer,state:(l==null?void 0:l.state)!==U.FINISHED?U.ANSWERING:l==null?void 0:l.state},d=u==null?void 0:u.id},signal:this.canceler.signal}).then(async()=>{console.debug("finished fetch answer",this.messages),this.messages[this.messages.length-1].state=U.FINISHED,console.debug("finished fetch answer",JSON.stringify(this.messages)),await this.$store.dispatch("chat/setConversation",{id:d,messages:this.messages}),this.answering=!1,d&&await this.$router.push({name:ue,params:{id:d}}),this.onScrollDown(),await this.$store.dispatch("chat/getConversations"),await this.$store.dispatch("chat/getApplications")}).catch(u=>{this.handleRequestError(u)})},async handleRequestError(e){var t,o;if(this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].state=U.FAILED),e.name==="AbortError"){console.error("aborted");return}if(console.error(e),Ne.isCancel(e))this.messages[this.messages.length-1].error={code:Ce};else if((t=e==null?void 0:e.response)!=null&&t.data){let d=(o=e==null?void 0:e.response)==null?void 0:o.data;Ve(d)&&(d=JSON.parse(d)),console.debug("error",d),this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error=d.error)}else this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error={code:ke});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)}}}),mn={key:0,class:"messages"},pn={class:"composer"};function hn(e,t,o,d,$,u){const l=i("model-selector"),p=i("message"),f=i("composer"),v=i("disclaimer"),m=i("layout");return a(),y(m,{onChangeConversation:t[4]||(t[4]=s=>e.onChangeConversation(s))},{chat:h(()=>[n(l,{class:"selector",onModelGroupChanged:t[0]||(t[0]=s=>e.onChangeConversation(void 0))}),r("div",{class:P({dialogue:!0,empty:e.messages.length===0})},[e.messages.length>0?(a(),_("div",mn,[(a(!0),_(G,null,F(e.messages,(s,c)=>(a(),y(p,{key:c,message:s,messages:e.messages,question:e.question,application:e.application,class:"message","onUpdate:question":t[1]||(t[1]=b=>e.question=b),onEdit:e.onEdit,onRestart:e.onRestart},null,8,["message","messages","question","application","onEdit","onRestart"]))),128))])):S("v-if",!0),r("div",pn,[n(f,{question:e.question,"onUpdate:question":t[2]||(t[2]=s=>e.question=s),disabled:e.answering,references:e.references,"onUpdate:references":t[3]||(t[3]=s=>e.references=s),onSubmit:e.onSubmit,onStop:e.onStop},null,8,["question","disabled","references","onSubmit","onStop"]),n(v,{class:"disclaimer"})])],2)]),_:1})}var Tn=I(un,[["render",hn],["__scopeId","data-v-3ab2fb26"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chat/Conversation.vue"]]);export{Tn as default};
@@ -1 +0,0 @@
1
- import{ad as L}from"./vendor-others.2105a885.js";import{L as F}from"./Chatdoc.6a3f9b4e.js";import{ad as P,ae as b,af as A,_ as I,M as N,U as v,W as z,Z as G}from"./index.42fb7c30.js";import{a as H}from"./vendor-axios.168e6950.js";import{E as T,b as q,c as K,d as W,e as J,f as Q,g as j,h as O,a as Y}from"./errorCode.310759b7.js";import{ar as D}from"./vendor-fortawesome.fe21f86d.js";import{N as V,y as Z,B as X,l as x}from"./vendor-element-plus.6158e0fe.js";import{H as E,al as l,o,e as c,L as h,f as i,V as m,T as k,U as R,ai as M,P as S,as as U,R as f,$ as w,M as B,S as ee}from"./vendor-@vue.66ea933c.js";import{M as se}from"./MarkdownRenderer.94bcb2ef.js";import{C as te}from"./CopyToClipboard.c63a2368.js";import{A as oe}from"./Status.c273ddde.js";import"./vendor-qrcode.46bc4fb1.js";import"./vendor-markdown.b22db477.js";import"./vendor-highlight.js.6ee9ffbc.js";var $=(e=>(e.PENDING="pending",e.ANSWERING="answering",e.FINISHED="finished",e.FAILED="failed",e))($||{});const ie=E({name:"SidePanel",components:{ElInput:V,FontAwesomeIcon:D,ElSkeleton:Z},props:{},emits:["click"],computed:{repositoryId(){var e,t;return(t=(e=this.$route.params)==null?void 0:e.repositoryId)==null?void 0:t.toString()},conversationId(){var e,t;return(t=(e=this.$route.params)==null?void 0:e.conversationId)==null?void 0:t.toString()},repository(){var e,t,n;return(n=(t=(e=this.$store.state)==null?void 0:e.chatdoc)==null?void 0:t.repositories)==null?void 0:n.find(d=>d.id===this.repositoryId)},conversations(){var e;return(e=this.repository)==null?void 0:e.conversations},application(){return this.$store.state.chatdoc.application}},methods:{async onNewConversation(){this.$router.push({name:P,params:{repositoryId:this.repositoryId}})},async onConfirm(e){e!=null&&e.deleting?(await b.deleteConversation(e.id),await this.$store.dispatch("chat/getConversations")):e!=null&&e.editing?(await b.updateConversation(e),await this.$store.dispatch("chat/getConversations")):e.editing=!0},onClick(e){!e||(this.$router.push({name:A,params:{repositoryId:this.repositoryId,conversationId:e}}),this.$emit("click",e))}}}),ne={class:"panel"},ae={key:1,class:"conversations"},re={class:"icons"},le={class:"title"},de=["onClick"],ce={class:"icons"},ue={class:"title"},pe={key:0},he={key:1},me={key:2},_e={class:"operations"};function ge(e,t,n,d,r,y){const u=l("el-skeleton"),a=l("font-awesome-icon"),_=l("el-input");return o(),c("div",ne,[e.conversations===void 0?(o(),h(u,{key:0})):(o(),c("div",ae,[i("div",{class:"conversation",onClick:t[0]||(t[0]=(...s)=>e.onNewConversation&&e.onNewConversation(...s))},[i("div",re,[m(a,{icon:"fa-solid fa-plus",class:"icon"})]),i("div",le,k(e.$t("chatdoc.message.startNewChat")),1)]),(o(!0),c(R,null,M(e.conversations,(s,C)=>{var p;return o(),c("div",{key:C,class:S({conversation:!0,active:s.id===e.conversationId}),onClick:g=>e.onClick(s.id)},[i("div",ce,[m(a,{icon:"fa-regular fa-comment",class:"icon"})]),i("div",ue,[s!=null&&s.deleting?(o(),c("span",pe,k(`${e.$t("chatdoc.message.confirmDelete")}?`),1)):s!=null&&s.editing?(o(),c("span",he,[m(_,{modelValue:s.title,"onUpdate:modelValue":g=>s.title=g,onKeydown:U(g=>e.onConfirm(s),["enter"])},null,8,["modelValue","onUpdate:modelValue","onKeydown"])])):(s==null?void 0:s.title)||(s==null?void 0:s.messages)?(o(),c("span",me,k((s==null?void 0:s.title)||((p=s==null?void 0:s.messages[(s==null?void 0:s.messages.length)-1])==null?void 0:p.content)),1)):f("v-if",!0)]),i("div",_e,[!(s!=null&&s.editing)&&!s.deleting?(o(),h(a,{key:0,icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:w(g=>s.editing=!0,["stop"])},null,8,["onClick"])):f("v-if",!0),!(s!=null&&s.editing)&&!s.deleting?(o(),h(a,{key:1,icon:"fa-solid fa-trash",class:"icon icon-delete",onClick:w(g=>s.deleting=!0,["stop"])},null,8,["onClick"])):f("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(o(),h(a,{key:2,icon:"fa-solid fa-check",class:"icon icon-confirm",onClick:w(g=>e.onConfirm(s),["stop"])},null,8,["onClick"])):f("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(o(),h(a,{key:3,icon:"fa-solid fa-xmark",class:"icon icon-cancel",onClick:w(g=>{s.editing=!1,s.deleting=!1},["stop"])},null,8,["onClick"])):f("v-if",!0)])],10,de)}),128))]))])}var fe=I(ie,[["render",ge],["__scopeId","data-v-2282a6e1"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/Conversations.vue"]]);const ye=E({name:"AnsweringMark",data(){return{}},computed:{conversationId(){var e,t;return(t=(e=this.$route.params)==null?void 0:e.conversationId)==null?void 0:t.toString()}}}),$e={class:"mark"};function Ce(e,t,n,d,r,y){return o(),c("div",$e)}var we=I(ye,[["render",Ce],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/AnsweringMark.vue"]]);const ke=E({name:"Message",components:{CopyToClipboard:te,AnsweringMark:we,MarkdownRenderer:se,ElAlert:X,ElButton:x},props:{message:{type:Object,required:!0}},emits:["stop"],data(){return{copied:!1,messageState:$}},computed:{errorText(){var e,t;if(!(!this.message.error||!((e=this.message.error)!=null&&e.code)))switch((t=this.message.error)==null?void 0:t.code){case O:return this.$t("chatdoc.message.errorUsedUp");case j:return this.$t("chatdoc.message.errorApiError");case Q:return this.$t("chatdoc.message.errorBadRequest");case J:return this.$t("chatdoc.message.errorTimeout");case W:return this.$t("chatdoc.message.errorTooManyRequests");case K:return this.$t("chatdoc.message.errorContentTooLarge");case q:return this.$t("chatdoc.message.errorNotApplied");case T:default:return this.$t("chatdoc.message.errorUnknown")}},showBuyMore(){var e;return this.message.role===N&&((e=this.message.error)==null?void 0:e.code)===O}},methods:{onCopy(){L(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){}}}),Ie=["role"],Ee={class:"content"},Ne={class:"operations"};function Re(e,t,n,d,r,y){var p;const u=l("markdown-renderer"),a=l("answering-mark"),_=l("copy-to-clipboard"),s=l("el-alert"),C=l("el-button");return o(),c(R,null,[i("div",{class:S({message:!0,[e.message.role]:!0,hidden:e.errorText&&e.message.role==="assistant"}),role:e.message.role},[i("div",Ee,[m(u,{content:(p=e.message)==null?void 0:p.content},null,8,["content"]),e.message.state===e.messageState.PENDING?(o(),h(a,{key:0})):f("v-if",!0)]),i("div",Ne,[m(_,{content:e.message.content,class:"btn-copy"},null,8,["content"])])],10,Ie),e.errorText?(o(),h(s,{key:0,class:"error",title:e.errorText,type:"error",closable:!1},null,8,["title"])):f("v-if",!0),e.showBuyMore?(o(),h(C,{key:1,round:"",type:"primary",class:"btn btn-buy",size:"small",onClick:e.onBuyMore},{default:B(()=>[ee(k(e.$t("common.button.buyMore")),1)]),_:1},8,["onClick"])):f("v-if",!0)],64)}var be=I(ke,[["render",Re],["__scopeId","data-v-95a62450"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/Message.vue"]]);const Se=E({name:"InputBox",components:{ElInput:V,FontAwesomeIcon:D},props:{disabled:{type:Boolean,required:!1,default:!1},question:{type:String,required:!0}},emits:["update:question","submit"],data(){return{questionValue:this.question,fileList:[]}},computed:{model(){return this.$store.state.chat.model}},watch:{questionValue(e){this.$emit("update:question",e)},question(e){e!==this.questionValue&&(this.questionValue=e)},references(e){e.length===0&&(this.fileList=[])}},methods:{onSubmit(){!this.question||this.$emit("submit")}}}),ve={class:"input-box"},Oe={class:"info"};function Ae(e,t,n,d,r,y){const u=l("font-awesome-icon"),a=l("el-input");return o(),c(R,null,[i("div",ve,[i("span",{class:S({btn:!0,"btn-send":!0,disabled:!e.question}),onClick:t[0]||(t[0]=(..._)=>e.onSubmit&&e.onSubmit(..._))},[m(u,{icon:"fa-solid fa-location-arrow",class:"icon icon-send"})],2),m(a,{modelValue:e.questionValue,"onUpdate:modelValue":t[1]||(t[1]=_=>e.questionValue=_),disabled:e.disabled,class:"input",type:"textarea",placeholder:e.$t("chat.message.newMessagePlaceholder"),onKeydown:U(w(e.onSubmit,["exact","prevent"]),["enter"])},null,8,["modelValue","disabled","placeholder","onKeydown"])]),i("p",Oe,k(e.$t("chat.message.howToUse")),1)],64)}var Te=I(Se,[["render",Ae],["__scopeId","data-v-7ed35c20"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/InputBox.vue"]]);const qe=E({name:"ChatdocConversation",components:{Layout:F,Conversations:fe,Message:be,InputBox:Te,ApplicationStatus:oe},data(){return{loading:!1,repositoryId:this.$route.params.repositoryId.toString(),answering:!1,question:""}},computed:{messages:{get(){var e,t;return((t=(e=this.conversations)==null?void 0:e.find(n=>{var d;return n.id===((d=this.$route.params.conversationId)==null?void 0:d.toString())}))==null?void 0:t.messages)||[]},set(e){console.debug("set messages",e)}},repository(){var e,t,n;return(n=(t=(e=this.$store.state)==null?void 0:e.chatdoc)==null?void 0:t.repositories)==null?void 0:n.find(d=>d.id===this.repositoryId)},conversations(){var e;return(e=this.repository)==null?void 0:e.conversations},conversationId(){var e;return(e=this.$route.params.conversationId)==null?void 0:e.toString()},application(){return this.$store.state.chatdoc.application},credential(){return this.$store.state.chatdoc.credential},needApply(){return this.$store.state.chatdoc.status.getApplications===v.Success&&!this.application},initializing(){return this.$store.state.chatdoc.status.getApplications===v.Request},service(){return this.$store.state.chatdoc.service}},async mounted(){console.debug("start get conversations"),this.loading=!0,this.$store.dispatch("chatdoc/getConversations",{repositoryId:this.repositoryId}).finally(()=>{this.loading=!1})},methods:{async onSubmit(){this.messages.push({content:this.question,role:z}),await this.onFetchAnswer()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".dialogue");!e||!this.messages||this.messages.length===0||(e.scrollTop=e==null?void 0:e.scrollHeight)},0)},async onFetchAnswer(){var d;const e=(d=this.credential)==null?void 0:d.token,t=this.question;if(console.debug(this.onFetchAnswer,"validated",t),this.question="",!e||!t){console.error("no token or endpoint or question"),this.messages.push({error:{code:q},role:N,state:$.FAILED});return}let n=this.conversationId;this.messages.push({content:"",role:N,state:$.PENDING}),console.debug("start to get answer",this.messages),this.onScrollDown(),this.answering=!0,b.chatConversation({repositoryId:this.repositoryId,question:t,id:this.conversationId},{token:e,stream:r=>{this.messages[this.messages.length-1]={role:N,content:r.answer,state:$.ANSWERING},n=r.id,this.onScrollDown()}}).then(async()=>{console.debug("finished fetch answer"),this.messages[this.messages.length-1].state=$.FINISHED,await this.$store.dispatch("chatdoc/setConversation",{id:n,messages:this.messages,repositoryId:this.repositoryId}),this.answering=!1,this.conversationId||(console.debug("push to conversation",n),await this.$router.push({name:A,params:{conversationId:n,repositoryId:this.repositoryId}})),this.onScrollDown(),await this.$store.dispatch("chatdoc/getConversations",{repositoryId:this.repositoryId})}).catch(r=>{var y,u;if(this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].state=$.FAILED),console.error(r),H.isCancel(r))this.messages[this.messages.length-1].error={code:Y};else if((y=r==null?void 0:r.response)!=null&&y.data){let a=(u=r==null?void 0:r.response)==null?void 0:u.data;G(a)&&(a=JSON.parse(a)),this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error=a.error)}else this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error={code:T});this.answering=!1})}}}),De={class:"wrapper"},Ve={class:"chat"},Me={class:"status"},Ue={class:"dialogue"},Be={class:"messages"},Le={class:"bottom"};function Fe(e,t,n,d,r,y){const u=l("conversations"),a=l("application-status"),_=l("message"),s=l("input-box"),C=l("layout");return o(),h(C,null,{chatdoc:B(()=>[i("div",De,[m(u,{class:"side"}),i("div",Ve,[i("div",Me,[m(a,{"show-price":!1,initializing:e.initializing,application:e.application,"need-apply":e.needApply,service:e.service,onRefresh:t[0]||(t[0]=p=>e.$store.dispatch("chatdoc/getApplications"))},null,8,["initializing","application","need-apply","service"])]),i("div",Ue,[i("div",Be,[(o(!0),c(R,null,M(e.messages,(p,g)=>(o(),h(_,{key:g,message:p,class:"message"},null,8,["message"]))),128))])]),i("div",Le,[m(s,{disabled:e.answering,question:e.question,"onUpdate:question":t[1]||(t[1]=p=>e.question=p),onSubmit:e.onSubmit},null,8,["disabled","question","onSubmit"])])])])]),_:1})}var ss=I(qe,[["render",Fe],["__scopeId","data-v-24089614"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chatdoc/Conversation.vue"]]);export{ss as default};
@@ -1 +0,0 @@
1
- import{ae as ve}from"./vendor-others.2105a885.js";import{ar as J}from"./vendor-fortawesome.fe21f86d.js";import{V as ge}from"./VideoNavigator.d4612b51.js";import{_ as k,av as $e,aw as ye,ax as be,N as K,U as q,F as ke,ay as we}from"./index.42fb7c30.js";import{S as Ie,l as R,R as Y,O as Q,J as y,N as Ve,s as Se,B as Ee,t as Ue,y as Ce,Y as Le}from"./vendor-element-plus.6158e0fe.js";import{H as w,al as n,o as r,e as p,f as i,V as s,I as H,M as m,T as l,S as $,L as N,R as v,P as B,U as fe,ai as he}from"./vendor-@vue.66ea933c.js";import{I as T}from"./InfoIcon.cde68aa8.js";import{i as Ne,h as Pe}from"./errorCode.310759b7.js";import{A as Ae}from"./Status.c273ddde.js";import{C as Te}from"./CopyToClipboard.c63a2368.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.46bc4fb1.js";const Re=w({name:"LayoutLuma",components:{ElDrawer:Ie,ElButton:R,FontAwesomeIcon:J,VideoNavigator:ge},data(){return{drawer:!1}}}),Ge={class:"main"},De={class:"config"},ze={class:"result"};function Oe(e,t,o,a,h,g){const c=n("video-navigator"),u=n("font-awesome-icon"),d=n("el-button"),_=n("el-drawer");return r(),p("div",Ge,[i("div",De,[s(c),H(e.$slots,"config",{},void 0,!0)]),i("div",ze,[H(e.$slots,"result",{},void 0,!0)]),s(d,{round:"",class:"menu",onClick:t[0]||(t[0]=f=>e.drawer=!0)},{default:m(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=f=>e.drawer=f),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[H(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Me=k(Re,[["render",Oe],["__scopeId","data-v-234cfb9c"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Luma.vue"]]);const Fe=w({name:"EnhancementSelector",components:{ElSwitch:Y,InfoIcon:T},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=$e)}}),je={class:"field"},Be={class:"title font-bold"};function qe(e,t,o,a,h,g){const c=n("el-switch"),u=n("info-icon");return r(),p("div",je,[i("h2",Be,l(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 He=k(Fe,[["render",qe],["__scopeId","data-v-175365a0"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/EnhancementSelector.vue"]]);const Je=w({name:"CustomSelector",components:{ElSwitch:Y,InfoIcon:T},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=ye)}}),Ke={class:"field"},Ye={class:"title font-bold"};function Qe(e,t,o,a,h,g){const c=n("el-switch"),u=n("info-icon");return r(),p("div",Ke,[i("h2",Ye,l(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 We=k(Je,[["render",Qe],["__scopeId","data-v-5ac2addb"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/CustomSelector.vue"]]);const Xe=w({name:"LoopSelector",components:{ElSwitch:Y,InfoIcon:T},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=be)}}),Ze={class:"field"},xe={class:"title font-bold"};function et(e,t,o,a,h,g){const c=n("el-switch"),u=n("info-icon");return r(),p("div",Ze,[i("h2",xe,l(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 tt=k(Xe,[["render",et],["__scopeId","data-v-69cccd4e"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/LoopSelector.vue"]]);const ot=w({name:"ContentInput",components:{ElUpload:Q,ElButton:R,InfoIcon:T},data(){return{fileList:[],uploadUrl:K()+"/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()}}}),st={class:"field"},nt={class:"title font-bold"},at={class:"upload-wrapper"};function it(e,t,o,a,h,g){const c=n("el-button"),u=n("el-upload"),d=n("info-icon");return r(),p("div",st,[i("h2",nt,l(e.$t("luma.name.endImageUrl")),1),i("div",at,[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(()=>[$(l(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 lt=k(ot,[["render",it],["__scopeId","data-v-97900bb4"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/EndImageUrlInput.vue"]]);const rt=w({name:"StartImageUrlInput",components:{ElUpload:Q,ElButton:R,InfoIcon:T},data(){return{fileList:[],uploadUrl:K()+"/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()}}}),ct={class:"field"},ut={class:"title font-bold"},dt={class:"upload-wrapper"};function mt(e,t,o,a,h,g){const c=n("el-button"),u=n("el-upload"),d=n("info-icon");return r(),p("div",ct,[i("h2",ut,l(e.$t("luma.name.startImageUrl")),1),i("div",dt,[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(()=>[$(l(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 pt=k(rt,[["render",mt],["__scopeId","data-v-5440a4bf"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/StartImageUrlInput.vue"]]);const _t=w({name:"UploadVideo",components:{ElUpload:Q,ElButton:R,InfoIcon:T},data(){return{fileList:[],uploadUrl:K()+"/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()}}}),ft={class:"field"},ht={class:"title font-bold"},vt={class:"upload-wrapper"};function gt(e,t,o,a,h,g){const c=n("el-button"),u=n("el-upload"),d=n("info-icon");return r(),p("div",ft,[i("h2",ht,l(e.$t("luma.name.videoUrl")),1),i("div",vt,[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(()=>[$(l(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 $t=k(_t,[["render",gt],["__scopeId","data-v-46c66c9f"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/UploadVideo.vue"]]);const yt="",bt=w({name:"PromptInput",components:{ElInput:Ve,InfoIcon:T},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=yt)}}),kt={class:"field"},wt={class:"box"},It={class:"title font-bold"};function Vt(e,t,o,a,h,g){const c=n("info-icon"),u=n("el-input");return r(),p("div",kt,[i("div",wt,[i("h2",It,l(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 St=k(bt,[["render",Vt],["__scopeId","data-v-19a7446b"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/PromptInput.vue"]]);const Et=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}}}),Ut={class:"field"},Ct={class:"box"},Lt={class:"title font-bold"},Nt={class:"task"},Pt=["data-poster"],At=["src"];function Tt(e,t,o,a,h,g){const c=n("vue-plyr");return r(),p("div",Ut,[i("div",Ct,[i("h2",Lt,l(e.$t("luma.name.extend")),1)]),i("div",Nt,[i("div",null,[s(c,{options:e.options,class:"video"},{default:m(()=>{var u,d;return[i("video",{controls:"",crossorigin:"",playsinline:"","data-poster":(u=e.config)==null?void 0:u.thumbnail_url},[i("source",{size:"1080",src:(d=e.config)==null?void 0:d.video_url,type:"video/mp4"},null,8,At)],8,Pt)]}),_:1},8,["options"])])])])}var Rt=k(Et,[["render",Tt],["__scopeId","data-v-1cefb16b"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/config/ExtendFromInput.vue"]]);const Gt=w({name:"PresetPanel",components:{LoopSelector:tt,StartImageUrlInput:pt,EndImageUrlInput:lt,EnhancementSelector:He,ElButton:R,FontAwesomeIcon:J,PromptInput:St,ExtendFromInput:Rt,CustomSelector:We,UploadVideo:$t},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.luma)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),Dt={class:"panel"},zt={class:"config"},Ot={class:"actions"};function Mt(e,t,o,a,h,g){var L,V,A,G,D,z,O,M,F;const c=n("extend-from-input"),u=n("prompt-input"),d=n("custom-selector"),_=n("upload-video"),f=n("start-image-url-input"),S=n("end-image-url-input"),E=n("enhancement-selector"),P=n("loop-selector"),U=n("font-awesome-icon"),C=n("el-button");return r(),p("div",Dt,[i("div",zt,[((L=e.config)==null?void 0:L.video_id)||((V=e.config)==null?void 0:V.video_url)?(r(),N(c,{key:0,class:"mb-4"})):v("v-if",!0),s(u,{class:"mb-4"}),(A=e.config)!=null&&A.video_id?v("v-if",!0):(r(),N(d,{key:1,class:"mb-4"})),(G=e.config)!=null&&G.custom?(r(),N(_,{key:2,class:"mb-4"})):v("v-if",!0),!(((D=e.config)==null?void 0:D.video_id)||((z=e.config)==null?void 0:z.video_url))&&!((O=e.config)!=null&&O.custom)?(r(),N(f,{key:3,class:"mb-4"})):v("v-if",!0),s(S,{class:"mb-4"}),s(E,{class:"mb-4"}),s(P,{class:"mb-4"}),i("div",Ot,[((M=e.config)==null?void 0:M.video_url)!==void 0||((F=e.config)==null?void 0:F.custom)?(r(),N(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"}),$(" "+l(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(r(),N(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"}),$(" "+l(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])])}var Ft=k(Gt,[["render",Mt],["__scopeId","data-v-951b4cc0"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/ConfigPanel.vue"]]);const jt=w({name:"VideoPlayer",components:{VuePlyr:ve},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),Bt=["data-poster"],qt=["src"];function Ht(e,t,o,a,h,g){const c=n("vue-plyr");return r(),p("div",null,[s(c,{options:e.options,class:"video"},{default:m(()=>{var u,d,_,f;return[i("video",{controls:"",crossorigin:"",playsinline:"","data-poster":(d=(u=e.modelValue)==null?void 0:u.response)==null?void 0:d.thumbnail_url},[i("source",{size:"1080",src:(f=(_=e.modelValue)==null?void 0:_.response)==null?void 0:f.video_url,type:"video/mp4"},null,8,qt)],8,Bt)]}),_:1},8,["options"])])}var Jt=k(jt,[["render",Ht],["__scopeId","data-v-759e400c"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/VideoPlayer.vue"]]);const Kt=w({name:"TaskPreview",components:{ElImage:Se,CopyToClipboard:Te,FontAwesomeIcon:J,ElAlert:Ee,VideoPlayer:Jt,ElTooltip:Ue,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")}}}),Yt={class:"preview"},Qt={class:"left"},Wt={class:"main"},Xt={class:"bot"},Zt={class:"datetime"},xt={class:"info"},eo={key:0,class:"prompt mt-2"},to={key:0},oo={key:1},so={key:0,class:B({content:!0,failed:!0})},no={class:"image-wrapper"},ao={key:0,class:B({operations:!0,"mt-2":!0})},io={class:"description"},lo={key:1,class:B({content:!0})},ro={class:"description"},co={class:"description"},uo={class:"description"},mo={key:2,class:B({content:!0})},po={class:"description"};function _o(e,t,o,a,h,g){var P,U,C,L,V,A,G,D,z,O,M,F,W,X,Z,x,ee,te,oe,se,ne,ae,ie;const c=n("el-image"),u=n("VideoPlayer"),d=n("el-button"),_=n("el-tooltip"),f=n("font-awesome-icon"),S=n("copy-to-clipboard"),E=n("el-alert");return r(),p("div",Yt,[i("div",Qt,[s(c,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),i("div",Wt,[i("div",Xt,[$(l(e.$t("luma.name.lumaBot"))+" ",1),i("span",Zt,l(e.$dayjs.format(""+new Date(parseFloat(((P=e.modelValue)==null?void 0:P.created_at)||"")*1e3))),1)]),i("div",xt,[(C=(U=e.modelValue)==null?void 0:U.request)!=null&&C.prompt?(r(),p("p",eo,[$(l((V=(L=e.modelValue)==null?void 0:L.request)==null?void 0:V.prompt)+" ",1),(A=e.modelValue)!=null&&A.response?v("v-if",!0):(r(),p("span",to," - ("+l(e.$t("luma.status.pending"))+") ",1)),((D=(G=e.modelValue)==null?void 0:G.response)==null?void 0:D.state)==="processing"||((O=(z=e.modelValue)==null?void 0:z.response)==null?void 0:O.state)==="pending"?(r(),p("span",oo," - ("+l(e.$t("luma.status.processing"))+") ",1)):v("v-if",!0)])):v("v-if",!0)]),v(" Display success message "),((F=(M=e.modelValue)==null?void 0:M.response)==null?void 0:F.success)===!0?(r(),p("div",so,[i("div",no,[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",ao,[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(()=>[$(l(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(()=>[$(l(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):v("v-if",!0),s(E,{closable:!1,class:"mt-2 success"},{default:m(()=>{var I,b;return[i("p",io,[s(f,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("luma.name.taskId"))+": "+l((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})])):v("v-if",!0),v(" Display error message "),((x=(Z=e.modelValue)==null?void 0:Z.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",lo,[s(E,{closable:!1,class:"failure"},{template:m(()=>[s(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("luma.name.failure")),1)]),default:m(()=>{var I,b,j,le,re,ce,ue,de,me,pe,_e;return[i("p",ro,[s(f,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("luma.name.taskId"))+": "+l((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"])]),i("p",co,[s(f,{icon:"fa-solid fa-circle-info",class:"mr-1"}),$(" "+l(e.$t("luma.name.failureReason"))+": "+l((re=(le=(j=e.modelValue)==null?void 0:j.response)==null?void 0:le.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"])]),i("p",uo,[s(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),$(" "+l(e.$t("luma.name.traceId"))+": "+l((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})])):v("v-if",!0),v(" Display error message "),!((oe=e.modelValue)!=null&&oe.response)||((ne=(se=e.modelValue)==null?void 0:se.response)==null?void 0:ne.state)==="processing"||((ie=(ae=e.modelValue)==null?void 0:ae.response)==null?void 0:ie.state)==="pending"?(r(),p("div",mo,[s(E,{closable:!1,class:"info"},{template:m(()=>[s(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+l(e.$t("luma.name.failure")),1)]),default:m(()=>{var I,b;return[i("p",po,[s(f,{icon:"fa-solid fa-magic",class:"mr-1"}),$(" "+l(e.$t("luma.name.taskId"))+": "+l((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})])):v("v-if",!0)])])}var fo=k(Kt,[["render",_o],["__scopeId","data-v-077795a0"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/task/Preview.vue"]]);const ho=w({name:"RecentPanel",components:{TaskPreview:fo,ElSkeleton:Ce,ElSkeletonItem:Le},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")}}}),vo={key:0,class:"tasks"},go={class:"left"},$o={class:"main"},yo={key:1,class:"tasks"},bo={key:2,class:"description"};function ko(e,t,o,a,h,g){var _,f,S,E,P,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",vo,[(r(),p(fe,null,he(3,V=>i("div",{key:V,class:"task placeholder"},[i("div",go,[s(u,{animated:""},{template:m(()=>[s(c,{variant:"image",class:"avatar"})]),_:1})]),i("div",$o,[s(u,{animated:""},{template:m(()=>[s(c,{variant:"p",class:"title"}),s(c,{variant:"image",class:"icon"})]),_:1})])])),64))])):((S=(f=e.tasks)==null?void 0:f.items)==null?void 0:S.length)&&((P=(E=e.tasks)==null?void 0:E.items)==null?void 0:P.length)>0?(r(),p("div",yo,[(r(!0),p(fe,null,he((U=e.tasks)==null?void 0:U.items,(V,A)=>(r(),N(d,{key:A,"model-value":V,class:"preview"},null,8,["model-value"]))),128))])):v("v-if",!0),((L=(C=e.tasks)==null?void 0:C.items)==null?void 0:L.length)===0?(r(),p("p",bo,l(e.$t("luma.message.noTasks")),1)):v("v-if",!0)],544)}var wo=k(ho,[["render",ko],["__scopeId","data-v-2f8302a7"],["__file","/home/runner/work/Nexior/Nexior/src/components/luma/RecentPanel.vue"]]);const Io="https://webhook.acedata.cloud/luma",Vo=w({name:"LumaIndex",components:{ConfigPanel:Ft,Layout:Me,ApplicationStatus:Ae,RecentPanel:wo},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)===q.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===q.Request},needApply(){return this.$store.state.luma.status.getApplications===q.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(){ke.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)===Ne&&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 onGenerateVideo(){var o;const e={...this.config,callback_url:Io},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 g,c;const h=(g=a==null?void 0:a.response)==null?void 0:g.data;((c=h==null?void 0:h.error)==null?void 0:c.code)===Pe?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 So(e,t,o,a,h,g){const c=n("config-panel"),u=n("application-status"),d=n("recent-panel"),_=n("layout");return r(),N(_,null,{config:m(()=>[s(c,{onGenerate:e.onGenerateVideo},null,8,["onGenerate"])]),result:m(()=>[s(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:t[0]||(t[0]=f=>e.$store.dispatch("luma/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(d,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),v(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var Oo=k(Vo,[["render",So],["__scopeId","data-v-c45e0af8"],["__file","/home/runner/work/Nexior/Nexior/src/pages/luma/Index.vue"]]);export{Oo as default};
@@ -1 +0,0 @@
1
- import{ae as le}from"./vendor-others.2105a885.js";import{ar as q}from"./vendor-fortawesome.fe21f86d.js";import{V as re}from"./VideoNavigator.d4612b51.js";import{_ as y,az as ce,aA as pe,aB as de,N as ue,U as M,F as _e,aC as me}from"./index.42fb7c30.js";import{S as fe,l as D,R as he,K as ne,L as ie,I as ge,H as ke,O as ve,J as E,N as $e,s as ye,B as be,t as we,y as Ie,Y as Se}from"./vendor-element-plus.6158e0fe.js";import{H as b,al as n,o as i,e as u,f as p,V as s,I as O,M as m,T as c,U,ai as R,L as P,R as k,S as $,P as L}from"./vendor-@vue.66ea933c.js";import{I as z}from"./InfoIcon.cde68aa8.js";import{i as Ve,h as Ee}from"./errorCode.310759b7.js";import{A as Pe}from"./Status.c273ddde.js";import{C as Ae}from"./CopyToClipboard.c63a2368.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.46bc4fb1.js";const Ce=b({name:"LayoutPika",components:{ElDrawer:fe,ElButton:D,FontAwesomeIcon:q,VideoNavigator:re},data(){return{drawer:!1}}}),Ne={class:"main"},Te={class:"config"},Ue={class:"result"};function Re(e,t,o,l,h,g){const r=n("video-navigator"),d=n("font-awesome-icon"),a=n("el-button"),v=n("el-drawer");return i(),u("div",Ne,[p("div",Te,[s(r),O(e.$slots,"config",{},void 0,!0)]),p("div",Ue,[O(e.$slots,"result",{},void 0,!0)]),s(a,{round:"",class:"menu",onClick:t[0]||(t[0]=f=>e.drawer=!0)},{default:m(()=>[s(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(v,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=f=>e.drawer=f),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[O(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Ge=y(Ce,[["render",Re],["__scopeId","data-v-449d36ce"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Pika.vue"]]);const De=b({name:"IngredientsSelector",components:{ElSwitch:he,InfoIcon:z},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=ce)}}),Le={class:"field"},Me={class:"title font-bold"};function Oe(e,t,o,l,h,g){const r=n("el-switch"),d=n("info-icon");return i(),u("div",Le,[p("h2",Me,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 qe=y(De,[["render",Oe],["__scopeId","data-v-798cb974"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/IngredientsSelector.vue"]]);const ze=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(){}}),Be={class:"field"},je={class:"title font-bold"},Fe={class:"float-left"};function He(e,t,o,l,h,g){const r=n("el-option"),d=n("el-select");return i(),u("div",Be,[p("h2",je,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",Fe,c(a.label),1),k(' <span class="float-right">{{ item.value }}</span> ')]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var Ke=y(ze,[["render",He],["__scopeId","data-v-db9ed4a6"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/EffectSelector.vue"]]);const Je=b({name:"IngredientsModelSelector",components:{ElRadioButton:ge,ElRadioGroup:ke},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=pe)}}),Ye={class:"field"},Qe={class:"title font-bold"};function We(e,t,o,l,h,g){const r=n("el-radio-button"),d=n("el-radio-group");return i(),u("div",Ye,[p("h2",Qe,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 Xe=y(Je,[["render",We],["__scopeId","data-v-12df6463"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/IngredientsModelSelector.vue"]]);const Ze=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=de)}}),xe={class:"field"},et={class:"title font-bold"};function tt(e,t,o,l,h,g){const r=n("el-option"),d=n("el-select");return i(),u("div",xe,[p("h2",et,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 st=y(Ze,[["render",tt],["__scopeId","data-v-1df4d99b"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/ModelSelector.vue"]]);const ot=b({name:"ImageUrlInput",components:{ElUpload:ve,ElButton:D,InfoIcon:z},data(){return{fileList:[],uploadUrl:ue()+"/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()}}}),at={class:"field"},nt={class:"title font-bold"},it={class:"upload-wrapper"};function lt(e,t,o,l,h,g){const r=n("el-button"),d=n("el-upload"),a=n("info-icon");return i(),u("div",at,[p("h2",nt,c(e.$t("pika.name.imageUrl")),1),p("div",it,[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 rt=y(ot,[["render",lt],["__scopeId","data-v-5daf4a89"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/ImageUrlInput.vue"]]);const ct="",pt=b({name:"PromptInput",components:{ElInput:$e,InfoIcon:z},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=ct)}}),dt={class:"field"},ut={class:"box"},_t={class:"title font-bold"};function mt(e,t,o,l,h,g){const r=n("info-icon"),d=n("el-input");return i(),u("div",dt,[p("div",ut,[p("h2",_t,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 ft=y(pt,[["render",mt],["__scopeId","data-v-3f49f00e"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/config/PromptInput.vue"]]);const ht=b({name:"PresetPanel",components:{ImageUrlInput:rt,ElButton:D,FontAwesomeIcon:q,PromptInput:ft,IngredientsSelector:qe,IngredientsModelSelector:Xe,ModelSelector:st,EffectSelector:Ke},emits:["generate"],computed:{config(){var e;return(e=this.$store.state.pika)==null?void 0:e.config}},methods:{onGenerate(){this.$emit("generate")}}}),gt={class:"panel"},kt={class:"config"},vt={class:"actions"};function $t(e,t,o,l,h,g){var T,A,C,w;const r=n("prompt-input"),d=n("model-selector"),a=n("ingredients-selector"),v=n("effect-selector"),f=n("image-url-input"),I=n("ingredients-model-selector"),V=n("font-awesome-icon"),_=n("el-button");return i(),u("div",gt,[p("div",kt,[s(r,{class:"mb-4"}),s(d,{class:"mb-4"}),s(a,{class:"mb-4"}),s(v,{class:"mb-4"}),(T=e.config)!=null&&T.ingredients?(i(),P(f,{key:0,class:"mb-4"})):k("v-if",!0),(A=e.config)!=null&&A.ingredients?(i(),P(I,{key:1,class:"mb-4"})):k("v-if",!0),p("div",vt,[((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 yt=y(ht,[["render",$t],["__scopeId","data-v-26d959d2"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/ConfigPanel.vue"]]);const bt=b({name:"VideoPlayer",components:{VuePlyr:le},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),wt=["data-poster"],It=["src"];function St(e,t,o,l,h,g){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,It)],8,wt)]}),_:1},8,["options"])])}var Vt=y(bt,[["render",St],["__scopeId","data-v-3697e02c"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/VideoPlayer.vue"]]);const Et=b({name:"TaskPreview",components:{ElImage:ye,CopyToClipboard:Ae,FontAwesomeIcon:q,ElAlert:be,VideoPlayer:Vt,ElTooltip:we,ElButton:D},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,h,g,r,d,a;let e=[];const t=(l=(o=this.modelValue)==null?void 0:o.request)==null?void 0:l.action;return Array.isArray((g=(h=this.modelValue)==null?void 0:h.response)==null?void 0:g.data)&&((a=(d=(r=this.modelValue)==null?void 0:r.response)==null?void 0:d.data)==null||a.forEach(v=>{let f=v;t&&(f.action=t),e.push(f)})),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")}}}),Pt={class:"left"},At={class:"main"},Ct={class:"bot"},Nt={class:"datetime"},Tt={class:"info"},Ut={key:0,class:"prompt mt-2"},Rt={key:0},Gt={key:1},Dt={key:0,class:L({content:!0,failed:!0})},Lt={class:"image-wrapper"},Mt={key:0,class:L({operations:!0,"mt-2":!0})},Ot={class:"description"},qt={key:1,class:L({content:!0})},zt={class:"description"},Bt={class:"description"},jt={class:"description"},Ft={key:2,class:L({content:!0})},Ht={class:"description"};function Kt(e,t,o,l,h,g){const r=n("el-image"),d=n("VideoPlayer"),a=n("el-button"),v=n("el-tooltip"),f=n("font-awesome-icon"),I=n("copy-to-clipboard"),V=n("el-alert");return i(!0),u(U,null,R(e.videos,(_,T)=>{var A,C,w,G,B,j,F,H,K,J,Y;return i(),u("div",{key:T,class:"preview"},[p("div",Pt,[s(r,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),p("div",At,[p("div",Ct,[$(c(e.$t("pika.name.pikaBot"))+" ",1),p("span",Nt,c(e.$dayjs.format(""+new Date(parseFloat(((A=e.modelValue)==null?void 0:A.created_at)||"")*1e3))),1)]),p("div",Tt,[(w=(C=e.modelValue)==null?void 0:C.request)!=null&&w.prompt?(i(),u("p",Ut,[$(c((B=(G=e.modelValue)==null?void 0:G.request)==null?void 0:B.prompt)+" ",1),(j=e.modelValue)!=null&&j.response?k("v-if",!0):(i(),u("span",Rt," - ("+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",Gt," - ("+c(e.$t("pika.status.processing"))+") ",1)):k("v-if",!0)])):k("v-if",!0)]),k(" Display success message "),((H=(F=e.modelValue)==null?void 0:F.response)==null?void 0:H.success)===!0?(i(),u("div",Dt,[p("div",Lt,[s(d,{"model-value":_},null,8,["model-value"])]),_?(i(),u("div",Mt,[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",Ot,[s(f,{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",qt,[s(V,{closable:!1,class:"failure"},{template:m(()=>[s(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+c(e.$t("pika.name.failure")),1)]),default:m(()=>{var S,N,Q,W,X,Z,x,ee,te,se,oe,ae;return[p("p",zt,[s(f,{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",Bt,[s(f,{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=(Z=e.modelValue)==null?void 0:Z.response)==null?void 0:x.error)==null?void 0:ee.message,class:"btn-copy"},null,8,["content"])]),p("p",jt,[s(f,{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 "),!((Y=e.modelValue)!=null&&Y.response)||(_==null?void 0:_.state)==="processing"||(_==null?void 0:_.state)==="pending"?(i(),u("div",Ft,[s(V,{closable:!1,class:"info"},{template:m(()=>[s(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),$(" "+c(e.$t("pika.name.failure")),1)]),default:m(()=>{var S,N;return[p("p",Ht,[s(f,{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 Jt=y(Et,[["render",Kt],["__scopeId","data-v-90858984"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/task/Preview.vue"]]);const Yt=b({name:"RecentPanel",components:{TaskPreview:Jt,ElSkeleton:Ie,ElSkeletonItem:Se},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")}}}),Qt={key:0,class:"tasks"},Wt={class:"left"},Xt={class:"main"},Zt={key:1,class:"tasks"},xt={key:2,class:"description"};function es(e,t,o,l,h,g){var v,f,I,V,_,T,A,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",Qt,[(i(),u(U,null,R(3,w=>p("div",{key:w,class:"task placeholder"},[p("div",Wt,[s(d,{animated:""},{template:m(()=>[s(r,{variant:"image",class:"avatar"})]),_:1})]),p("div",Xt,[s(d,{animated:""},{template:m(()=>[s(r,{variant:"p",class:"title"}),s(r,{variant:"image",class:"icon"})]),_:1})])])),64))])):((I=(f=e.tasks)==null?void 0:f.items)==null?void 0:I.length)&&((_=(V=e.tasks)==null?void 0:V.items)==null?void 0:_.length)>0?(i(),u("div",Zt,[(i(!0),u(U,null,R((T=e.tasks)==null?void 0:T.items,(w,G)=>(i(),P(a,{key:G,"model-value":w,class:"preview"},null,8,["model-value"]))),128))])):k("v-if",!0),((C=(A=e.tasks)==null?void 0:A.items)==null?void 0:C.length)===0?(i(),u("p",xt,c(e.$t("pika.message.noTasks")),1)):k("v-if",!0)],544)}var ts=y(Yt,[["render",es],["__scopeId","data-v-be2bfa4e"],["__file","/home/runner/work/Nexior/Nexior/src/components/pika/RecentPanel.vue"]]);const ss="https://webhook.acedata.cloud/pika",os=b({name:"PikaIndex",components:{ConfigPanel:yt,Layout:Ge,ApplicationStatus:Pe,RecentPanel:ts},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)===M.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===M.Request},needApply(){return this.$store.state.pika.status.getApplications===M.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(){_e.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)===Ve&&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 onGenerateVideo(){var o;const e={...this.config,callback_url:ss},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 g,r;const h=(g=l==null?void 0:l.response)==null?void 0:g.data;((r=h==null?void 0:h.error)==null?void 0:r.code)===Ee?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 as(e,t,o,l,h,g){const r=n("config-panel"),d=n("application-status"),a=n("recent-panel"),v=n("layout");return i(),P(v,null,{config:m(()=>[s(r,{onGenerate:e.onGenerateVideo},null,8,["onGenerate"])]),result:m(()=>[s(d,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:t[0]||(t[0]=f=>e.$store.dispatch("pika/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),s(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),k(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var gs=y(os,[["render",as],["__scopeId","data-v-307eef94"],["__file","/home/runner/work/Nexior/Nexior/src/pages/pika/Index.vue"]]);export{gs as default};
@@ -1 +0,0 @@
1
- import"./vendor-others.2105a885.js";import{ar as O}from"./vendor-fortawesome.fe21f86d.js";import{I as ne}from"./ImageNavigator.5d4b2ff4.js";import{_ as I,aJ as ae,U as L,F as le,aK as ie}from"./index.42fb7c30.js";import{S as re,l as U,K as ce,L as pe,N as ue,s as de,B as me,t as _e,y as fe,Y as he,J as A}from"./vendor-element-plus.6158e0fe.js";import{H as V,al as a,o as n,e as m,f as i,V as o,I as M,M as f,T as l,U as R,ai as E,L as C,S as y,R as g,P as D}from"./vendor-@vue.66ea933c.js";import{I as ve}from"./InfoIcon.cde68aa8.js";import{i as $e,h as ge}from"./errorCode.310759b7.js";import{A as ye}from"./Status.c273ddde.js";import{C as ke}from"./CopyToClipboard.c63a2368.js";import"./vendor-axios.168e6950.js";import"./vendor-qrcode.46bc4fb1.js";const we=V({name:"LayoutFlux",components:{ElDrawer:re,ElButton:U,FontAwesomeIcon:O,ImageNavigator:ne},data(){return{drawer:!1}}}),be={class:"main"},xe={class:"config"},Ie={class:"result"};function Ve(e,t,s,r,h,v){const p=a("image-navigator"),_=a("font-awesome-icon"),u=a("el-button"),$=a("el-drawer");return n(),m("div",be,[i("div",xe,[o(p),M(e.$slots,"config",{},void 0,!0)]),i("div",Ie,[M(e.$slots,"result",{},void 0,!0)]),o(u,{round:"",class:"menu",onClick:t[0]||(t[0]=d=>e.drawer=!0)},{default:f(()=>[o(_,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),o($,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=d=>e.drawer=d),"with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[M(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}var Se=I(we,[["render",Ve],["__scopeId","data-v-324e8ab0"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Flux.vue"]]);const Ae=V({name:"ModelSelector",components:{ElSelect:ce,ElOption:pe},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=ae)}}),Te={class:"field"},Ge={class:"title font-bold"};function Ce(e,t,s,r,h,v){const p=a("el-option"),_=a("el-select");return n(),m("div",Te,[i("h2",Ge,l(e.$t("flux.name.model")),1),o(_,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=u=>e.value=u),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(n(!0),m(R,null,E(e.options,u=>(n(),C(p,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}var Pe=I(Ae,[["render",Ce],["__scopeId","data-v-8a0bbbfe"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/config/ModelSelector.vue"]]);const Ne="",Re=V({name:"PromptInput",components:{ElInput:ue,InfoIcon:ve},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=Ne)}}),Ee={class:"field"},De={class:"box"},Le={class:"title font-bold"};function Me(e,t,s,r,h,v){const p=a("info-icon"),_=a("el-input");return n(),m("div",Ee,[i("div",De,[i("h2",Le,l(e.$t("flux.name.prompt")),1),o(p,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),o(_,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=u=>e.prompt=u),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}var Oe=I(Re,[["render",Me],["__scopeId","data-v-76c331df"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/config/PromptInput.vue"]]);const Ue=V({name:"PresetPanel",components:{ElButton:U,FontAwesomeIcon:O,PromptInput:Oe,ModelSelector:Pe},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"},qe={class:"config"},Be={class:"actions"};function je(e,t,s,r,h,v){var d,k;const p=a("prompt-input"),_=a("model-selector"),u=a("font-awesome-icon"),$=a("el-button");return n(),m("div",Fe,[i("div",qe,[o(p,{class:"mb-4"}),o(_,{class:"mb-4"}),i("div",Be,[((d=e.config)==null?void 0:d.video_url)!==void 0||((k=e.config)==null?void 0:k.custom)?(n(),C($,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[o(u,{icon:"fa-solid fa-magic",class:"mr-2"}),y(" "+l(e.$t("flux.button.extend")),1)]),_:1},8,["onClick"])):(n(),C($,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[o(u,{icon:"fa-solid fa-magic",class:"mr-2"}),y(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"]))])])])}var ze=I(Ue,[["render",je],["__scopeId","data-v-707be6ac"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/ConfigPanel.vue"]]);const He=V({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{viewImage:s=>{window.open(s,"_blank")}}}}),Ke={class:"image-gallery"},Je={class:"image-container"},Xe=["src"];function Ye(e,t,s,r,h,v){return n(),m("div",Ke,[i("div",Je,[i("img",{src:e.modelValue.image_url,alt:"Image"},null,8,Xe),i("button",{class:"view-button",onClick:t[0]||(t[0]=p=>e.viewImage(e.modelValue.image_url))},l(e.$t("flux.button.viewImage")),1)])])}var Qe=I(He,[["render",Ye],["__scopeId","data-v-74374cc6"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/ImageGallery.vue"]]);const We=V({name:"TaskPreview",components:{ElImage:de,CopyToClipboard:ke,FontAwesomeIcon:O,ElAlert:me,ElTooltip:_e,ElButton:U,ImageGallery:Qe},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 s,r,h,v,p,_,u;let e=[];const t=(r=(s=this.modelValue)==null?void 0:s.request)==null?void 0:r.action;return Array.isArray((v=(h=this.modelValue)==null?void 0:h.response)==null?void 0:v.data)&&((u=(_=(p=this.modelValue)==null?void 0:p.response)==null?void 0:_.data)==null||u.forEach($=>{let d=$;t&&(d.action=t),e.push(d)})),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ze={class:"left"},et={class:"main"},tt={class:"bot"},ot={class:"datetime"},st={class:"info"},nt={key:0,class:"prompt mt-2"},at={key:0},lt={key:1},it={key:0,class:D({content:!0,failed:!0})},rt={class:"image-wrapper"},ct={key:0,class:D({operations:!0,"mt-2":!0})},pt={class:"description"},ut={key:1,class:D({content:!0})},dt={class:"description"},mt={class:"description"},_t={class:"description"},ft={key:2,class:D({content:!0})},ht={class:"description"};function vt(e,t,s,r,h,v){const p=a("el-image"),_=a("image-gallery"),u=a("el-button"),$=a("el-tooltip"),d=a("font-awesome-icon"),k=a("copy-to-clipboard"),S=a("el-alert");return n(!0),m(R,null,E(e.images,(c,P)=>{var T,G,b,N,F,q,B,j,z,H,K;return n(),m("div",{key:P,class:"preview"},[i("div",Ze,[o(p,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),i("div",et,[i("div",tt,[y(l(e.$t("flux.name.fluxBot"))+" ",1),i("span",ot,l(e.$dayjs.format(""+new Date(parseFloat(((T=e.modelValue)==null?void 0:T.created_at)||"")*1e3))),1)]),i("div",st,[(b=(G=e.modelValue)==null?void 0:G.request)!=null&&b.prompt?(n(),m("p",nt,[y(l((F=(N=e.modelValue)==null?void 0:N.request)==null?void 0:F.prompt)+" ",1),(q=e.modelValue)!=null&&q.response?g("v-if",!0):(n(),m("span",at," - ("+l(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(),m("span",lt," - ("+l(e.$t("flux.status.processing"))+") ",1)):g("v-if",!0)])):g("v-if",!0)]),g(" Display success message "),((j=(B=e.modelValue)==null?void 0:B.response)==null?void 0:j.success)===!0?(n(),m("div",it,[i("div",rt,[o(_,{"model-value":c},null,8,["model-value"])]),c?(n(),m("div",ct,[o($,{class:"box-item",effect:"dark",content:e.$t("flux.message.downloadImage"),placement:"top-start"},{default:f(()=>[o(u,{type:"info",size:"small",class:"btn-action",onClick:w=>e.onDownload(w,c==null?void 0:c.image_url)},{default:f(()=>[y(l(e.$t("flux.button.download")),1)]),_:2},1032,["onClick"])]),_:2},1032,["content"])])):g("v-if",!0),o(S,{closable:!1,class:"mt-2 success"},{default:f(()=>{var w,x;return[i("p",pt,[o(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+l(e.$t("flux.name.taskId"))+": "+l((w=e.modelValue)==null?void 0:w.id)+" ",1),o(k,{content:(x=e.modelValue)==null?void 0:x.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),((H=(z=e.modelValue)==null?void 0:z.response)==null?void 0:H.success)===!1?(n(),m("div",ut,[o(S,{closable:!1,class:"failure"},{template:f(()=>[o(d,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),y(" "+l(e.$t("flux.name.failure")),1)]),default:f(()=>{var w,x,J,X,Y,Q,W,Z,ee,te,oe,se;return[i("p",dt,[o(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+l(e.$t("flux.name.taskId"))+": "+l((w=e.modelValue)==null?void 0:w.id)+" ",1),o(k,{content:(x=e.modelValue)==null?void 0:x.id,class:"btn-copy"},null,8,["content"])]),i("p",mt,[o(d,{icon:"fa-solid fa-circle-info",class:"mr-1"}),y(" "+l(e.$t("flux.name.failureReason"))+": "+l((Y=(X=(J=e.modelValue)==null?void 0:J.response)==null?void 0:X.error)==null?void 0:Y.message)+" ",1),o(k,{content:(Z=(W=(Q=e.modelValue)==null?void 0:Q.response)==null?void 0:W.error)==null?void 0:Z.message,class:"btn-copy"},null,8,["content"])]),i("p",_t,[o(d,{icon:"fa-solid fa-hashtag",class:"mr-1"}),y(" "+l(e.$t("flux.name.traceId"))+": "+l((te=(ee=e.modelValue)==null?void 0:ee.response)==null?void 0:te.trace_id)+" ",1),o(k,{content:(se=(oe=e.modelValue)==null?void 0:oe.response)==null?void 0:se.trace_id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0),g(" Display error message "),!((K=e.modelValue)!=null&&K.response)||(c==null?void 0:c.state)==="processing"||(c==null?void 0:c.state)==="pending"?(n(),m("div",ft,[o(S,{closable:!1,class:"info"},{template:f(()=>[o(d,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),y(" "+l(e.$t("flux.name.failure")),1)]),default:f(()=>{var w,x;return[i("p",ht,[o(d,{icon:"fa-solid fa-magic",class:"mr-1"}),y(" "+l(e.$t("flux.name.taskId"))+": "+l((w=e.modelValue)==null?void 0:w.id)+" ",1),o(k,{content:(x=e.modelValue)==null?void 0:x.id,class:"btn-copy"},null,8,["content"])])]}),_:1})])):g("v-if",!0)])])}),128)}var $t=I(We,[["render",vt],["__scopeId","data-v-bb276cb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/task/Preview.vue"]]);const gt=V({name:"RecentPanel",components:{TaskPreview:$t,ElSkeleton:fe,ElSkeletonItem:he},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){var e,t,s,r;return{...(e=this.$store.state.flux)==null?void 0:e.tasks,items:(r=(s=(t=this.$store.state.flux)==null?void 0:t.tasks)==null?void 0:s.items)==null?void 0:r.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),yt={key:0,class:"tasks"},kt={class:"left"},wt={class:"main"},bt={key:1,class:"tasks"},xt={key:2,class:"description"};function It(e,t,s,r,h,v){var $,d,k,S,c,P,T,G;const p=a("el-skeleton-item"),_=a("el-skeleton"),u=a("task-preview");return n(),m("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(),m("div",yt,[(n(),m(R,null,E(3,b=>i("div",{key:b,class:"task placeholder"},[i("div",kt,[o(_,{animated:""},{template:f(()=>[o(p,{variant:"image",class:"avatar"})]),_:1})]),i("div",wt,[o(_,{animated:""},{template:f(()=>[o(p,{variant:"p",class:"title"}),o(p,{variant:"image",class:"icon"})]),_:1})])])),64))])):((k=(d=e.tasks)==null?void 0:d.items)==null?void 0:k.length)&&((c=(S=e.tasks)==null?void 0:S.items)==null?void 0:c.length)>0?(n(),m("div",bt,[(n(!0),m(R,null,E((P=e.tasks)==null?void 0:P.items,(b,N)=>(n(),C(u,{key:N,"model-value":b,class:"preview"},null,8,["model-value"]))),128))])):g("v-if",!0),((G=(T=e.tasks)==null?void 0:T.items)==null?void 0:G.length)===0?(n(),m("p",xt,l(e.$t("flux.message.noTasks")),1)):g("v-if",!0)],544)}var Vt=I(gt,[["render",It],["__scopeId","data-v-2ae6e09a"],["__file","/home/runner/work/Nexior/Nexior/src/components/flux/RecentPanel.vue"]]);const St="https://webhook.acedata.cloud/flux",At=V({name:"FluxIndex",components:{ConfigPanel:ze,Layout:Se,ApplicationStatus:ye,RecentPanel:Vt},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)===L.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)===L.Request},needApply(){var e,t;return((t=(e=this.$store.state.flux)==null?void 0:e.status)==null?void 0:t.getApplications)===L.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 s,r;((s=e==null?void 0:e.items)==null?void 0:s.length)>((r=t==null?void 0:t.items)==null?void 0:r.length)&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){var e,t,s;console.debug("reached top"),await this.onGetTasks({createdAtMax:(s=(t=(e=this.tasks)==null?void 0:e.items)==null?void 0:t[0])==null?void 0:s.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("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(){le.create({application:this.application}).then(({data:e})=>{this.application=e,A.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{var t,s;((s=(t=e==null?void 0:e.response)==null?void 0:t.data)==null?void 0:s.code)===$e&&A.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:s,createdAtMax:r}=e||{};console.debug("limit",t,"createdAtMin",s,"createdAtMax",r),await this.$store.dispatch("flux/getTasks",{limit:t,createdAtMin:s,createdAtMax:r})},async onGenerateVideo(){var s;const e={...this.config,callback_url:St},t=(s=this.credential)==null?void 0:s.token;if(!t){console.error("no token specified");return}A.info(this.$t("flux.message.startingTask")),ie.generate(e,{token:t}).then(()=>{A.success(this.$t("flux.message.startTaskSuccess")),this.$store.commit("flux/setConfig",{config:void 0})}).catch(r=>{var v,p;const h=(v=r==null?void 0:r.response)==null?void 0:v.data;((p=h==null?void 0:h.error)==null?void 0:p.code)===ge?A.error(this.$t("flux.message.usedUp")):A.error(this.$t("flux.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Tt(e,t,s,r,h,v){const p=a("config-panel"),_=a("application-status"),u=a("recent-panel"),$=a("layout");return n(),C($,null,{config:f(()=>[o(p,{onGenerate:e.onGenerateVideo},null,8,["onGenerate"])]),result:f(()=>[o(_,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:t[0]||(t[0]=d=>e.$store.dispatch("flux/setApplication",d))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),o(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"]),g(' <operation-panel class="panel operation" @generate="onGenerate" /> ')]),_:1})}var qt=I(At,[["render",Tt],["__scopeId","data-v-e3c77ee0"],["__file","/home/runner/work/Nexior/Nexior/src/pages/flux/Index.vue"]]);export{qt as default};