@acedatacloud/nexior 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Auth.fc7a25e1.js → Auth.713edf8d.js} +1 -1
- package/dist/assets/{Buy.7b15f777.js → Buy.d14878b4.js} +1 -1
- package/dist/assets/{Callback.3a21d07a.js → Callback.e4f58aa3.js} +1 -1
- package/dist/assets/{Chatdoc.f5e0e4e0.js → Chatdoc.4ff43c51.js} +1 -1
- package/dist/assets/{Console.a37fe02c.js → Console.7a592fa7.js} +1 -1
- package/dist/assets/{Conversation.969a986d.js → Conversation.adedeee4.js} +1 -1
- package/dist/assets/{Conversation.7c0d074b.js → Conversation.b5a23f94.js} +1 -1
- package/dist/assets/{CopyToClipboard.4d3ebf45.js → CopyToClipboard.6cf34500.js} +1 -1
- package/dist/assets/{Detail.be880abe.js → Detail.fa6adcd5.js} +1 -1
- package/dist/assets/{History.41b5e130.js → History.bd281ea3.js} +1 -1
- package/dist/assets/{History.4fb35c3c.js → History.c194dde3.js} +1 -1
- package/dist/assets/{Index.76cb1f30.js → Index.48961a21.js} +1 -1
- package/dist/assets/Index.577a004a.js +1 -0
- package/dist/assets/Index.a09fc687.js +1 -0
- package/dist/assets/Index.b9a5f474.js +1 -0
- package/dist/assets/{InfoIcon.d2882b69.js → InfoIcon.122fd69d.js} +1 -1
- package/dist/assets/{Invitees.68141628.js → Invitees.19f3f690.js} +1 -1
- package/dist/assets/{List.1fffc38c.js → List.0661058f.js} +1 -1
- package/dist/assets/{List.8982a4a8.js → List.40f9e284.js} +1 -1
- package/dist/assets/{List.0d15835e.js → List.f9231aba.js} +1 -1
- package/dist/assets/{Login.6d60091e.js → Login.a5550fcb.js} +1 -1
- package/dist/assets/{Main.36c5bbe7.js → Main.8f2931c3.js} +1 -1
- package/dist/assets/{Manage.94aea8fa.js → Manage.10a86485.js} +1 -1
- package/dist/assets/{Navigator.21734fe2.js → Navigator.5db08cbe.js} +1 -1
- package/dist/assets/{Pagination.3b452403.js → Pagination.94774787.js} +1 -1
- package/dist/assets/{Setting.72726ed2.js → Setting.542ca62f.js} +1 -1
- package/dist/assets/{Status.9fc5b6b1.js → Status.976901eb.js} +1 -1
- package/dist/assets/{TaskPreview.847133d6.js → TaskPreview.7365885a.js} +1 -1
- package/dist/assets/{distribution.e5caf4d8.js → distribution.f3d3ffba.js} +1 -1
- package/dist/assets/{index.09a5f2c2.js → index.988c94f7.js} +1 -1
- package/dist/assets/{order.2f7e73c2.js → order.07f3bb12.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/Index.b364befe.js +0 -1
- package/dist/assets/Index.e0fbe3d6.js +0 -1
- package/dist/assets/Index.fb30b9e6.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-others.5383d97e.js";import{_}from"./index.
|
|
1
|
+
import"./vendor-others.5383d97e.js";import{_}from"./index.988c94f7.js";import{b as s,d as c}from"./vendor-element-plus.7e649a36.js";import{H as i,al as e,L as p,M as o,o as l,V as t}from"./vendor-@vue.b5394076.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";const u=i({name:"LayoutAuth",components:{ElContainer:s,ElMain:c}});function m(d,f,v,h,x,w){const n=e("router-view"),r=e("el-main"),a=e("el-container");return l(),p(a,null,{default:o(()=>[t(r,null,{default:o(()=>[t(n)]),_:1})]),_:1})}var B=_(u,[["render",m],["__scopeId","data-v-8e16c232"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Auth.vue"]]);export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var M=Object.defineProperty,U=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var I=(e,a,t)=>a in e?M(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,w=(e,a)=>{for(var t in a||(a={}))G.call(a,t)&&I(e,t,a[t]);if(B)for(var t of B(a))H.call(a,t)&&I(e,t,a[t]);return e},N=(e,a)=>U(e,z(a));import"./vendor-others.5383d97e.js";import{_ as F,v as Q,w as W}from"./index.
|
|
1
|
+
var M=Object.defineProperty,U=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var I=(e,a,t)=>a in e?M(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,w=(e,a)=>{for(var t in a||(a={}))G.call(a,t)&&I(e,t,a[t]);if(B)for(var t of B(a))H.call(a,t)&&I(e,t,a[t]);return e},N=(e,a)=>U(e,z(a));import"./vendor-others.5383d97e.js";import{_ as F,v as Q,w as W}from"./index.988c94f7.js";import{H as P,o as n,e as h,U as p,al as s,L as k,M as i,V as o,f as j,T as b,ai as J,W as K,S as O,Q as V}from"./vendor-@vue.b5394076.js";import{o as X}from"./order.07f3bb12.js";import{u as Y,n as Z,o as x,s as ee,B as ae,C as te,f as ie,w as oe,D as re,F as se,G as ne}from"./vendor-element-plus.7e649a36.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";const le=P({name:"ApiPrice",props:{price:{type:Number,required:!1,default:0},unit:{type:String,required:!1,default:void 0},start:{type:Boolean,required:!1,default:!1}}}),pe={class:"price-text"},ce={key:0,class:"unfree"},de={key:1,class:"free"};function ue(e,a,t,l,c,v){return n(),h("div",pe,[e.price>0?(n(),h("span",ce,"$"+p(e.price)+" "+p(e.unit?` / ${e.unit}`:"")+p(e.start?e.$t("common.message.startPrice"):""),1)):(n(),h("span",de,p(e.$t("common.message.free")),1))])}var me=F(le,[["render",ue],["__scopeId","data-v-d195ccd6"],["__file","/home/runner/work/Nexior/Nexior/src/components/common/Price.vue"]]);const fe=P({name:"ConsoleApplicationBuy",components:{ElSkeleton:Y,ElRow:Z,ElCol:x,ElCard:ee,ElForm:ae,ElFormItem:te,ElButton:ie,ElDivider:oe,ElRadioGroup:re,ElRadioButton:se,Price:me},data(){return{application:void 0,loading:!1,form:{packageId:void 0},creating:!1}},computed:{id(){var e,a;return(a=(e=this.$route.params)==null?void 0:e.id)==null?void 0:a.toString()},price(){var e,a,t;return((a=(e=this.application)==null?void 0:e.service)==null?void 0:a.price)&&this.form.amount?this.form.amount*((t=this.application.service)==null?void 0:t.price):0},package(){var e,a,t;if(((a=(e=this.application)==null?void 0:e.service)==null?void 0:a.packages)&&this.form.packageId){const l=(t=this.application.service)==null?void 0:t.packages.filter(c=>c.id===this.form.packageId);if(l.length>0)return l[0]}}},mounted(){this.onFetchApplication()},methods:{onFetchApplication(){this.loading=!0,Q.get(this.id).then(({data:e})=>{var a,t,l,c;this.application=e,this.loading=!1,this.form.packageId=(c=(l=(t=(a=this.application)==null?void 0:a.service)==null?void 0:t.packages)==null?void 0:l[0])==null?void 0:c.id}).catch(()=>{this.loading=!1})},onCreateOrder(){var a,t,l,c,v,u,m,$;if(!((a=this.application)!=null&&a.id))return;this.creating=!0;const e=this.$t(`service.unit.${(l=(t=this.application)==null?void 0:t.service)==null?void 0:l.unit}s`);X.create(N(w({application_id:(c=this.application)==null?void 0:c.id,amount:(v=this.package)==null?void 0:v.amount},this.form.packageId!=="custom"&&this.package?{package_id:this.package.id}:{}),{description:`${(m=(u=this.application)==null?void 0:u.service)==null?void 0:m.title} x ${($=this.package)==null?void 0:$.amount} ${e}`})).then(({data:f})=>{this.creating=!1;const y=f;this.$router.push({name:W,params:{id:y.id}})}).catch(()=>{ne.error(this.$t("order.message.createFailed")),this.creating=!1})}}}),_e={class:"title"},he={key:1,class:V({price:!0,free:!0})};function ge(e,a,t,l,c,v){const u=s("el-col"),m=s("el-row"),$=s("el-skeleton"),f=s("el-form-item"),y=s("el-radio-button"),R=s("el-radio-group"),S=s("price"),A=s("el-divider"),D=s("el-button"),L=s("el-form"),T=s("el-card");return n(),k(m,{class:"panel"},{default:i(()=>[o(u,{span:24},{default:i(()=>[o(m,null,{default:i(()=>[o(u,{span:24},{default:i(()=>[j("h2",_e,p(e.$t("common.title.buyMore")),1)]),_:1})]),_:1}),o(m,null,{default:i(()=>[o(u,{span:24},{default:i(()=>[o(T,{shadow:"hover"},{default:i(()=>[o(m,null,{default:i(()=>[o(u,{span:12,offset:6},{default:i(()=>[e.loading?(n(),k($,{key:0})):e.application?(n(),k(L,{key:1,"label-width":"100px"},{default:i(()=>[o(f,{label:e.$t("application.field.service")},{default:i(()=>{var r,d;return[b(p((d=(r=e.application)==null?void 0:r.service)==null?void 0:d.title),1)]}),_:1},8,["label"]),o(f,{label:e.$t("application.field.package")},{default:i(()=>{var r,d;return[(d=(r=e.application)==null?void 0:r.service)!=null&&d.packages?(n(),k(R,{key:0,modelValue:e.form.packageId,"onUpdate:modelValue":a[0]||(a[0]=_=>e.form.packageId=_)},{default:i(()=>{var _;return[(n(!0),h(K,null,J((_=e.application)==null?void 0:_.service.packages,(g,q)=>(n(),k(y,{key:q,label:g.id},{default:i(()=>{var E,C;return[b(p(g.amount)+" "+p(e.$t(`service.unit.${(C=(E=e.application)==null?void 0:E.service)==null?void 0:C.unit}s`)),1)]}),_:2},1032,["label"]))),128))]}),_:1},8,["modelValue"])):O("v-if",!0)]}),_:1},8,["label"]),o(f,{label:e.$t("service.field.price")},{default:i(()=>{var r;return[o(S,{price:(r=e.package)==null?void 0:r.price},null,8,["price"])]}),_:1},8,["label"]),o(A,{"border-style":"dashed"}),o(f,{label:e.$t("application.field.shouldPayPrice")},{default:i(()=>{var r,d,_,g;return[e.package?(n(),h("span",{key:0,class:V({price:!0,unfree:((r=e.package)==null?void 0:r.price)>0,free:((d=e.package)==null?void 0:d.price)===0})}," $"+p((g=(_=e.package)==null?void 0:_.price)==null?void 0:g.toFixed(2)),3)):(n(),h("span",he," $ 0 "))]}),_:1},8,["label"]),o(f,null,{default:i(()=>[o(D,{type:"primary",size:"large",class:"btn-create",loading:e.creating,round:"",onClick:e.onCreateOrder},{default:i(()=>[b(p(e.$t("application.button.createOrder")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})):O("v-if",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}var Ie=F(fe,[["render",ge],["__scopeId","data-v-5881dfca"],["__file","/home/runner/work/Nexior/Nexior/src/pages/console/application/Buy.vue"]]);export{Ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-others.5383d97e.js";import{_ as s}from"./index.
|
|
1
|
+
import"./vendor-others.5383d97e.js";import{_ as s}from"./index.988c94f7.js";import{H as r}from"./vendor-@vue.b5394076.js";import"./vendor-element-plus.7e649a36.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";const i=r({name:"AuthCallback",data(){var e,t;return{accessToken:void 0,refreshToken:void 0,redirect:(e=this.$route.query.redirect)==null?void 0:e.toString(),code:(t=this.$route.query.code)==null?void 0:t.toString(),user:void 0}},async mounted(){if(this.code){const e=await this.$store.dispatch("getToken",this.code);this.accessToken=e.access,this.refreshToken=e.refresh}else{this.$store.dispatch("resetToken");return}if(this.accessToken&&this.refreshToken){const e=await this.$store.dispatch("getUser");this.user=e,this.redirect&&await this.$router.push(this.redirect)}else this.$store.dispatch("resetToken")}});var u=s(i,[["__scopeId","data-v-4aa7f9d0"],["__file","/home/runner/work/Nexior/Nexior/src/pages/auth/Callback.vue"]]);export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var w=Object.defineProperty,g=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var l=(e,t,o)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,p=(e,t)=>{for(var o in t||(t={}))N.call(t,o)&&l(e,o,t[o]);if(d)for(var o of d(t))x.call(t,o)&&l(e,o,t[o]);return e},u=(e,t)=>g(e,k(t));import{av as A}from"./vendor-others.5383d97e.js";import{W as I,m as M,_ as E}from"./index.
|
|
1
|
+
var w=Object.defineProperty,g=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var l=(e,t,o)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,p=(e,t)=>{for(var o in t||(t={}))N.call(t,o)&&l(e,o,t[o]);if(d)for(var o of d(t))x.call(t,o)&&l(e,o,t[o]);return e},u=(e,t)=>g(e,k(t));import{av as A}from"./vendor-others.5383d97e.js";import{W as I,m as M,_ as E}from"./index.988c94f7.js";import{l as S,m as R}from"./vendor-element-plus.7e649a36.js";import{H as T,al as n,o as s,e as m,L as h,M as _,f as r,V as O,U as f,W as V,ai as G,S as L,I as B,T as D}from"./vendor-@vue.b5394076.js";const H=T({name:"LayoutChatdoc",components:{ElMenu:S,ElMenuItem:R,FontAwesomeIcon:A},data(){var e,t;return{repositoryId:(t=(e=this.$route.params)==null?void 0:e.repositoryId)==null?void 0:t.toString(),drawer:!1,menuItems:[{index:"chat",title:this.$t("chatdoc.nav.chat"),route:{name:I}},{index:"manage",title:this.$t("chatdoc.nav.manage"),route:{name:M}}]}},computed:{activeMenu(){var t;const e=this.menuItems.filter(o=>{var a;return((a=o.route)==null?void 0:a.name)===this.$route.name});if(e)return(t=e[0])==null?void 0:t.index},repository(){var e,t,o;return(o=(t=(e=this.$store.state)==null?void 0:e.chatdoc)==null?void 0:t.repositories)==null?void 0:o.find(a=>a.id===this.repositoryId)}},async mounted(){await this.getService(),await this.onGetApplications(),await this.onGetRepositories()},methods:{async getService(){await this.$store.dispatch("chatdoc/getService")},async onGetApplications(){await this.$store.dispatch("chatdoc/getApplication")},async onGetRepositories(){await this.$store.dispatch("chatdoc/getRepositories")},async onClickMenu(e){this.activeMenu=e.index,e.route&&await this.$router.push(u(p({},e.route),{params:{id:this.repositoryId}}))}}}),U={class:"main"},W={class:"repository"},F={class:"chatdoc"};function b(e,t,o,a,z,j){const v=n("font-awesome-icon"),y=n("el-menu-item"),C=n("el-menu");return s(),m("div",U,[e.repositoryId?(s(),h(C,{key:0,"default-active":e.activeMenu,mode:"horizontal",ellipsis:!1,class:"menu"},{default:_(()=>{var c;return[r("div",W,[O(v,{class:"mr-2",icon:["fas","book"]}),r("span",null,f((c=e.repository)==null?void 0:c.name),1)]),(s(!0),m(V,null,G(e.menuItems,(i,$)=>(s(),h(y,{key:$,index:i.index,onClick:q=>e.onClickMenu(i)},{default:_(()=>[D(f(i.title),1)]),_:2},1032,["index","onClick"]))),128))]}),_:1},8,["default-active"])):L("v-if",!0),r("div",F,[B(e.$slots,"chatdoc",{},void 0,!0)])])}var Y=E(H,[["render",b],["__scopeId","data-v-35d9dd71"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Chatdoc.vue"]]);export{Y as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{av as u}from"./vendor-others.5383d97e.js";import{N as C}from"./Navigator.
|
|
1
|
+
import{av as u}from"./vendor-others.5383d97e.js";import{N as C}from"./Navigator.5db08cbe.js";import{B as S,R as L,b as x,c as E,d as O,_ as p}from"./index.988c94f7.js";import{H as f,al as t,o as r,e as c,f as a,W as k,ai as y,Q as I,V as s,U,L as b,S as B,aK as R,aL as T,M as m}from"./vendor-@vue.b5394076.js";import{e as V,f as A}from"./vendor-element-plus.7e649a36.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";const P=f({name:"Navigator",components:{FontAwesomeIcon:u},computed:{isOfficial(){return window.location.origin===S},active(){return this.$route.matched[0].path},user(){return this.$store.getters.user},links(){return[{key:"application-list",text:this.$t("console.menu.applicationList"),name:L,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:x,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:E,icon:"fa-solid fa-rotate-left"}]}},mounted(){},methods:{onHome(){this.$router.push({name:O})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href&&window.open(e.href,"_blank")}}}),D=e=>(R("data-v-3859f1b5"),e=e(),T(),e),H={class:"side-panel"},z={class:"links"},F=["onClick"],q={class:"icon"},G={class:"text"},K={class:"outer"},M=D(()=>a("span",{class:"suffix"},null,-1));function Q(e,n,v,h,w,$){const i=t("font-awesome-icon");return r(),c("div",H,[a("div",z,[(r(!0),c(k,null,y(e.links,(o,l)=>(r(),c("a",{key:l,class:I({link:!0,active:e.$route.name===o.name}),onClick:_=>e.onNavigate(o)},[a("span",q,[s(i,{icon:o.icon,class:"text-sm"},null,8,["icon"])]),a("span",G,U(o.text),1),a("span",K,[!o.name&&o.href?(r(),b(i,{key:0,icon:"fa-solid fa-up-right-from-square",class:"text-sm ml-2"})):B("v-if",!0)]),M],10,F))),128))])])}var W=p(P,[["render",Q],["__scopeId","data-v-3859f1b5"],["__file","/home/runner/work/Nexior/Nexior/src/components/console/SidePanel.vue"]]);const X=f({name:"LayoutConsole",components:{SidePanel:W,Navigator:C,ElDrawer:V,ElButton:A,FontAwesomeIcon:u},data(){return{drawer:!1}}}),j={class:"wrapper"},J={class:"main"};function Y(e,n,v,h,w,$){const i=t("navigator"),o=t("side-panel"),l=t("router-view"),_=t("font-awesome-icon"),N=t("el-button"),g=t("el-drawer");return r(),c("div",j,[s(i,{class:"navigator"}),a("div",J,[s(o,{class:"side"}),s(l,{class:"operation"})]),s(N,{round:"",class:"menu",onClick:n[0]||(n[0]=d=>e.drawer=!0)},{default:m(()=>[s(_,{icon:"fa-solid fa-bars",class:"icon-menu"})]),_:1}),s(g,{modelValue:e.drawer,"onUpdate:modelValue":n[1]||(n[1]=d=>e.drawer=d),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[s(o)]),_:1},8,["modelValue"])])}var re=p(X,[["render",Y],["__scopeId","data-v-44569c68"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Console.vue"]]);export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{av as T,au as F}from"./vendor-others.5383d97e.js";import{L as P}from"./Chatdoc.f5e0e4e0.js";import{W as H,X as S,l as q,_ as k,x as N,F as b,H as K,Y as v}from"./index.09a5f2c2.js";import{a as z}from"./vendor-axios.168e6950.js";import{M as G,E as D,a as V,b as W,c as Q,d as x,e as J,f as Y,g as A,A as j,h as X}from"./Status.9fc5b6b1.js";import{K as M,u as Z,x as ee,f as se}from"./vendor-element-plus.7e649a36.js";import{H as E,al as l,o,e as c,L as h,f as i,V as m,U as I,W as R,ai as U,Q as O,as as B,S as f,$ as C,M as L,T as te}from"./vendor-@vue.b5394076.js";import{C as oe}from"./CopyToClipboard.4d3ebf45.js";import{i as ie}from"./is.dd611415.js";import"./vendor-highlight.js.40bb9ea2.js";import"./application.ea1e2a72.js";var $=(e=>(e.PENDING="pending",e.ANSWERING="answering",e.FINISHED="finished",e.FAILED="failed",e))($||{});const ne=E({name:"SidePanel",components:{ElInput:M,FontAwesomeIcon:T,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:H,params:{repositoryId:this.repositoryId}})},async onConfirm(e){e!=null&&e.deleting?(await S.deleteConversation(e.id),await this.$store.dispatch("chat/getConversations")):e!=null&&e.editing?(await S.updateConversation(e),await this.$store.dispatch("chat/getConversations")):e.editing=!0},onClick(e){!e||(this.$router.push({name:q,params:{repositoryId:this.repositoryId,conversationId:e}}),this.$emit("click",e))}}}),ae={class:"panel"},re={key:1,class:"conversations"},le={class:"icons"},de={class:"title"},ce=["onClick"],ue={class:"icons"},pe={class:"title"},he={key:0},me={key:1},_e={key:2},ge={class:"operations"};function fe(e,t,n,d,r,y){const u=l("el-skeleton"),a=l("font-awesome-icon"),_=l("el-input");return o(),c("div",ae,[e.conversations===void 0?(o(),h(u,{key:0})):(o(),c("div",re,[i("div",{class:"conversation",onClick:t[0]||(t[0]=(...s)=>e.onNewConversation&&e.onNewConversation(...s))},[i("div",le,[m(a,{icon:"fa-solid fa-plus",class:"icon"})]),i("div",de,I(e.$t("chatdoc.message.startNewChat")),1)]),(o(!0),c(R,null,U(e.conversations,(s,w)=>{var p;return o(),c("div",{key:w,class:O({conversation:!0,active:s.id===e.conversationId}),onClick:g=>e.onClick(s.id)},[i("div",ue,[m(a,{icon:"fa-regular fa-comment",class:"icon"})]),i("div",pe,[s!=null&&s.deleting?(o(),c("span",he,I(`${e.$t("chatdoc.message.confirmDelete")}?`),1)):s!=null&&s.editing?(o(),c("span",me,[m(_,{modelValue:s.title,"onUpdate:modelValue":g=>s.title=g,onKeydown:B(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",_e,I((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",ge,[!(s!=null&&s.editing)&&!s.deleting?(o(),h(a,{key:0,icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:C(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:C(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:C(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:C(g=>{s.editing=!1,s.deleting=!1},["stop"])},null,8,["onClick"])):f("v-if",!0)])],10,ce)}),128))]))])}var ye=k(ne,[["render",fe],["__scopeId","data-v-2282a6e1"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/Conversations.vue"]]);const $e=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()}}}),we={class:"box"};function Ce(e,t,n,d,r,y){return o(),c("div",we)}var Ie=k($e,[["render",Ce],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/AnsweringMark.vue"]]);const ke=E({name:"Message",components:{CopyToClipboard:oe,AnsweringMark:Ie,MarkdownRenderer:G,ElAlert:ee,ElButton:se},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 A:return this.$t("chatdoc.message.errorUsedUp");case Y:return this.$t("chatdoc.message.errorApiError");case J:return this.$t("chatdoc.message.errorBadRequest");case x:return this.$t("chatdoc.message.errorTimeout");case Q:return this.$t("chatdoc.message.errorTooManyRequests");case W:return this.$t("chatdoc.message.errorContentTooLarge");case V:return this.$t("chatdoc.message.errorNotApplied");case D:default:return this.$t("chatdoc.message.errorUnknown")}},showBuyMore(){var e;return this.message.role===N&&((e=this.message.error)==null?void 0:e.code)===A}},methods:{onCopy(){F(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){}}}),Ee=["role"],Ne={class:"content"},Re={class:"operations"};function ve(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"),w=l("el-button");return o(),c(R,null,[i("div",{class:O({message:!0,[e.message.role]:!0,hidden:e.errorText&&e.message.role==="assistant"}),role:e.message.role},[i("div",Ne,[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",Re,[m(_,{content:e.message.content,class:"btn-copy"},null,8,["content"])])],10,Ee),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(w,{key:1,round:"",type:"primary",class:"btn btn-buy",size:"small",onClick:e.onBuyMore},{default:L(()=>[te(I(e.$t("common.button.buyMore")),1)]),_:1},8,["onClick"])):f("v-if",!0)],64)}var Se=k(ke,[["render",ve],["__scopeId","data-v-95a62450"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/Message.vue"]]);const Oe=E({name:"InputBox",components:{ElInput:M,FontAwesomeIcon:T},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")}}}),be={class:"input-box"},Ae={class:"info"};function Te(e,t,n,d,r,y){const u=l("font-awesome-icon"),a=l("el-input");return o(),c(R,null,[i("div",be,[i("span",{class:O({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:B(C(e.onSubmit,["exact","prevent"]),["enter"])},null,8,["modelValue","disabled","placeholder","onKeydown"])]),i("p",Ae,I(e.$t("chat.message.howToUse")),1)],64)}var qe=k(Oe,[["render",Te],["__scopeId","data-v-7ed35c20"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/InputBox.vue"]]);const De=E({name:"ChatdocConversation",components:{Layout:P,Conversations:ye,Message:Se,InputBox:qe,ApplicationStatus:j},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.log("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.getApplication===b.Success&&!this.application},initializing(){return this.$store.state.chatdoc.status.getApplication===b.Request},service(){return this.$store.state.chatdoc.service}},async mounted(){console.log("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:K}),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(v(this.onFetchAnswer,"validated",t),this.question="",!e||!t){console.error("no token or endpoint or question"),this.messages.push({error:{code:V},role:N,state:$.FAILED});return}let n=this.conversationId;this.messages.push({content:"",role:N,state:$.PENDING}),v(this.onFetchAnswer,"start to get answer",this.messages),this.onScrollDown(),this.answering=!0,S.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()=>{v(this.onFetchAnswer,"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.log("push to conversation",n),await this.$router.push({name:q,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),z.isCancel(r))this.messages[this.messages.length-1].error={code:X};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;ie(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:D});this.answering=!1})}}}),Ve={class:"wrapper"},Me={class:"chat"},Ue={class:"status"},Be={class:"dialogue"},Le={class:"messages"},Fe={class:"bottom"};function Pe(e,t,n,d,r,y){const u=l("conversations"),a=l("application-status"),_=l("message"),s=l("input-box"),w=l("layout");return o(),h(w,null,{chatdoc:L(()=>[i("div",Ve,[m(u,{class:"side"}),i("div",Me,[i("div",Ue,[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/getApplication"))},null,8,["initializing","application","need-apply","service"])]),i("div",Be,[i("div",Le,[(o(!0),c(R,null,U(e.messages,(p,g)=>(o(),h(_,{key:g,message:p,class:"message"},null,8,["message"]))),128))])]),i("div",Fe,[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 Ze=k(De,[["render",Pe],["__scopeId","data-v-24089614"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chatdoc/Conversation.vue"]]);export{Ze as default};
|
|
1
|
+
import{av as T,au as F}from"./vendor-others.5383d97e.js";import{L as P}from"./Chatdoc.4ff43c51.js";import{W as H,X as S,l as q,_ as k,x as N,F as b,H as K,Y as v}from"./index.988c94f7.js";import{a as z}from"./vendor-axios.168e6950.js";import{M as G,E as D,a as V,b as W,c as Q,d as x,e as J,f as Y,g as A,A as j,h as X}from"./Status.976901eb.js";import{K as M,u as Z,x as ee,f as se}from"./vendor-element-plus.7e649a36.js";import{H as E,al as l,o,e as c,L as h,f as i,V as m,U as I,W as R,ai as U,Q as O,as as B,S as f,$ as C,M as L,T as te}from"./vendor-@vue.b5394076.js";import{C as oe}from"./CopyToClipboard.6cf34500.js";import{i as ie}from"./is.dd611415.js";import"./vendor-highlight.js.40bb9ea2.js";import"./application.ea1e2a72.js";var $=(e=>(e.PENDING="pending",e.ANSWERING="answering",e.FINISHED="finished",e.FAILED="failed",e))($||{});const ne=E({name:"SidePanel",components:{ElInput:M,FontAwesomeIcon:T,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:H,params:{repositoryId:this.repositoryId}})},async onConfirm(e){e!=null&&e.deleting?(await S.deleteConversation(e.id),await this.$store.dispatch("chat/getConversations")):e!=null&&e.editing?(await S.updateConversation(e),await this.$store.dispatch("chat/getConversations")):e.editing=!0},onClick(e){!e||(this.$router.push({name:q,params:{repositoryId:this.repositoryId,conversationId:e}}),this.$emit("click",e))}}}),ae={class:"panel"},re={key:1,class:"conversations"},le={class:"icons"},de={class:"title"},ce=["onClick"],ue={class:"icons"},pe={class:"title"},he={key:0},me={key:1},_e={key:2},ge={class:"operations"};function fe(e,t,n,d,r,y){const u=l("el-skeleton"),a=l("font-awesome-icon"),_=l("el-input");return o(),c("div",ae,[e.conversations===void 0?(o(),h(u,{key:0})):(o(),c("div",re,[i("div",{class:"conversation",onClick:t[0]||(t[0]=(...s)=>e.onNewConversation&&e.onNewConversation(...s))},[i("div",le,[m(a,{icon:"fa-solid fa-plus",class:"icon"})]),i("div",de,I(e.$t("chatdoc.message.startNewChat")),1)]),(o(!0),c(R,null,U(e.conversations,(s,w)=>{var p;return o(),c("div",{key:w,class:O({conversation:!0,active:s.id===e.conversationId}),onClick:g=>e.onClick(s.id)},[i("div",ue,[m(a,{icon:"fa-regular fa-comment",class:"icon"})]),i("div",pe,[s!=null&&s.deleting?(o(),c("span",he,I(`${e.$t("chatdoc.message.confirmDelete")}?`),1)):s!=null&&s.editing?(o(),c("span",me,[m(_,{modelValue:s.title,"onUpdate:modelValue":g=>s.title=g,onKeydown:B(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",_e,I((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",ge,[!(s!=null&&s.editing)&&!s.deleting?(o(),h(a,{key:0,icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:C(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:C(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:C(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:C(g=>{s.editing=!1,s.deleting=!1},["stop"])},null,8,["onClick"])):f("v-if",!0)])],10,ce)}),128))]))])}var ye=k(ne,[["render",fe],["__scopeId","data-v-2282a6e1"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/Conversations.vue"]]);const $e=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()}}}),we={class:"box"};function Ce(e,t,n,d,r,y){return o(),c("div",we)}var Ie=k($e,[["render",Ce],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/AnsweringMark.vue"]]);const ke=E({name:"Message",components:{CopyToClipboard:oe,AnsweringMark:Ie,MarkdownRenderer:G,ElAlert:ee,ElButton:se},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 A:return this.$t("chatdoc.message.errorUsedUp");case Y:return this.$t("chatdoc.message.errorApiError");case J:return this.$t("chatdoc.message.errorBadRequest");case x:return this.$t("chatdoc.message.errorTimeout");case Q:return this.$t("chatdoc.message.errorTooManyRequests");case W:return this.$t("chatdoc.message.errorContentTooLarge");case V:return this.$t("chatdoc.message.errorNotApplied");case D:default:return this.$t("chatdoc.message.errorUnknown")}},showBuyMore(){var e;return this.message.role===N&&((e=this.message.error)==null?void 0:e.code)===A}},methods:{onCopy(){F(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){}}}),Ee=["role"],Ne={class:"content"},Re={class:"operations"};function ve(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"),w=l("el-button");return o(),c(R,null,[i("div",{class:O({message:!0,[e.message.role]:!0,hidden:e.errorText&&e.message.role==="assistant"}),role:e.message.role},[i("div",Ne,[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",Re,[m(_,{content:e.message.content,class:"btn-copy"},null,8,["content"])])],10,Ee),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(w,{key:1,round:"",type:"primary",class:"btn btn-buy",size:"small",onClick:e.onBuyMore},{default:L(()=>[te(I(e.$t("common.button.buyMore")),1)]),_:1},8,["onClick"])):f("v-if",!0)],64)}var Se=k(ke,[["render",ve],["__scopeId","data-v-95a62450"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/Message.vue"]]);const Oe=E({name:"InputBox",components:{ElInput:M,FontAwesomeIcon:T},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")}}}),be={class:"input-box"},Ae={class:"info"};function Te(e,t,n,d,r,y){const u=l("font-awesome-icon"),a=l("el-input");return o(),c(R,null,[i("div",be,[i("span",{class:O({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:B(C(e.onSubmit,["exact","prevent"]),["enter"])},null,8,["modelValue","disabled","placeholder","onKeydown"])]),i("p",Ae,I(e.$t("chat.message.howToUse")),1)],64)}var qe=k(Oe,[["render",Te],["__scopeId","data-v-7ed35c20"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/InputBox.vue"]]);const De=E({name:"ChatdocConversation",components:{Layout:P,Conversations:ye,Message:Se,InputBox:qe,ApplicationStatus:j},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.log("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.getApplication===b.Success&&!this.application},initializing(){return this.$store.state.chatdoc.status.getApplication===b.Request},service(){return this.$store.state.chatdoc.service}},async mounted(){console.log("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:K}),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(v(this.onFetchAnswer,"validated",t),this.question="",!e||!t){console.error("no token or endpoint or question"),this.messages.push({error:{code:V},role:N,state:$.FAILED});return}let n=this.conversationId;this.messages.push({content:"",role:N,state:$.PENDING}),v(this.onFetchAnswer,"start to get answer",this.messages),this.onScrollDown(),this.answering=!0,S.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()=>{v(this.onFetchAnswer,"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.log("push to conversation",n),await this.$router.push({name:q,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),z.isCancel(r))this.messages[this.messages.length-1].error={code:X};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;ie(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:D});this.answering=!1})}}}),Ve={class:"wrapper"},Me={class:"chat"},Ue={class:"status"},Be={class:"dialogue"},Le={class:"messages"},Fe={class:"bottom"};function Pe(e,t,n,d,r,y){const u=l("conversations"),a=l("application-status"),_=l("message"),s=l("input-box"),w=l("layout");return o(),h(w,null,{chatdoc:L(()=>[i("div",Ve,[m(u,{class:"side"}),i("div",Me,[i("div",Ue,[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/getApplication"))},null,8,["initializing","application","need-apply","service"])]),i("div",Be,[i("div",Le,[(o(!0),c(R,null,U(e.messages,(p,g)=>(o(),h(_,{key:g,message:p,class:"message"},null,8,["message"]))),128))])]),i("div",Fe,[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 Ze=k(De,[["render",Pe],["__scopeId","data-v-24089614"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chatdoc/Conversation.vue"]]);export{Ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as X}from"./vendor-axios.168e6950.js";import{au as Z,av as O}from"./vendor-others.5383d97e.js";import{_ as k,I,x as T,u as x,y as ee,C as M,z as H,A as z,D as F,E as j,F as A,f as K,G as D,h as W,H as G}from"./index.09a5f2c2.js";import{H as b,o,e as l,al as a,f as r,L as g,W as S,ai as q,S as w,Q as E,M as $,T as te,U as y,V as n,O as se,aw as oe,a0 as ne,as as Q,$ as N,I as L}from"./vendor-@vue.b5394076.js";import{M as ae,E as J,a as Y,b as ie,c as re,d as le,e as ce,f as de,g as V,A as ue,h as pe}from"./Status.9fc5b6b1.js";import{C as me}from"./CopyToClipboard.4d3ebf45.js";import{x as he,f as U,k as _e,J as fe,G as B,h as ge,i as $e,n as ve,o as ye,K as we,u as Ce,e as ke}from"./vendor-element-plus.7e649a36.js";import{i as be}from"./is.dd611415.js";import"./vendor-highlight.js.40bb9ea2.js";import"./application.ea1e2a72.js";const Ee=b({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()}}}),Se={class:"box"};function Ie(e,t,u,h,v,c){return o(),l("div",Se)}var Ne=k(Ee,[["render",Ie],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/AnsweringMark.vue"]]);const qe=b({name:"Message",components:{CopyToClipboard:me,AnsweringMark:Ne,MarkdownRenderer:ae,ElAlert:he,ElButton:U},props:{message:{type:Object,required:!0},application:{type:Object,required:!0}},emits:["stop"],data(){return{copied:!1,messageState:I}},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 V:return this.$t("chat.message.errorUsedUp");case de:return this.$t("chat.message.errorApiError");case ce:return this.$t("chat.message.errorBadRequest");case le:return this.$t("chat.message.errorTimeout");case re:return this.$t("chat.message.errorTooManyRequests");case ie:return this.$t("chat.message.errorContentTooLarge");case Y:return this.$t("chat.message.errorNotApplied");case J:default:return this.$t("chat.message.errorUnknown")}},showBuyMore(){var e;return this.message.role===T&&((e=this.message.error)==null?void 0:e.code)===V}},methods:{onCopy(){Z(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){var e;this.$router.push({name:x,params:{id:(e=this.application)==null?void 0:e.id}})}}}),Oe=["role"],Re={class:"content"},Te={key:1},Ae=["src"],De={class:"operations"};function Me(e,t,u,h,v,c){var f;const d=a("markdown-renderer"),i=a("answering-mark"),m=a("copy-to-clipboard"),s=a("el-alert"),_=a("el-button");return o(),l(S,null,[r("div",{class:E({message:!0,[e.message.role]:!0,hidden:e.errorText&&e.message.role==="assistant"}),role:e.message.role},[r("div",Re,[Array.isArray(e.message.content)?(o(),l("div",Te,[(o(!0),l(S,null,q(e.message.content,(p,C)=>{var R;return o(),l("div",{key:C},[p.type==="image_url"?(o(),l("img",{key:0,src:(R=p.image_url)==null?void 0:R.url,fit:"cover",class:"image"},null,8,Ae)):w("v-if",!0),p.type==="text"?(o(),g(d,{key:C,content:p.text},null,8,["content"])):w("v-if",!0)])}),128))])):(o(),g(d,{key:0,content:(f=e.message)==null?void 0:f.content},null,8,["content"])),e.message.state===e.messageState.PENDING?(o(),g(i,{key:2})):w("v-if",!0)]),r("div",De,[Array.isArray(e.message.content)?w("v-if",!0):(o(),g(m,{key:0,content:e.message.content,class:"btn-copy"},null,8,["content"]))])],10,Oe),e.errorText?(o(),g(s,{key:0,class:"error",title:e.errorText,type:"error",closable:!1},null,8,["title"])):w("v-if",!0),e.showBuyMore?(o(),g(_,{key:1,round:"",type:"primary",class:"btn btn-buy",size:"small",onClick:e.onBuyMore},{default:$(()=>[te(y(e.$t("common.button.buyMore")),1)]),_:1},8,["onClick"])):w("v-if",!0)],64)}var Ue=k(qe,[["render",Me],["__scopeId","data-v-f0476f80"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Message.vue"]]);const Ge=b({name:"InputBox",components:{ElTooltip:_e,FontAwesomeIcon:O,ElUpload:fe},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"],data(){return{inputHeight:"35px",questionValue:this.question,fileList:[],uploadUrl:ee()+"/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})},canUpload(){return[M.name].includes(this.model.name)},model(){return this.$store.state.chat.model}},watch:{urls(e){this.$emit("update:references",e)},questionValue(e){this.$emit("update:question",e)},question(e){e!==this.questionValue&&(this.questionValue=e)},references(e){e.length===0&&(this.fileList=[])}},methods:{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")},onExceed(){B.warning(this.$t("chat.message.uploadReferencesExceed"))},onError(){B.error(this.$t("chat.message.uploadReferencesError"))}}}),Le={class:"input-box"},Ve={class:"btn btn-upload"},Be=["disabled","placeholder"],Pe={class:"info"};function He(e,t,u,h,v,c){const d=a("font-awesome-icon"),i=a("el-tooltip"),m=a("el-upload");return o(),l(S,null,[r("div",Le,[n(m,{"file-list":e.fileList,"onUpdate:file-list":t[0]||(t[0]=s=>e.fileList=s),class:E({upload:!0,disabled:!e.canUpload}),disabled:!e.canUpload,name:"file","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{default:$(()=>[n(i,{class:"box-item",effect:"dark",content:e.$t("chat.message.uploadFile"),placement:"top"},{default:$(()=>[r("span",Ve,[n(d,{icon:"fa-solid fa-paperclip",class:"icon icon-attachment"})])]),_:1},8,["content"])]),_:1},8,["file-list","class","disabled","action","on-exceed","on-error","headers"]),r("span",{class:E({btn:!0,"btn-send":!0,disabled:!e.questionValue}),onClick:t[1]||(t[1]=(...s)=>e.onSubmit&&e.onSubmit(...s))},[n(d,{icon:"fa-solid fa-location-arrow",class:"icon icon-send"})],2),w(" add this textarea "),se(r("textarea",{ref:"textarea","onUpdate:modelValue":t[2]||(t[2]=s=>e.questionValue=s),disabled:e.disabled,class:"input",placeholder:e.$t("chat.message.newMessagePlaceholder"),style:ne({height:e.inputHeight}),onKeydown:t[3]||(t[3]=Q(N((...s)=>e.onSubmit&&e.onSubmit(...s),["exact","prevent"]),["enter"])),onInput:t[4]||(t[4]=(...s)=>e.adjustTextareaHeight&&e.adjustTextareaHeight(...s))},null,44,Be),[[oe,e.questionValue]])]),r("p",Pe,y(e.$t("chat.message.howToUse")),1)],64)}var ze=k(Ge,[["render",He],["__scopeId","data-v-020f4eb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/InputBox.vue"]]);const P=[{label:"3.5",value:"base",icon:"fa-solid fa-bolt",options:[H,z]},{label:"4.0",value:"plus",icon:"fa-solid fa-wand-magic-sparkles",options:[F,j,M]}],Fe=b({name:"ModelSelector",components:{ElDropdown:ge,ElButton:U,ElDropdownItem:$e,FontAwesomeIcon:O},emits:["update:modelValue","select"],data(){var u;const e=this.$store.state.chat.model;return{activeGroup:(u=P.find(h=>h.options.find(v=>v.name===e.name)))==null?void 0:u.value,groups:P}},computed:{model(){const e=this.$store.state.chat.model.name;return[H,z,F,j,M].find(u=>u.name===e)}},methods:{onSwitchGroup(e){if(this.activeGroup===e.value)return;this.activeGroup=e.value;const t=e.options;t&&t.length>0&&(this.$emit("select",t[0]),this.$store.dispatch("chat/setModel",t[0]))},onCommandChange(e){this.$emit("select",e),this.$store.dispatch("chat/setModel",e)}}}),je={class:"model-selector"},Ke={key:0},We={key:1},Qe={class:"item"},Je={class:"icon"},Ye={class:"info"},Xe={class:"name"},Ze={class:"description"};function xe(e,t,u,h,v,c){const d=a("font-awesome-icon"),i=a("el-button"),m=a("el-dropdown-item"),s=a("el-dropdown-menu"),_=a("el-dropdown");return o(),l("div",je,[(o(!0),l(S,null,q(e.groups,(f,p)=>(o(),g(_,{key:p,trigger:"click","popper-class":"popper",onCommand:e.onCommandChange},{dropdown:$(()=>[n(s,{class:"menu"},{default:$(()=>[(o(!0),l(S,null,q(f.options,(C,R)=>(o(),g(m,{key:R,command:C,class:"option"},{default:$(()=>[r("div",Qe,[r("div",Je,[n(d,{icon:f.icon,class:E("icon "+f.value)},null,8,["icon","class"])]),r("div",Ye,[r("p",Xe,y(C.getDisplayName()),1),r("p",Ze,y(C.getDescription()),1)])])]),_:2},1032,["command"]))),128))]),_:2},1024)]),default:$(()=>[n(i,{class:E({group:!0,active:f.value===e.activeGroup}),onClick:C=>e.onSwitchGroup(f)},{default:$(()=>[n(d,{icon:f.icon,class:E("icon "+f.value)},null,8,["icon","class"]),f.value===e.activeGroup?(o(),l("span",Ke,y(e.model.getDisplayName()),1)):(o(),l("span",We,y(f.label),1)),n(d,{icon:"fa-solid fa-chevron-down"})]),_:2},1032,["class","onClick"])]),_:2},1032,["onCommand"]))),128))])}var et=k(Fe,[["render",xe],["__scopeId","data-v-358d65be"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/ModelSelector.vue"]]);const tt=b({name:"ConversationIntroductionItem",props:{content:{type:String,required:!0}},data(){return{}},computed:{}}),st={class:"introduction-item"};function ot(e,t,u,h,v,c){return o(),l("div",st,y(e.content),1)}var nt=k(tt,[["render",ot],["__scopeId","data-v-bc919b38"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/IntroductionItem.vue"]]);const at=b({name:"ConversationIntroduction",components:{FontAwesomeIcon:O,IntroductionItem:nt,ElRow:ve,ElCol:ye},emits:["draft"],data(){return{}},computed:{}}),it={class:"introduction"},rt={class:"text-center"},lt={class:"subtitle"},ct={class:"text-center"},dt={class:"subtitle"},ut={class:"text-center"},pt={class:"subtitle"};function mt(e,t,u,h,v,c){const d=a("font-awesome-icon"),i=a("introduction-item"),m=a("el-col"),s=a("el-row");return o(),l("div",it,[n(s,{class:"introduction-items",justify:"center",gutter:15},{default:$(()=>[n(m,{md:8,sm:24,xs:24},{default:$(()=>[r("div",rt,[n(d,{icon:"fa-regular fa-sun",class:"icon icon-rotate"})]),r("h3",lt,y(e.$t("chat.title.complexQuestion")),1),n(i,{content:e.$t("chat.message.question1"),class:"cursor-pointer",onClick:t[0]||(t[0]=_=>e.$emit("draft",e.$t("chat.message.question1")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question2"),class:"cursor-pointer",onClick:t[1]||(t[1]=_=>e.$emit("draft",e.$t("chat.message.question2")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question3"),class:"cursor-pointer",onClick:t[2]||(t[2]=_=>e.$emit("draft",e.$t("chat.message.question3")))},null,8,["content"])]),_:1}),n(m,{md:8,sm:24,xs:24},{default:$(()=>[r("div",ct,[n(d,{icon:"fa-solid fa-book",class:"icon icon-rotate"})]),r("h3",dt,y(e.$t("chat.title.professionalQuestion")),1),n(i,{content:e.$t("chat.message.question4"),class:"cursor-pointer",onClick:t[3]||(t[3]=_=>e.$emit("draft",e.$t("chat.message.question4")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question5"),class:"cursor-pointer",onClick:t[4]||(t[4]=_=>e.$emit("draft",e.$t("chat.message.question5")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question6"),class:"cursor-pointer",onClick:t[5]||(t[5]=_=>e.$emit("draft",e.$t("chat.message.question6")))},null,8,["content"])]),_:1}),n(m,{md:8,sm:24,xs:24},{default:$(()=>[r("div",ut,[n(d,{icon:"fa-solid fa-fire",class:"icon icon-rotate"})]),r("h3",pt,y(e.$t("chat.title.getTips")),1),n(i,{content:e.$t("chat.message.question7"),class:"cursor-pointer",onClick:t[6]||(t[6]=_=>e.$emit("draft",e.$t("chat.message.question7")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question8"),class:"cursor-pointer",onClick:t[7]||(t[7]=_=>e.$emit("draft",e.$t("chat.message.question8")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question9"),class:"cursor-pointer",onClick:t[8]||(t[8]=_=>e.$emit("draft",e.$t("chat.message.question9")))},null,8,["content"])]),_:1})]),_:1})])}var ht=k(at,[["render",mt],["__scopeId","data-v-52040931"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Introduction.vue"]]);const _t=b({name:"SidePanel",components:{ElInput:we,FontAwesomeIcon:O,ElSkeleton:Ce},props:{},emits:["click"],computed:{conversationId(){var e,t;return(t=(e=this.$route.params)==null?void 0:e.id)==null?void 0:t.toString()},conversations(){return this.$store.state.chat.conversations},application(){return this.$store.state.chat.application},loading(){return this.$store.state.chat.status.getConversations===A.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(){this.$router.push({name:K})},async onConfirm(e){const t=this.token;if(!t){console.error("Token is not found");return}e!=null&&e.deleting?(await D.deleteConversation(e.id,{token:t}),await this.$store.dispatch("chat/getConversations")):e!=null&&e.editing?(await D.updateConversation(e,{token:t}),await this.$store.dispatch("chat/getConversations")):e.editing=!0},onClick(e){!e||(this.$router.push({name:W,params:{id:e}}),this.$emit("click",e))}}}),ft={class:"panel"},gt={key:1,class:"conversations"},$t={class:"icons"},vt={class:"title"},yt=["onClick"],wt={class:"icons"},Ct={class:"title"},kt={key:0},bt={key:1},Et={key:2},St={class:"operations"};function It(e,t,u,h,v,c){const d=a("el-skeleton"),i=a("font-awesome-icon"),m=a("el-input");return o(),l("div",ft,[e.loading&&e.conversations===void 0?(o(),g(d,{key:0})):(o(),l("div",gt,[r("div",{class:"conversation",onClick:t[0]||(t[0]=(...s)=>e.onNewConversation&&e.onNewConversation(...s))},[r("div",$t,[n(i,{icon:"fa-solid fa-plus",class:"icon"})]),r("div",vt,y(e.$t("chat.message.startNewChat")),1)]),(o(!0),l(S,null,q(e.conversations,(s,_)=>{var f;return o(),l("div",{key:_,class:E({conversation:!0,active:s.id===e.conversationId}),onClick:p=>e.onClick(s.id)},[r("div",wt,[n(i,{icon:"fa-regular fa-comment",class:"icon"})]),r("div",Ct,[s!=null&&s.deleting?(o(),l("span",kt,y(`${e.$t("chat.message.confirmDelete")}?`),1)):s!=null&&s.editing?(o(),l("span",bt,[n(m,{modelValue:s.title,"onUpdate:modelValue":p=>s.title=p,onKeydown:Q(p=>e.onConfirm(s),["enter"])},null,8,["modelValue","onUpdate:modelValue","onKeydown"])])):(s==null?void 0:s.title)||(s==null?void 0:s.messages)?(o(),l("span",Et,y((s==null?void 0:s.title)||((f=s==null?void 0:s.messages[(s==null?void 0:s.messages.length)-1])==null?void 0:f.content)),1)):w("v-if",!0)]),r("div",St,[!(s!=null&&s.editing)&&!s.deleting?(o(),g(i,{key:0,icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:N(p=>s.editing=!0,["stop"])},null,8,["onClick"])):w("v-if",!0),!(s!=null&&s.editing)&&!s.deleting?(o(),g(i,{key:1,icon:"fa-solid fa-trash",class:"icon icon-delete",onClick:N(p=>s.deleting=!0,["stop"])},null,8,["onClick"])):w("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(o(),g(i,{key:2,icon:"fa-solid fa-check",class:"icon icon-confirm",onClick:N(p=>e.onConfirm(s),["stop"])},null,8,["onClick"])):w("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(o(),g(i,{key:3,icon:"fa-solid fa-xmark",class:"icon icon-cancel",onClick:N(p=>{s.editing=!1,s.deleting=!1},["stop"])},null,8,["onClick"])):w("v-if",!0)])],10,yt)}),128))]))])}var Nt=k(_t,[["render",It],["__scopeId","data-v-d866c834"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/SidePanel.vue"]]);const qt=b({name:"LayoutChat",components:{SidePanel:Nt,ElDrawer:ke,ElButton:U,FontAwesomeIcon:O},data(){return{drawer:!1}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onGetConversations()},methods:{async onGetService(){await this.$store.dispatch("chat/getService")},async onGetApplication(){await this.$store.dispatch("chat/getApplication")},async onGetConversations(){await this.$store.dispatch("chat/getConversations")}}}),Ot={class:"main"},Rt={class:"side"},Tt={class:"chat"};function At(e,t,u,h,v,c){const d=a("side-panel"),i=a("font-awesome-icon"),m=a("el-button"),s=a("el-drawer");return o(),l("div",Ot,[r("div",Rt,[L(e.$slots,"side",{},()=>[n(d)],!0)]),r("div",Tt,[L(e.$slots,"chat",{},void 0,!0)]),n(m,{round:"",class:"menu",onClick:t[0]||(t[0]=_=>e.drawer=!0)},{default:$(()=>[n(i,{icon:"fa-solid fa-bars",class:"icon-menu"})]),_:1}),n(s,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=_=>e.drawer=_),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[n(d)]),_:1},8,["modelValue"])])}var Dt=k(qt,[["render",At],["__scopeId","data-v-8d7a06d2"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Chat.vue"]]);const Mt=b({name:"ChatConversation",components:{InputBox:ze,Introduction:ht,ModelSelector:et,Message:Ue,ApplicationStatus:ue,Layout:Dt},data(){var e,t;return{question:"",references:[],answering:!1,messages:((t=(e=this.$store.state.chat.conversations)==null?void 0:e.find(u=>{var h;return u.id===((h=this.$route.params.id)==null?void 0:h.toString())}))==null?void 0:t.messages)||[]}},computed:{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},credential(){var e;return(e=this.$store.state.chat)==null?void 0:e.credential},needApply(){return this.$store.state.chat.status.getApplication===A.Success&&!this.application},conversations(){return this.$store.state.chat.conversations},initializing(){return this.$store.state.chat.status.getApplication===A.Request}},watch:{model(e){e&&this.onModelChanged()},conversationId(e){var t,u;e?(this.messages=((u=(t=this.conversations)==null?void 0:t.find(h=>h.id===e))==null?void 0:u.messages)||[],this.onScrollDown()):this.messages=[]}},mounted(){this.onScrollDown()},methods:{async onDraft(e){this.question=e,this.onSubmit()},async onCreateNewConversation(){await this.$router.push({name:K})},async onModelChanged(){await this.onCreateNewConversation(),await this.$store.dispatch("chat/getApplication")},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++)e.push({type:"image_url",image_url:this.references[t]});this.messages.push({content:e,role:G})}else this.messages.push({content:this.question,role:G});console.debug("onSubmit",this.question,this.references),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 v;const e=(v=this.credential)==null?void 0:v.token,t=this.question,u=this.references;if(console.debug("validated",t,u),this.question="",this.references=[],!e||!t){console.error("no token or endpoint or question"),this.messages.push({error:{code:Y},role:T,state:I.FAILED});return}let h=this.conversationId;this.messages.push({content:"",role:T,state:I.PENDING}),console.debug("start to get answer",this.messages),this.onScrollDown(),this.answering=!0,D.chatConversation({question:t,model:this.model.name,references:u,id:this.conversationId,stateful:!0},{token:e,stream:c=>{console.debug("stream response",c),this.messages[this.messages.length-1]={role:T,content:c.answer,state:I.ANSWERING},h=c==null?void 0:c.id,this.onScrollDown()}}).then(async()=>{console.debug("finished fetch answer",this.messages),this.messages[this.messages.length-1].state=I.FINISHED,await this.$store.dispatch("chat/setConversation",{id:h,messages:this.messages}),this.answering=!1,this.conversationId||await this.$router.push({name:W,params:{id:h}}),this.onScrollDown(),await this.$store.dispatch("chat/getConversations"),await this.$store.dispatch("chat/getApplication")}).catch(c=>{var d,i;if(this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].state=I.FAILED),console.error(c),X.isCancel(c))this.messages[this.messages.length-1].error={code:pe};else if((d=c==null?void 0:c.response)!=null&&d.data){let m=(i=c==null?void 0:c.response)==null?void 0:i.data;be(m)&&(m=JSON.parse(m)),this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error=m.error)}else this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error={code:J});this.answering=!1})}}}),Ut={class:"dialogue"},Gt={key:1,class:"messages"},Lt={class:"bottom"};function Vt(e,t,u,h,v,c){const d=a("model-selector"),i=a("application-status"),m=a("introduction"),s=a("message"),_=a("input-box"),f=a("layout");return o(),g(f,null,{chat:$(()=>[n(d,{class:"model-selector"}),n(i,{initializing:e.initializing,application:e.application,"need-apply":e.needApply,service:e.service,onRefresh:t[0]||(t[0]=p=>e.$store.dispatch("chat/getApplication"))},null,8,["initializing","application","need-apply","service"]),r("div",Ut,[e.messages.length===0?(o(),g(m,{key:0,onDraft:e.onDraft},null,8,["onDraft"])):(o(),l("div",Gt,[(o(!0),l(S,null,q(e.messages,(p,C)=>(o(),g(s,{key:C,message:p,application:e.application,class:"message"},null,8,["message","application"]))),128))]))]),r("div",Lt,[n(_,{disabled:e.answering,question:e.question,references:e.references,"onUpdate:question":t[1]||(t[1]=p=>e.question=p),"onUpdate:references":t[2]||(t[2]=p=>e.references=p),onSubmit:e.onSubmit},null,8,["disabled","question","references","onSubmit"])])]),_:1})}var Yt=k(Mt,[["render",Vt],["__scopeId","data-v-3ab2fb26"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chat/Conversation.vue"]]);export{Yt as default};
|
|
1
|
+
import{a as X}from"./vendor-axios.168e6950.js";import{au as Z,av as O}from"./vendor-others.5383d97e.js";import{_ as k,I,x as T,u as x,y as ee,C as M,z as H,A as z,D as F,E as j,F as A,f as K,G as D,h as W,H as G}from"./index.988c94f7.js";import{H as b,o,e as l,al as a,f as r,L as g,W as S,ai as q,S as w,Q as E,M as $,T as te,U as y,V as n,O as se,aw as oe,a0 as ne,as as Q,$ as N,I as L}from"./vendor-@vue.b5394076.js";import{M as ae,E as J,a as Y,b as ie,c as re,d as le,e as ce,f as de,g as V,A as ue,h as pe}from"./Status.976901eb.js";import{C as me}from"./CopyToClipboard.6cf34500.js";import{x as he,f as U,k as _e,J as fe,G as B,h as ge,i as $e,n as ve,o as ye,K as we,u as Ce,e as ke}from"./vendor-element-plus.7e649a36.js";import{i as be}from"./is.dd611415.js";import"./vendor-highlight.js.40bb9ea2.js";import"./application.ea1e2a72.js";const Ee=b({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()}}}),Se={class:"box"};function Ie(e,t,u,h,v,c){return o(),l("div",Se)}var Ne=k(Ee,[["render",Ie],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/AnsweringMark.vue"]]);const qe=b({name:"Message",components:{CopyToClipboard:me,AnsweringMark:Ne,MarkdownRenderer:ae,ElAlert:he,ElButton:U},props:{message:{type:Object,required:!0},application:{type:Object,required:!0}},emits:["stop"],data(){return{copied:!1,messageState:I}},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 V:return this.$t("chat.message.errorUsedUp");case de:return this.$t("chat.message.errorApiError");case ce:return this.$t("chat.message.errorBadRequest");case le:return this.$t("chat.message.errorTimeout");case re:return this.$t("chat.message.errorTooManyRequests");case ie:return this.$t("chat.message.errorContentTooLarge");case Y:return this.$t("chat.message.errorNotApplied");case J:default:return this.$t("chat.message.errorUnknown")}},showBuyMore(){var e;return this.message.role===T&&((e=this.message.error)==null?void 0:e.code)===V}},methods:{onCopy(){Z(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){var e;this.$router.push({name:x,params:{id:(e=this.application)==null?void 0:e.id}})}}}),Oe=["role"],Re={class:"content"},Te={key:1},Ae=["src"],De={class:"operations"};function Me(e,t,u,h,v,c){var f;const d=a("markdown-renderer"),i=a("answering-mark"),m=a("copy-to-clipboard"),s=a("el-alert"),_=a("el-button");return o(),l(S,null,[r("div",{class:E({message:!0,[e.message.role]:!0,hidden:e.errorText&&e.message.role==="assistant"}),role:e.message.role},[r("div",Re,[Array.isArray(e.message.content)?(o(),l("div",Te,[(o(!0),l(S,null,q(e.message.content,(p,C)=>{var R;return o(),l("div",{key:C},[p.type==="image_url"?(o(),l("img",{key:0,src:(R=p.image_url)==null?void 0:R.url,fit:"cover",class:"image"},null,8,Ae)):w("v-if",!0),p.type==="text"?(o(),g(d,{key:C,content:p.text},null,8,["content"])):w("v-if",!0)])}),128))])):(o(),g(d,{key:0,content:(f=e.message)==null?void 0:f.content},null,8,["content"])),e.message.state===e.messageState.PENDING?(o(),g(i,{key:2})):w("v-if",!0)]),r("div",De,[Array.isArray(e.message.content)?w("v-if",!0):(o(),g(m,{key:0,content:e.message.content,class:"btn-copy"},null,8,["content"]))])],10,Oe),e.errorText?(o(),g(s,{key:0,class:"error",title:e.errorText,type:"error",closable:!1},null,8,["title"])):w("v-if",!0),e.showBuyMore?(o(),g(_,{key:1,round:"",type:"primary",class:"btn btn-buy",size:"small",onClick:e.onBuyMore},{default:$(()=>[te(y(e.$t("common.button.buyMore")),1)]),_:1},8,["onClick"])):w("v-if",!0)],64)}var Ue=k(qe,[["render",Me],["__scopeId","data-v-f0476f80"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Message.vue"]]);const Ge=b({name:"InputBox",components:{ElTooltip:_e,FontAwesomeIcon:O,ElUpload:fe},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"],data(){return{inputHeight:"35px",questionValue:this.question,fileList:[],uploadUrl:ee()+"/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})},canUpload(){return[M.name].includes(this.model.name)},model(){return this.$store.state.chat.model}},watch:{urls(e){this.$emit("update:references",e)},questionValue(e){this.$emit("update:question",e)},question(e){e!==this.questionValue&&(this.questionValue=e)},references(e){e.length===0&&(this.fileList=[])}},methods:{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")},onExceed(){B.warning(this.$t("chat.message.uploadReferencesExceed"))},onError(){B.error(this.$t("chat.message.uploadReferencesError"))}}}),Le={class:"input-box"},Ve={class:"btn btn-upload"},Be=["disabled","placeholder"],Pe={class:"info"};function He(e,t,u,h,v,c){const d=a("font-awesome-icon"),i=a("el-tooltip"),m=a("el-upload");return o(),l(S,null,[r("div",Le,[n(m,{"file-list":e.fileList,"onUpdate:file-list":t[0]||(t[0]=s=>e.fileList=s),class:E({upload:!0,disabled:!e.canUpload}),disabled:!e.canUpload,name:"file","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{default:$(()=>[n(i,{class:"box-item",effect:"dark",content:e.$t("chat.message.uploadFile"),placement:"top"},{default:$(()=>[r("span",Ve,[n(d,{icon:"fa-solid fa-paperclip",class:"icon icon-attachment"})])]),_:1},8,["content"])]),_:1},8,["file-list","class","disabled","action","on-exceed","on-error","headers"]),r("span",{class:E({btn:!0,"btn-send":!0,disabled:!e.questionValue}),onClick:t[1]||(t[1]=(...s)=>e.onSubmit&&e.onSubmit(...s))},[n(d,{icon:"fa-solid fa-location-arrow",class:"icon icon-send"})],2),w(" add this textarea "),se(r("textarea",{ref:"textarea","onUpdate:modelValue":t[2]||(t[2]=s=>e.questionValue=s),disabled:e.disabled,class:"input",placeholder:e.$t("chat.message.newMessagePlaceholder"),style:ne({height:e.inputHeight}),onKeydown:t[3]||(t[3]=Q(N((...s)=>e.onSubmit&&e.onSubmit(...s),["exact","prevent"]),["enter"])),onInput:t[4]||(t[4]=(...s)=>e.adjustTextareaHeight&&e.adjustTextareaHeight(...s))},null,44,Be),[[oe,e.questionValue]])]),r("p",Pe,y(e.$t("chat.message.howToUse")),1)],64)}var ze=k(Ge,[["render",He],["__scopeId","data-v-020f4eb8"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/InputBox.vue"]]);const P=[{label:"3.5",value:"base",icon:"fa-solid fa-bolt",options:[H,z]},{label:"4.0",value:"plus",icon:"fa-solid fa-wand-magic-sparkles",options:[F,j,M]}],Fe=b({name:"ModelSelector",components:{ElDropdown:ge,ElButton:U,ElDropdownItem:$e,FontAwesomeIcon:O},emits:["update:modelValue","select"],data(){var u;const e=this.$store.state.chat.model;return{activeGroup:(u=P.find(h=>h.options.find(v=>v.name===e.name)))==null?void 0:u.value,groups:P}},computed:{model(){const e=this.$store.state.chat.model.name;return[H,z,F,j,M].find(u=>u.name===e)}},methods:{onSwitchGroup(e){if(this.activeGroup===e.value)return;this.activeGroup=e.value;const t=e.options;t&&t.length>0&&(this.$emit("select",t[0]),this.$store.dispatch("chat/setModel",t[0]))},onCommandChange(e){this.$emit("select",e),this.$store.dispatch("chat/setModel",e)}}}),je={class:"model-selector"},Ke={key:0},We={key:1},Qe={class:"item"},Je={class:"icon"},Ye={class:"info"},Xe={class:"name"},Ze={class:"description"};function xe(e,t,u,h,v,c){const d=a("font-awesome-icon"),i=a("el-button"),m=a("el-dropdown-item"),s=a("el-dropdown-menu"),_=a("el-dropdown");return o(),l("div",je,[(o(!0),l(S,null,q(e.groups,(f,p)=>(o(),g(_,{key:p,trigger:"click","popper-class":"popper",onCommand:e.onCommandChange},{dropdown:$(()=>[n(s,{class:"menu"},{default:$(()=>[(o(!0),l(S,null,q(f.options,(C,R)=>(o(),g(m,{key:R,command:C,class:"option"},{default:$(()=>[r("div",Qe,[r("div",Je,[n(d,{icon:f.icon,class:E("icon "+f.value)},null,8,["icon","class"])]),r("div",Ye,[r("p",Xe,y(C.getDisplayName()),1),r("p",Ze,y(C.getDescription()),1)])])]),_:2},1032,["command"]))),128))]),_:2},1024)]),default:$(()=>[n(i,{class:E({group:!0,active:f.value===e.activeGroup}),onClick:C=>e.onSwitchGroup(f)},{default:$(()=>[n(d,{icon:f.icon,class:E("icon "+f.value)},null,8,["icon","class"]),f.value===e.activeGroup?(o(),l("span",Ke,y(e.model.getDisplayName()),1)):(o(),l("span",We,y(f.label),1)),n(d,{icon:"fa-solid fa-chevron-down"})]),_:2},1032,["class","onClick"])]),_:2},1032,["onCommand"]))),128))])}var et=k(Fe,[["render",xe],["__scopeId","data-v-358d65be"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/ModelSelector.vue"]]);const tt=b({name:"ConversationIntroductionItem",props:{content:{type:String,required:!0}},data(){return{}},computed:{}}),st={class:"introduction-item"};function ot(e,t,u,h,v,c){return o(),l("div",st,y(e.content),1)}var nt=k(tt,[["render",ot],["__scopeId","data-v-bc919b38"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/IntroductionItem.vue"]]);const at=b({name:"ConversationIntroduction",components:{FontAwesomeIcon:O,IntroductionItem:nt,ElRow:ve,ElCol:ye},emits:["draft"],data(){return{}},computed:{}}),it={class:"introduction"},rt={class:"text-center"},lt={class:"subtitle"},ct={class:"text-center"},dt={class:"subtitle"},ut={class:"text-center"},pt={class:"subtitle"};function mt(e,t,u,h,v,c){const d=a("font-awesome-icon"),i=a("introduction-item"),m=a("el-col"),s=a("el-row");return o(),l("div",it,[n(s,{class:"introduction-items",justify:"center",gutter:15},{default:$(()=>[n(m,{md:8,sm:24,xs:24},{default:$(()=>[r("div",rt,[n(d,{icon:"fa-regular fa-sun",class:"icon icon-rotate"})]),r("h3",lt,y(e.$t("chat.title.complexQuestion")),1),n(i,{content:e.$t("chat.message.question1"),class:"cursor-pointer",onClick:t[0]||(t[0]=_=>e.$emit("draft",e.$t("chat.message.question1")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question2"),class:"cursor-pointer",onClick:t[1]||(t[1]=_=>e.$emit("draft",e.$t("chat.message.question2")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question3"),class:"cursor-pointer",onClick:t[2]||(t[2]=_=>e.$emit("draft",e.$t("chat.message.question3")))},null,8,["content"])]),_:1}),n(m,{md:8,sm:24,xs:24},{default:$(()=>[r("div",ct,[n(d,{icon:"fa-solid fa-book",class:"icon icon-rotate"})]),r("h3",dt,y(e.$t("chat.title.professionalQuestion")),1),n(i,{content:e.$t("chat.message.question4"),class:"cursor-pointer",onClick:t[3]||(t[3]=_=>e.$emit("draft",e.$t("chat.message.question4")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question5"),class:"cursor-pointer",onClick:t[4]||(t[4]=_=>e.$emit("draft",e.$t("chat.message.question5")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question6"),class:"cursor-pointer",onClick:t[5]||(t[5]=_=>e.$emit("draft",e.$t("chat.message.question6")))},null,8,["content"])]),_:1}),n(m,{md:8,sm:24,xs:24},{default:$(()=>[r("div",ut,[n(d,{icon:"fa-solid fa-fire",class:"icon icon-rotate"})]),r("h3",pt,y(e.$t("chat.title.getTips")),1),n(i,{content:e.$t("chat.message.question7"),class:"cursor-pointer",onClick:t[6]||(t[6]=_=>e.$emit("draft",e.$t("chat.message.question7")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question8"),class:"cursor-pointer",onClick:t[7]||(t[7]=_=>e.$emit("draft",e.$t("chat.message.question8")))},null,8,["content"]),n(i,{content:e.$t("chat.message.question9"),class:"cursor-pointer",onClick:t[8]||(t[8]=_=>e.$emit("draft",e.$t("chat.message.question9")))},null,8,["content"])]),_:1})]),_:1})])}var ht=k(at,[["render",mt],["__scopeId","data-v-52040931"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/Introduction.vue"]]);const _t=b({name:"SidePanel",components:{ElInput:we,FontAwesomeIcon:O,ElSkeleton:Ce},props:{},emits:["click"],computed:{conversationId(){var e,t;return(t=(e=this.$route.params)==null?void 0:e.id)==null?void 0:t.toString()},conversations(){return this.$store.state.chat.conversations},application(){return this.$store.state.chat.application},loading(){return this.$store.state.chat.status.getConversations===A.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(){this.$router.push({name:K})},async onConfirm(e){const t=this.token;if(!t){console.error("Token is not found");return}e!=null&&e.deleting?(await D.deleteConversation(e.id,{token:t}),await this.$store.dispatch("chat/getConversations")):e!=null&&e.editing?(await D.updateConversation(e,{token:t}),await this.$store.dispatch("chat/getConversations")):e.editing=!0},onClick(e){!e||(this.$router.push({name:W,params:{id:e}}),this.$emit("click",e))}}}),ft={class:"panel"},gt={key:1,class:"conversations"},$t={class:"icons"},vt={class:"title"},yt=["onClick"],wt={class:"icons"},Ct={class:"title"},kt={key:0},bt={key:1},Et={key:2},St={class:"operations"};function It(e,t,u,h,v,c){const d=a("el-skeleton"),i=a("font-awesome-icon"),m=a("el-input");return o(),l("div",ft,[e.loading&&e.conversations===void 0?(o(),g(d,{key:0})):(o(),l("div",gt,[r("div",{class:"conversation",onClick:t[0]||(t[0]=(...s)=>e.onNewConversation&&e.onNewConversation(...s))},[r("div",$t,[n(i,{icon:"fa-solid fa-plus",class:"icon"})]),r("div",vt,y(e.$t("chat.message.startNewChat")),1)]),(o(!0),l(S,null,q(e.conversations,(s,_)=>{var f;return o(),l("div",{key:_,class:E({conversation:!0,active:s.id===e.conversationId}),onClick:p=>e.onClick(s.id)},[r("div",wt,[n(i,{icon:"fa-regular fa-comment",class:"icon"})]),r("div",Ct,[s!=null&&s.deleting?(o(),l("span",kt,y(`${e.$t("chat.message.confirmDelete")}?`),1)):s!=null&&s.editing?(o(),l("span",bt,[n(m,{modelValue:s.title,"onUpdate:modelValue":p=>s.title=p,onKeydown:Q(p=>e.onConfirm(s),["enter"])},null,8,["modelValue","onUpdate:modelValue","onKeydown"])])):(s==null?void 0:s.title)||(s==null?void 0:s.messages)?(o(),l("span",Et,y((s==null?void 0:s.title)||((f=s==null?void 0:s.messages[(s==null?void 0:s.messages.length)-1])==null?void 0:f.content)),1)):w("v-if",!0)]),r("div",St,[!(s!=null&&s.editing)&&!s.deleting?(o(),g(i,{key:0,icon:"fa-solid fa-edit",class:"icon icon-edit",onClick:N(p=>s.editing=!0,["stop"])},null,8,["onClick"])):w("v-if",!0),!(s!=null&&s.editing)&&!s.deleting?(o(),g(i,{key:1,icon:"fa-solid fa-trash",class:"icon icon-delete",onClick:N(p=>s.deleting=!0,["stop"])},null,8,["onClick"])):w("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(o(),g(i,{key:2,icon:"fa-solid fa-check",class:"icon icon-confirm",onClick:N(p=>e.onConfirm(s),["stop"])},null,8,["onClick"])):w("v-if",!0),(s==null?void 0:s.editing)||s.deleting?(o(),g(i,{key:3,icon:"fa-solid fa-xmark",class:"icon icon-cancel",onClick:N(p=>{s.editing=!1,s.deleting=!1},["stop"])},null,8,["onClick"])):w("v-if",!0)])],10,yt)}),128))]))])}var Nt=k(_t,[["render",It],["__scopeId","data-v-d866c834"],["__file","/home/runner/work/Nexior/Nexior/src/components/chat/SidePanel.vue"]]);const qt=b({name:"LayoutChat",components:{SidePanel:Nt,ElDrawer:ke,ElButton:U,FontAwesomeIcon:O},data(){return{drawer:!1}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onGetConversations()},methods:{async onGetService(){await this.$store.dispatch("chat/getService")},async onGetApplication(){await this.$store.dispatch("chat/getApplication")},async onGetConversations(){await this.$store.dispatch("chat/getConversations")}}}),Ot={class:"main"},Rt={class:"side"},Tt={class:"chat"};function At(e,t,u,h,v,c){const d=a("side-panel"),i=a("font-awesome-icon"),m=a("el-button"),s=a("el-drawer");return o(),l("div",Ot,[r("div",Rt,[L(e.$slots,"side",{},()=>[n(d)],!0)]),r("div",Tt,[L(e.$slots,"chat",{},void 0,!0)]),n(m,{round:"",class:"menu",onClick:t[0]||(t[0]=_=>e.drawer=!0)},{default:$(()=>[n(i,{icon:"fa-solid fa-bars",class:"icon-menu"})]),_:1}),n(s,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=_=>e.drawer=_),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[n(d)]),_:1},8,["modelValue"])])}var Dt=k(qt,[["render",At],["__scopeId","data-v-8d7a06d2"],["__file","/home/runner/work/Nexior/Nexior/src/layouts/Chat.vue"]]);const Mt=b({name:"ChatConversation",components:{InputBox:ze,Introduction:ht,ModelSelector:et,Message:Ue,ApplicationStatus:ue,Layout:Dt},data(){var e,t;return{question:"",references:[],answering:!1,messages:((t=(e=this.$store.state.chat.conversations)==null?void 0:e.find(u=>{var h;return u.id===((h=this.$route.params.id)==null?void 0:h.toString())}))==null?void 0:t.messages)||[]}},computed:{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},credential(){var e;return(e=this.$store.state.chat)==null?void 0:e.credential},needApply(){return this.$store.state.chat.status.getApplication===A.Success&&!this.application},conversations(){return this.$store.state.chat.conversations},initializing(){return this.$store.state.chat.status.getApplication===A.Request}},watch:{model(e){e&&this.onModelChanged()},conversationId(e){var t,u;e?(this.messages=((u=(t=this.conversations)==null?void 0:t.find(h=>h.id===e))==null?void 0:u.messages)||[],this.onScrollDown()):this.messages=[]}},mounted(){this.onScrollDown()},methods:{async onDraft(e){this.question=e,this.onSubmit()},async onCreateNewConversation(){await this.$router.push({name:K})},async onModelChanged(){await this.onCreateNewConversation(),await this.$store.dispatch("chat/getApplication")},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++)e.push({type:"image_url",image_url:this.references[t]});this.messages.push({content:e,role:G})}else this.messages.push({content:this.question,role:G});console.debug("onSubmit",this.question,this.references),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 v;const e=(v=this.credential)==null?void 0:v.token,t=this.question,u=this.references;if(console.debug("validated",t,u),this.question="",this.references=[],!e||!t){console.error("no token or endpoint or question"),this.messages.push({error:{code:Y},role:T,state:I.FAILED});return}let h=this.conversationId;this.messages.push({content:"",role:T,state:I.PENDING}),console.debug("start to get answer",this.messages),this.onScrollDown(),this.answering=!0,D.chatConversation({question:t,model:this.model.name,references:u,id:this.conversationId,stateful:!0},{token:e,stream:c=>{console.debug("stream response",c),this.messages[this.messages.length-1]={role:T,content:c.answer,state:I.ANSWERING},h=c==null?void 0:c.id,this.onScrollDown()}}).then(async()=>{console.debug("finished fetch answer",this.messages),this.messages[this.messages.length-1].state=I.FINISHED,await this.$store.dispatch("chat/setConversation",{id:h,messages:this.messages}),this.answering=!1,this.conversationId||await this.$router.push({name:W,params:{id:h}}),this.onScrollDown(),await this.$store.dispatch("chat/getConversations"),await this.$store.dispatch("chat/getApplication")}).catch(c=>{var d,i;if(this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].state=I.FAILED),console.error(c),X.isCancel(c))this.messages[this.messages.length-1].error={code:pe};else if((d=c==null?void 0:c.response)!=null&&d.data){let m=(i=c==null?void 0:c.response)==null?void 0:i.data;be(m)&&(m=JSON.parse(m)),this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error=m.error)}else this.messages&&this.messages.length>0&&(this.messages[this.messages.length-1].error={code:J});this.answering=!1})}}}),Ut={class:"dialogue"},Gt={key:1,class:"messages"},Lt={class:"bottom"};function Vt(e,t,u,h,v,c){const d=a("model-selector"),i=a("application-status"),m=a("introduction"),s=a("message"),_=a("input-box"),f=a("layout");return o(),g(f,null,{chat:$(()=>[n(d,{class:"model-selector"}),n(i,{initializing:e.initializing,application:e.application,"need-apply":e.needApply,service:e.service,onRefresh:t[0]||(t[0]=p=>e.$store.dispatch("chat/getApplication"))},null,8,["initializing","application","need-apply","service"]),r("div",Ut,[e.messages.length===0?(o(),g(m,{key:0,onDraft:e.onDraft},null,8,["onDraft"])):(o(),l("div",Gt,[(o(!0),l(S,null,q(e.messages,(p,C)=>(o(),g(s,{key:C,message:p,application:e.application,class:"message"},null,8,["message","application"]))),128))]))]),r("div",Lt,[n(_,{disabled:e.answering,question:e.question,references:e.references,"onUpdate:question":t[1]||(t[1]=p=>e.question=p),"onUpdate:references":t[2]||(t[2]=p=>e.references=p),onSubmit:e.onSubmit},null,8,["disabled","question","references","onSubmit"])])]),_:1})}var Yt=k(Mt,[["render",Vt],["__scopeId","data-v-3ab2fb26"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chat/Conversation.vue"]]);export{Yt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{av as p,au as s}from"./vendor-others.5383d97e.js";import{_ as r}from"./index.
|
|
1
|
+
import{av as p,au as s}from"./vendor-others.5383d97e.js";import{_ as r}from"./index.988c94f7.js";import{k as i}from"./vendor-element-plus.7e649a36.js";import{H as l,al as t,o as n,L as a,M as m,V as d}from"./vendor-@vue.b5394076.js";const _=l({name:"CopyToClipboard",components:{FontAwesomeIcon:p,ElTooltip:i},props:{content:{type:String,required:!0}},data(){return{copied:!1}},methods:{onCopy(){s(this.content,{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)}}});function f(o,u,C,y,k,v){const e=t("font-awesome-icon"),c=t("el-tooltip");return o.copied?(n(),a(c,{key:1,visible:o.copied,effect:"dark",content:o.$t("common.message.copied"),placement:"top-start"},{default:m(()=>[d(e,{icon:"fa-solid fa-check",class:"icon-check"})]),_:1},8,["visible","content"])):(n(),a(e,{key:0,icon:"fa-regular fa-copy",class:"icon-copy",onClick:o.onCopy},null,8,["onClick"]))}var w=r(_,[["render",f],["__scopeId","data-v-1ba27772"],["__file","/home/runner/work/Nexior/Nexior/src/components/common/CopyToClipboard.vue"]]);export{w as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as Y}from"./vendor-others.5383d97e.js";import{o as k}from"./order.
|
|
1
|
+
import{Q as Y}from"./vendor-others.5383d97e.js";import{o as k}from"./order.07f3bb12.js";import{_ as D}from"./index.988c94f7.js";import{O as P}from"./order.1bf5c3a2.js";import{E as z,n as H,o as U,f as Z,s as x,u as ee,w as te,x as ae,y as re,A as oe}from"./vendor-element-plus.7e649a36.js";import{H as E,al as l,o as r,L as c,M as t,V as a,f as m,S as n,U as i,aK as L,aL as Q,e as p,W as se,T as v,Q as j}from"./vendor-@vue.b5394076.js";import{I as ie}from"./application.ea1e2a72.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";const le=E({name:"PayOrderDialog",components:{ElDialog:z,QrCode:Y,ElRow:H,ElCol:U},props:{modelValue:{type:Object,required:!0},visible:{type:Boolean,required:!1,default:!1}},emits:["hide","update:modelValue"],data(){return{refreshTimer:void 0}},mounted(){this.onRefresh()},unmounted(){this.refreshTimer&&clearTimeout(this.refreshTimer)},methods:{onRefresh(){if(!this.modelValue.id){console.error("id does not exist");return}k.refresh(this.modelValue.id).then(({data:e})=>{e.state!==P.PAID?setTimeout(()=>{this.onRefresh()},2e3):this.$emit("hide"),this.$emit("update:modelValue",e)}).catch(()=>{setTimeout(()=>{this.onRefresh()},2e3)})}}}),de=e=>(L("data-v-875060be"),e=e(),Q(),e),ne={class:"paycode wechat"},pe={class:"help-text"},ue=de(()=>m("div",{class:"help-img"},[m("img",{src:"https://midas.gtimg.cn/enterprise/images/ep_sys_wx_tip.jpg"})],-1));function ye(e,o,I,T,C,O){const u=l("qr-code"),f=l("el-col"),W=l("el-row"),S=l("el-dialog");return r(),c(S,{"model-value":e.visible,title:e.$t("application.title.buyService"),width:"500px",center:""},{default:t(()=>[a(W,{class:"paycodes"},{default:t(()=>[a(f,{span:12},{default:t(()=>{var h,g;return[m("div",ne,[(h=e.modelValue)!=null&&h.pay_url?(r(),c(u,{key:0,value:(g=e.modelValue)==null?void 0:g.pay_url,size:200,class:"qrcode m-auto"},null,8,["value"])):n("v-if",!0),m("p",pe,i(e.$t("order.message.wechatPayHelp")),1)])]}),_:1}),a(f,{span:12},{default:t(()=>[ue]),_:1})]),_:1})]),_:1},8,["model-value","title"])}var ce=D(le,[["render",ye],["__scopeId","data-v-875060be"],["__file","/home/runner/work/Nexior/Nexior/src/components/order/WechatPay.vue"]]);const me=E({name:"PayOrderDialog",components:{ElDialog:z},props:{modelValue:{type:Object,required:!0},visible:{type:Boolean,required:!1,default:!1}},emits:["hide","update:modelValue"],data(){return{refreshTimer:void 0}},watch:{visible:{handler(e){e&&this.modelValue.pay_url&&window.open(this.modelValue.pay_url,"_blank")}}},mounted(){this.onRefresh()},unmounted(){this.refreshTimer&&clearTimeout(this.refreshTimer)},methods:{onRefresh(){if(!this.modelValue.id){console.error("id does not exist");return}k.refresh(this.modelValue.id).then(({data:e})=>{e.state!==P.PAID?setTimeout(()=>{this.onRefresh()},2e3):this.$emit("hide"),this.$emit("update:modelValue",e)}).catch(()=>{setTimeout(()=>{this.onRefresh()},5e3)})}}}),fe={class:"text-center"};function he(e,o,I,T,C,O){const u=l("el-dialog");return r(),c(u,{"model-value":e.visible,title:e.$t("application.title.buyService"),width:"500px",center:""},{default:t(()=>[m("p",fe,i(e.$t("order.message.buyInExternalUrl")),1)]),_:1},8,["model-value","title"])}var _e=D(me,[["render",he],["__scopeId","data-v-85959ecc"],["__file","/home/runner/work/Nexior/Nexior/src/components/order/StripePay.vue"]]);var G=(e=>(e.WechatPay="WechatPay",e.Stripe="Stripe",e.AliPay="AliPay",e))(G||{});const ve=E({name:"ConsoleOrderDetail",components:{ElButton:Z,ElRow:H,ElCard:x,ElCol:U,ElSkeleton:ee,ElDivider:te,ElAlert:ae,ElDescriptions:re,ElDescriptionsItem:oe,WechatPayOrder:ce,StripePayOrder:_e},data(){return{PayWay:G,payWay:"WechatPay",OrderState:P,order:void 0,loading:!1,paying:!1,prepaying:!1,applicationType:ie}},computed:{id(){var e,o;return(o=(e=this.$route.params)==null?void 0:e.id)==null?void 0:o.toString()},redirect(){var e;return(e=this.$route.query)==null?void 0:e.redirect}},watch:{order:{handler(e){if((e==null?void 0:e.state)===P.PAID){setTimeout(()=>{var o;this.redirect&&window.location.replace((o=this.redirect)==null?void 0:o.toString())},2e3);return}},deep:!0}},mounted(){this.onFetchData()},methods:{onFetchData(){this.loading=!0,k.refresh(this.id).then(({data:e})=>{this.order=e,e.pay_way&&(this.payWay=e.pay_way),this.loading=!1}).catch(()=>{this.loading=!1})},onRepay(){this.paying=!0},onPay(){this.prepaying=!0,k.pay(this.id,{pay_way:this.payWay}).then(({data:e})=>{this.prepaying=!1,this.order=e,this.order.price&&this.order.price>0&&(this.paying=!0)}).catch(()=>{this.prepaying=!1})}}}),K=e=>(L("data-v-2d1dc98e"),e=e(),Q(),e),$e={class:"title"},be={key:0,class:"pt-5"},ge={key:1,class:"order"},we={key:0},ke={key:1},Pe={key:0,class:"price unfree"},We={key:1,class:"price free"},Se={key:0,class:"payways mb-6"},Ve=K(()=>m("span",{class:"payicon wechatpay"},null,-1)),De={class:"payname"},Ee=K(()=>m("span",{class:"payicon stripe"},null,-1)),Ie={class:"payname"},Te={key:1},Ce={key:2};function Oe(e,o,I,T,C,O){const u=l("el-col"),f=l("el-row"),W=l("el-skeleton"),S=l("copy-to-clipboard"),h=l("el-descriptions-item"),g=l("el-descriptions"),V=l("el-divider"),N=l("el-alert"),R=l("el-button"),M=l("el-card"),X=l("wechat-pay-order"),J=l("stripe-pay-order");return r(),p(se,null,[a(f,{class:"panel"},{default:t(()=>[a(u,{span:24},{default:t(()=>[a(f,null,{default:t(()=>[a(u,{span:24},{default:t(()=>[m("h2",$e,i(e.$t("order.title.info")),1)]),_:1})]),_:1}),a(f,null,{default:t(()=>[a(u,{span:24},{default:t(()=>[a(M,{shadow:"hover"},{default:t(()=>{var _,A,q,B;return[a(f,null,{default:t(()=>[a(u,{span:14,offset:5},{default:t(()=>[e.loading?(r(),p("div",be,[a(W,{animated:""})])):(r(),p("div",ge,[a(g,{column:1},{default:t(()=>{var $,w,F;return[a(h,{label:e.$t("order.field.id")},{default:t(()=>{var s,d,y;return[m("span",null,i((s=e.order)==null?void 0:s.id),1),(d=e.order)!=null&&d.id?(r(),c(S,{key:0,content:(y=e.order)==null?void 0:y.id,class:"inline-block"},null,8,["content"])):n("v-if",!0)]}),_:1},8,["label"]),a(h,{label:e.$t("order.field.description")},{default:t(()=>{var s;return[v(i((s=e.order)==null?void 0:s.description),1)]}),_:1},8,["label"]),(w=($=e.order)==null?void 0:$.application)!=null&&w.service?(r(),c(h,{key:0,label:e.$t("order.field.api")},{default:t(()=>{var s,d,y;return[v(i((y=(d=(s=e.order)==null?void 0:s.application)==null?void 0:d.service)==null?void 0:y.title),1)]}),_:1},8,["label"])):n("v-if",!0),(F=e.order)!=null&&F.pay_way?(r(),c(h,{key:1,label:e.$t("order.field.payWay")},{default:t(()=>{var s,d;return[((s=e.order)==null?void 0:s.pay_way)===e.PayWay.WechatPay?(r(),p("span",we,i(e.$t("order.title.wechatPay")),1)):n("v-if",!0),((d=e.order)==null?void 0:d.pay_way)===e.PayWay.Stripe?(r(),p("span",ke,i(e.$t("order.title.stripe")),1)):n("v-if",!0)]}),_:1},8,["label"])):n("v-if",!0),a(h,{label:e.$t("order.field.amount")},{default:t(()=>{var s,d,y,b;return[v(i((s=e.order)==null?void 0:s.amount)+" "+i(e.$t(`service.unit.${(b=(y=(d=e.order)==null?void 0:d.application)==null?void 0:y.service)==null?void 0:b.unit}`)),1)]}),_:1},8,["label"]),a(h,{label:e.$t("order.field.createdAt")},{default:t(()=>{var s;return[v(i(e.$dayjs.format((s=e.order)==null?void 0:s.created_at)),1)]}),_:1},8,["label"]),a(h,{label:e.$t("order.field.price")},{default:t(()=>{var s,d,y,b;return[((s=e.order)==null?void 0:s.price)&&((d=e.order)==null?void 0:d.price)>0?(r(),p("span",Pe," $"+i((b=(y=e.order)==null?void 0:y.price)==null?void 0:b.toFixed(2)),1)):(r(),p("span",We,i(e.$t("order.message.free")),1))]}),_:1},8,["label"])]}),_:1})]))]),_:1})]),_:1}),((_=e.order)==null?void 0:_.state)===e.OrderState.PAID?(r(),c(f,{key:0,class:"mb-5"},{default:t(()=>[a(u,{span:14,offset:5},{default:t(()=>[a(V,{"border-style":"dashed"}),a(N,{title:e.$t("order.message.paidSuccessfully"),type:"success","show-icon":"",closable:!1},null,8,["title"])]),_:1})]),_:1})):n("v-if",!0),((A=e.order)==null?void 0:A.state)===e.OrderState.EXPIRED?(r(),c(f,{key:1,class:"mb-5"},{default:t(()=>[a(u,{span:14,offset:5},{default:t(()=>[a(V,{"border-style":"dashed"}),a(N,{title:e.$t("order.message.orderExpired"),type:"error","show-icon":"",closable:!1},null,8,["title"])]),_:1})]),_:1})):n("v-if",!0),((q=e.order)==null?void 0:q.state)===e.OrderState.PENDING||((B=e.order)==null?void 0:B.state)===e.OrderState.FAILED?(r(),c(f,{key:2},{default:t(()=>[a(u,{span:14,offset:5},{default:t(()=>{var $;return[a(V,{"border-style":"dashed"}),e.order.price&&e.order.price>0&&!e.order.pay_way?(r(),p("div",Se,[(r(),p("div",{key:0,class:j({payway:!0,wechatpay:!0,active:e.payWay===e.PayWay.WechatPay}),onClick:o[0]||(o[0]=w=>e.payWay=e.PayWay.WechatPay)},[Ve,m("span",De,i(e.$t("order.title.wechatPay")),1)],2)),n("v-if",!0),(r(),p("div",{key:2,class:j({payway:!0,stripe:!0,active:e.payWay===e.PayWay.Stripe}),onClick:o[2]||(o[2]=w=>e.payWay=e.PayWay.Stripe)},[Ee,m("span",Ie,i(e.$t("order.title.stripe")),1)],2))])):n("v-if",!0),($=e.order)!=null&&$.pay_way?(r(),p("div",Ce,[a(R,{type:"primary",round:"",size:"large",class:"btn-repay",onClick:e.onRepay},{default:t(()=>[v(i(e.$t("common.button.repay")),1)]),_:1},8,["onClick"])])):(r(),p("div",Te,[a(R,{loading:e.prepaying,round:"",type:"primary",size:"large",class:"btn-pay",onClick:e.onPay},{default:t(()=>[v(i(e.$t("common.button.pay")),1)]),_:1},8,["loading","onClick"])]))]}),_:1})]),_:1})):n("v-if",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),e.order&&e.payWay===e.PayWay.WechatPay?(r(),c(X,{key:0,modelValue:e.order,"onUpdate:modelValue":o[3]||(o[3]=_=>e.order=_),visible:e.paying,onHide:o[4]||(o[4]=_=>e.paying=!1)},null,8,["modelValue","visible"])):n("v-if",!0),e.order&&e.payWay===e.PayWay.Stripe?(r(),c(J,{key:1,modelValue:e.order,"onUpdate:modelValue":o[5]||(o[5]=_=>e.order=_),visible:e.paying,onHide:o[6]||(o[6]=_=>e.paying=!1)},null,8,["modelValue","visible"])):n("v-if",!0)],64)}var Ue=D(ve,[["render",Oe],["__scopeId","data-v-2d1dc98e"],["__file","/home/runner/work/Nexior/Nexior/src/pages/console/order/Detail.vue"]]);export{Ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{av as C}from"./vendor-others.5383d97e.js";import{T as I,M as A}from"./TaskPreview.
|
|
1
|
+
import{av as C}from"./vendor-others.5383d97e.js";import{T as I,M as A}from"./TaskPreview.7365885a.js";import{A as N}from"./Status.976901eb.js";import{F as h,_ as k,i as S,N as b}from"./index.988c94f7.js";import{P as E}from"./Pagination.94774787.js";import{u as R,M as F,s as L,f as G,G as g}from"./vendor-element-plus.7e649a36.js";import{H as f,al as o,o as n,e as a,W as d,ai as y,f as M,V as s,M as _,T as q,U as z}from"./vendor-@vue.b5394076.js";import"./CopyToClipboard.6cf34500.js";import"./application.ea1e2a72.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";const B=f({name:"TaskFullList",components:{TaskPreview:I,Pagination:E,ElSkeleton:R,ElSkeletonItem:F,ElCard:L},emits:["update:modelValue","custom","refresh"],data(){return{job:void 0}},computed:{page(){var e;return parseInt(((e=this.$route.query.page)==null?void 0:e.toString())||"1")},total(){return this.$store.state.midjourney.imagineTasksTotal},offset(){return(this.page-1)*this.limit},limit(){return 12},loading(){return this.$store.state.midjourney.status.getApplication===h.Request},tasks(){return this.$store.state.midjourney.imagineTasks},application(){return this.$store.state.midjourney.application}},watch:{page:{async handler(){await this.$store.dispatch("midjourney/setImagineTasks",void 0),this.getImagineTasks()}},tasks:{handler(e,t){e&&t&&JSON.stringify(e)!==JSON.stringify(t)&&this.$emit("refresh",e)},deep:!0}},async mounted(){await this.$store.dispatch("midjourney/setImagineTasks",void 0),this.getImagineTasks(),this.job=setInterval(()=>{this.getImagineTasks()},5e3)},unmounted(){clearInterval(this.job)},methods:{onPageChange(e){var t;this.$router.push({name:(t=this.$route.name)==null?void 0:t.toString(),query:{page:e}})},async onCustom(e){this.$emit("custom",e),setTimeout(()=>{var t;this.$router.push({name:(t=this.$route.name)==null?void 0:t.toString(),query:{page:1}})},3e3)},async getImagineTasks(){this.loading||await this.$store.dispatch("midjourney/getImagineTasks",{limit:this.limit,offset:this.offset})}}}),O={key:0,class:"tasks"},P={key:1,class:"tasks"},H={class:"pagination"};function U(e,t,i,$,v,j){const l=o("task-preview"),r=o("el-skeleton-item"),u=o("el-skeleton"),c=o("el-card"),m=o("pagination");return n(),a(d,null,[e.tasks?(n(),a("div",O,[(n(!0),a(d,null,y(e.tasks,(p,T)=>(n(),a("div",{key:T,class:"task"},[s(l,{full:!0,"model-value":p,onCustom:t[0]||(t[0]=w=>e.onCustom(w))},null,8,["model-value"])]))),128))])):(n(),a("div",P,[(n(),a(d,null,y(12,p=>s(c,{key:p,class:"task"},{default:_(()=>[s(u,{animated:""},{template:_(()=>[s(r,{variant:"image",class:"icon-placeholder"}),s(r,{variant:"p",class:"title-placeholder"})]),_:1})]),_:2},1024)),64))])),M("div",H,[s(m,{"current-page":e.page,"page-size":e.limit,total:e.total,onChange:e.onPageChange},null,8,["current-page","page-size","total","onChange"])])],64)}var V=k(B,[["render",U],["__scopeId","data-v-03ba638a"],["__file","/home/runner/work/Nexior/Nexior/src/components/midjourney/tasks/TaskFullList.vue"]]);const D="https://webhook.acedata.cloud/midjourney",J=f({name:"MidjourneyIndex",components:{TaskFullList:V,ModeSelector:A,ApplicationStatus:N,ElButton:G,FontAwesomeIcon:C},data(){return{prompt:"",elements:[],ignore:""}},computed:{mode(){return this.$store.state.midjourney.mode},service(){return this.$store.state.midjourney.service},application(){return this.$store.state.midjourney.application},credential(){return this.$store.state.midjourney.credential},initializing(){return this.$store.state.midjourney.status.getApplication===h.Request},needApply(){return this.$store.state.midjourney.status.getApplication===h.Success&&!this.application}},async mounted(){await this.onGetApplication()},methods:{async onGenerateNew(){this.$router.push({name:S})},async onGetApplication(){await this.$store.dispatch("midjourney/getApplication")},async onStartTask(e){var i;const t=(i=this.credential)==null?void 0:i.token;if(!t){console.error("no token found");return}b.imagine(e,{token:t}).then(()=>{g.success(this.$t("midjourney.message.startTaskSuccess"))}).catch(()=>{g.error(this.$t("midjourney.message.startTaskFailed"))})},async onCustom(e){const t={image_id:e.image_id,action:e.action,callback_url:D};this.onStartTask(t)}}}),K={class:"history"};function W(e,t,i,$,v,j){const l=o("mode-selector"),r=o("application-status"),u=o("task-full-list"),c=o("font-awesome-icon"),m=o("el-button");return n(),a("div",K,[s(l,{class:"mb-4"}),s(r,{initializing:e.initializing,application:e.application,"need-apply":e.needApply,class:"mb-4",service:e.service,onRefresh:e.onGetApplication},null,8,["initializing","application","need-apply","service","onRefresh"]),s(u,{onCustom:e.onCustom,onRefresh:e.onGetApplication},null,8,["onCustom","onRefresh"]),s(m,{type:"primary",round:"",class:"btn btn-generate",onClick:e.onGenerateNew},{default:_(()=>[s(c,{icon:"fa-solid fa-chevron-left",class:"icon icon-rotate mr-1"}),q(" "+z(e.$t("midjourney.button.generateNew")),1)]),_:1},8,["onClick"])])}var ie=k(J,[["render",W],["__scopeId","data-v-638d7e3e"],["__file","/home/runner/work/Nexior/Nexior/src/pages/midjourney/History.vue"]]);export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-others.5383d97e.js";import{P as y}from"./Pagination.
|
|
1
|
+
import"./vendor-others.5383d97e.js";import{P as y}from"./Pagination.94774787.js";import{C as v}from"./CopyToClipboard.6cf34500.js";import{b as $}from"./distribution.f3d3ffba.js";import{_ as C}from"./index.988c94f7.js";import{n as H,o as D,p as F,q as E,s as k}from"./vendor-element-plus.7e649a36.js";import{H as P,al as s,av as q,L as h,M as o,o as m,V as e,f as a,U as n,O as x}from"./vendor-@vue.b5394076.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";const N=P({name:"ConsoleDistributionList",components:{Pagination:y,CopyToClipboard:v,ElRow:H,ElCol:D,ElTable:F,ElTableColumn:E,ElCard:k},data(){return{distributionHistories:[],distributionStatus:void 0,loading:!1,total:void 0,limit:10}},computed:{redirect(){return this.$route.query.redirect},page(){var t;return parseInt(((t=this.$route.query.page)==null?void 0:t.toString())||"1")}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData()},methods:{onPageChange(t){var u;this.$router.push({name:(u=this.$route.name)==null?void 0:u.toString(),query:{page:t}})},onFetchData(){this.loading=!0,Promise.all([this.onFetchDistributionHistory()]).finally(()=>{this.loading=!1})},async onFetchDistributionHistory(){const{data:t}=await $.getAll({user_id:this.$store.getters.user.id,ordering:"-created_at",limit:this.limit,offset:(this.page-1)*this.limit});this.distributionHistories=t.items,this.total=t.count}}}),S={class:"title"},A={class:"key"},B={class:"copy"},I={class:"key"},T={class:"copy"},V={class:"price"},z={class:"description"},L={class:"description"},O={class:"created-at"},j={class:"pagination m-v-lg"};function M(t,u,R,U,G,J){const c=s("el-col"),p=s("el-row"),_=s("copy-to-clipboard"),r=s("el-table-column"),f=s("el-table"),b=s("el-card"),g=s("pagination"),w=q("loading");return m(),h(p,{class:"panel"},{default:o(()=>[e(c,{span:24},{default:o(()=>[e(p,null,{default:o(()=>[e(c,{span:24},{default:o(()=>[a("h2",S,n(t.$t("common.title.distributionHistory")),1)]),_:1})]),_:1}),e(p,null,{default:o(()=>[e(c,{span:24},{default:o(()=>[e(b,{shadow:"hover"},{default:o(()=>[x((m(),h(f,{data:t.distributionHistories,stripe:""},{default:o(()=>[e(r,{prop:"id",label:t.$t("distribution.field.id"),"class-name":"text-center",width:"350px"},{default:o(i=>[a("span",A,n(i.row.id),1),a("span",B,[e(_,{content:i.row.id},null,8,["content"])])]),_:1},8,["label"]),e(r,{prop:"id",label:t.$t("distribution.field.userId"),"class-name":"text-center",width:"350px"},{default:o(i=>[a("span",I,n(i.row.user_id),1),a("span",T,[e(_,{content:i.row.user_id},null,8,["content"])])]),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.price"),width:"100px"},{default:o(i=>{var l,d;return[a("span",V,"\xA5"+n((d=(l=i.row)==null?void 0:l.price)==null?void 0:d.toFixed(2)),1)]}),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.reward"),width:"100px"},{default:o(i=>{var l,d;return[a("span",z,"\uFFE5"+n((d=(l=i.row)==null?void 0:l.reward)==null?void 0:d.toFixed(2)),1)]}),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.percentage"),width:"100px"},{default:o(i=>[a("span",L,n(i.row.percentage)+"%",1)]),_:1},8,["label"]),e(r,{label:t.$t("distribution.field.createdAt"),width:"200px"},{default:o(i=>[a("span",O,n(t.$dayjs.format(i.row.created_at)),1)]),_:1},8,["label"])]),_:1},8,["data"])),[[w,t.loading]])]),_:1})]),_:1})]),_:1}),e(p,null,{default:o(()=>[e(c,{span:10,offset:14},{default:o(()=>[a("div",j,[e(g,{"current-page":t.page,"page-size":t.limit,total:t.total,onChange:t.onPageChange},null,8,["current-page","page-size","total","onChange"])])]),_:1})]),_:1})]),_:1})]),_:1})}var it=C(N,[["render",M],["__scopeId","data-v-63f0e9ed"],["__file","/home/runner/work/Nexior/Nexior/src/pages/distribution/History.vue"]]);export{it as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{av as y}from"./vendor-others.5383d97e.js";import{L as N}from"./Chatdoc.
|
|
1
|
+
import{av as y}from"./vendor-others.5383d97e.js";import{L as N}from"./Chatdoc.4ff43c51.js";import{_ as v,F as g,m as D}from"./index.988c94f7.js";import{f as S,E as F,B,C as U,K as z,G as u,s as L,n as M,o as T,h as q,i as G,j as H}from"./vendor-element-plus.7e649a36.js";import{H as C,al as o,o as _,e as w,V as t,M as s,T as R,U as r,f as i,W as b,L as $,ai as K,S as O}from"./vendor-@vue.b5394076.js";import{A as j}from"./Status.976901eb.js";import"./vendor-axios.168e6950.js";import"./vendor-highlight.js.40bb9ea2.js";import"./application.ea1e2a72.js";const W=C({name:"CreateRepository",components:{ElButton:S,ElDialog:F,ElForm:B,ElFormItem:U,ElInput:z,FontAwesomeIcon:y},data(){return{dialogVisible:!1,creating:!1,form:{name:"",description:""}}},computed:{},methods:{async onSubmit(){if(!this.form.name){u.error(this.$t("chatdoc.message.nameRequired"));return}this.creating=!0,this.$store.dispatch("chatdoc/createRepository",{name:this.form.name,description:this.form.description}).then(()=>{this.creating=!1,u.success(this.$t("chatdoc.message.createRepositorySuccess")),this.dialogVisible=!1,this.$store.dispatch("chatdoc/getRepositories")}).catch(()=>{this.creating=!1,u.error(this.$t("chatdoc.message.createRepositoryFailed"))})}}});function J(e,a,V,k,E,A){const p=o("el-input"),l=o("el-form-item"),d=o("el-button"),m=o("el-form"),h=o("el-dialog"),f=o("font-awesome-icon");return _(),w(b,null,[t(h,{modelValue:e.dialogVisible,"onUpdate:modelValue":a[2]||(a[2]=n=>e.dialogVisible=n),width:"400px"},{default:s(()=>[t(m,{ref:"form","label-width":"60px"},{default:s(()=>[t(l,{label:e.$t("chatdoc.field.name"),prop:e.form.name},{default:s(()=>[t(p,{modelValue:e.form.name,"onUpdate:modelValue":a[0]||(a[0]=n=>e.form.name=n),placeholder:e.$t("chatdoc.message.inputRepositoryName")},null,8,["modelValue","placeholder"])]),_:1},8,["label","prop"]),t(l,{label:e.$t("chatdoc.field.description"),prop:e.form.description},{default:s(()=>[t(p,{modelValue:e.form.description,"onUpdate:modelValue":a[1]||(a[1]=n=>e.form.description=n),placeholder:e.$t("chatdoc.message.inputRepositoryDescription")},null,8,["modelValue","placeholder"])]),_:1},8,["label","prop"]),t(l,null,{default:s(()=>[t(d,{type:"primary",round:"",onClick:e.onSubmit},{default:s(()=>[R(r(e.$t("common.button.create")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},512)]),_:1},8,["modelValue"]),i("button",{class:"btn btn-create",onClick:a[3]||(a[3]=n=>e.dialogVisible=!0)},[t(f,{icon:["fas","plus"]})])],64)}var P=v(W,[["render",J],["__scopeId","data-v-41eec665"],["__file","/home/runner/work/Nexior/Nexior/src/components/chatdoc/CreateRepository.vue"]]);const Q=C({name:"ChatdocKnowledge",components:{Layout:N,ElCard:L,ElRow:M,ElCol:T,CreateRepository:P,FontAwesomeIcon:y,ElDropdown:q,ElDropdownItem:G,ElDropdownMenu:H,ApplicationStatus:j},data(){return{}},computed:{repositories(){return this.$store.state.chatdoc.repositories},needApply(){return this.$store.state.chatdoc.status.getApplication===g.Success&&!this.application},application(){return this.$store.state.chatdoc.application},service(){return this.$store.state.chatdoc.service},initializing(){return this.$store.state.chatdoc.status.getApplication===g.Request}},async mounted(){},methods:{onCreate(){console.log("onCreate")},onClick(e){this.$router.push({name:D,params:{repositoryId:e.id}})},onDelete(e){this.$store.dispatch("chatdoc/deleteRepository",{id:e}).then(()=>{u.success(this.$t("chatdoc.message.deleteRepositorySuccess")),this.$store.dispatch("chatdoc/getRepositories")})}}}),X={class:"wrapper"},Y={class:"title"},Z={class:"introduction"},x={class:"status"},ee={class:"operation"},oe={class:"name"},te={class:"id"},se={class:"description"};function ae(e,a,V,k,E,A){const p=o("application-status"),l=o("create-repository"),d=o("el-card"),m=o("el-col"),h=o("font-awesome-icon");o("el-dropdown-item"),o("el-dropdown-menu"),o("el-dropdown");const f=o("el-row"),n=o("layout");return _(),$(n,null,{chatdoc:s(()=>[i("div",X,[i("div",Y,r(e.$t("chatdoc.title.repositories")),1),i("div",Z,r(e.$t("chatdoc.message.introductionForRepository")),1),i("div",x,[t(p,{"show-price":!1,initializing:e.initializing,application:e.application,"need-apply":e.needApply,service:e.service,onRefresh:a[0]||(a[0]=c=>e.$store.dispatch("chatdoc/getApplication"))},null,8,["initializing","application","need-apply","service"])]),t(f,{class:"repositories",gutter:15},{default:s(()=>[t(m,{xl:4,md:6,sm:12,xs:24},{default:s(()=>[t(d,{class:"repository text-center",shadow:"hover",onClick:e.onCreate},{default:s(()=>[t(l),i("p",ee,r(e.$t("chatdoc.title.createRepository")),1)]),_:1},8,["onClick"])]),_:1}),(_(!0),w(b,null,K(e.repositories,(c,I)=>(_(),$(m,{key:I,xl:4,md:6,sm:12,xs:24},{default:s(()=>[t(d,{class:"repository",shadow:"hover",onClick:ie=>e.onClick(c)},{default:s(()=>[O("v-if",!0),i("h2",oe,r(c.name),1),i("p",te,[t(h,{icon:["fas","book"]}),R(" ID: "+r(c.id),1)]),i("p",se,r(c.description),1)]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1})])]),_:1})}var he=v(Q,[["render",ae],["__scopeId","data-v-52a67922"],["__file","/home/runner/work/Nexior/Nexior/src/pages/chatdoc/Index.vue"]]);export{he as default};
|