From 2b959c7b768c84298db798b77de4fd5db5da7ec3 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sun, 21 Apr 2024 00:56:19 +0200 Subject: [PATCH] more information --- lollms_core | 2 +- lollms_webui.py | 5 ++++- .../{index-80bb9b98.js => index-1841272f.js} | 4 ++-- web/dist/index.html | 2 +- web/src/components/Message.vue | 16 ++++++++++------ 5 files changed, 18 insertions(+), 11 deletions(-) rename web/dist/assets/{index-80bb9b98.js => index-1841272f.js} (99%) diff --git a/lollms_core b/lollms_core index 27748309..10dacbbb 160000 --- a/lollms_core +++ b/lollms_core @@ -1 +1 @@ -Subproject commit 27748309141a73db171a1015b499914cc6fce9ec +Subproject commit 10dacbbb47665b1c8179d3800be3918a2e80710d diff --git a/lollms_webui.py b/lollms_webui.py index 969b3b9d..f25814b7 100644 --- a/lollms_webui.py +++ b/lollms_webui.py @@ -770,6 +770,7 @@ class LOLLMSWebUI(LOLLMSElfServer): binding = self.config["binding_name"], model = self.config["model_name"], personality = self.config["personalities"][self.config["active_personality_id"]], + created_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S') ) # first the content is empty, but we'll fill it at the end run_async(partial( self.sio.emit,'new_message', @@ -819,6 +820,7 @@ class LOLLMSWebUI(LOLLMSElfServer): 'ui': ui, 'discussion_id':client.discussion.discussion_id, 'message_type': MSG_TYPE.MSG_TYPE_STEP_END.value, + 'created_at':client.discussion.current_message.created_at, 'started_generating_at': client.discussion.current_message.started_generating_at, 'finished_generating_at': client.discussion.current_message.finished_generating_at, 'nb_tokens': client.discussion.current_message.nb_tokens, @@ -836,6 +838,7 @@ class LOLLMSWebUI(LOLLMSElfServer): 'ui': ui, 'discussion_id':client.discussion.discussion_id, 'message_type': msg_type.value if msg_type is not None else MSG_TYPE.MSG_TYPE_CHUNK.value if self.nb_received_tokens>1 else MSG_TYPE.MSG_TYPE_FULL.value, + 'created_at':client.discussion.current_message.created_at, 'started_generating_at': client.discussion.current_message.started_generating_at, 'finished_generating_at': client.discussion.current_message.finished_generating_at, 'nb_tokens': client.discussion.current_message.nb_tokens, @@ -845,7 +848,7 @@ class LOLLMSWebUI(LOLLMSElfServer): ) ) if msg_type != MSG_TYPE.MSG_TYPE_INFO: - client.discussion.update_message(client.generated_text, new_metadata=mtdt, new_ui=ui, nb_tokens=client.discussion.current_message.nb_tokens) + client.discussion.update_message(client.generated_text, new_metadata=mtdt, new_ui=ui, started_generating_at=client.discussion.current_message.started_generating_at, nb_tokens=client.discussion.current_message.nb_tokens) diff --git a/web/dist/assets/index-80bb9b98.js b/web/dist/assets/index-1841272f.js similarity index 99% rename from web/dist/assets/index-80bb9b98.js rename to web/dist/assets/index-1841272f.js index 3841c891..08a22f4e 100644 --- a/web/dist/assets/index-80bb9b98.js +++ b/web/dist/assets/index-1841272f.js @@ -183,8 +183,8 @@ If You are using windows, this will install wsl so you need to activate it. `?(this.message.content=this.message.content.slice(0,e)+"```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+3+n.length):speechSynthesis==0||this.message.content[e-1]==` `?(this.message.content=this.message.content.slice(0,e)+"```"+n+` `+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+` -`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),p=p+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?ybt+this.avatar:(console.log("No avatar found"),ga)},defaultImg(n){n.target.src=ga},parseDate(n){let e=new Date(Date.parse(n)),i=Math.floor((new Date-e)/1e3);return i<=1?"just now":i<20?i+" seconds ago":i<40?"half a minute ago":i<60?"less than a minute ago":i<=90?"one minute ago":i<=3540?Math.round(i/60)+" minutes ago":i<=5400?"1 hour ago":i<=86400?Math.round(i/3600)+" hours ago":i<=129600?"1 day ago":i<604800?Math.round(i/86400)+" days ago":i<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,i=Math.floor(t/86400);if(!(isNaN(i)||i<0||i>=31))return i==0&&(t<60&&"just now"||t<120&&"1 minute ago"||t<3600&&Math.floor(t/60)+" minutes ago"||t<7200&&"1 hour ago"||t<86400&&Math.floor(t/3600)+" hours ago")||i==1&&"Yesterday"||i<7&&i+" days ago"||i<31&&Math.ceil(i/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{audio_url(n){n&&(this.$refs.audio_player.src=n)},"message.content":function(n){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),console.log(this.message.ui)},showConfirmation(){Ve(()=>{qe.replace()})},deleteMsgMode(){Ve(()=>{qe.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,Ve(()=>{qe.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===n.getTime()||!n.getTime()||!e.getTime())return;let[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},wait_duration(){const n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===n.getTime()||!n.getTime()||!e.getTime())return;let i,s,r;[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},generation_rate(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at)),t=this.message.nb_tokens;if(e.getTime()===n.getTime()||!t||!n.getTime()||!e.getTime())return;let s=e.getTime()-n.getTime();const r=Math.floor(s/1e3),o=t/r;return Math.round(o)+" t/s"}}},Tbt={class:"relative w-full group rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},xbt={class:"flex flex-row gap-2"},Cbt={class:"flex-shrink-0"},Rbt={class:"group/avatar"},Abt=["src","data-popover-target"],wbt={class:"flex flex-col w-full flex-grow-0"},Nbt={class:"flex flex-row flex-grow items-start"},Obt={class:"flex flex-col mb-2"},Ibt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},Mbt=["title"],Dbt=u("div",{class:"flex-grow"},null,-1),kbt={class:"flex-row justify-end mx-2"},Lbt={class:"invisible group-hover:visible flex flex-row"},Pbt={key:0,class:"flex items-center duration-75"},Ubt=u("i",{"data-feather":"x"},null,-1),Fbt=[Ubt],Bbt=u("i",{"data-feather":"check"},null,-1),Gbt=[Bbt],zbt=u("i",{"data-feather":"edit"},null,-1),Vbt=[zbt],Hbt=["src"],qbt=["src"],Ybt=["src"],$bt=["src"],Wbt=["src"],Kbt=["src"],jbt=["src"],Qbt=["src"],Xbt=u("i",{"data-feather":"copy"},null,-1),Zbt=[Xbt],Jbt=u("i",{"data-feather":"send"},null,-1),eEt=[Jbt],tEt=["src"],nEt=u("i",{"data-feather":"send"},null,-1),iEt=[nEt],sEt=u("i",{"data-feather":"fast-forward"},null,-1),rEt=[sEt],oEt={key:14,class:"flex items-center duration-75"},aEt=u("i",{"data-feather":"x"},null,-1),lEt=[aEt],cEt=u("i",{"data-feather":"check"},null,-1),dEt=[cEt],uEt=u("i",{"data-feather":"trash"},null,-1),pEt=[uEt],_Et=u("i",{"data-feather":"thumbs-up"},null,-1),hEt=[_Et],fEt={class:"flex flex-row items-center"},mEt=u("i",{"data-feather":"thumbs-down"},null,-1),gEt=[mEt],bEt={class:"flex flex-row items-center"},EEt=u("i",{"data-feather":"volume-2"},null,-1),vEt=[EEt],yEt={class:"flex flex-row items-center"},SEt=u("i",{"data-feather":"voicemail"},null,-1),TEt=[SEt],xEt=["src"],CEt={class:"overflow-x-auto w-full"},REt={class:"flex w-full cursor-pointer rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900 mb-3.5 max-w-full"},AEt={class:"grid min-w-72 select-none grid-cols-[40px,1fr] items-center gap-2.5 p-2"},wEt={class:"relative grid aspect-square place-content-center overflow-hidden rounded-lg bg-gray-300 dark:bg-gray-200"},NEt=["src"],OEt=["src"],IEt=["src"],MEt={class:"leading-4"},DEt=u("dd",{class:"text-sm"},"Processing infos",-1),kEt={class:"flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400"},LEt={class:"content px-5 pb-5 pt-4"},PEt={class:"list-none"},UEt=u("div",{class:"flex flex-col items-start w-full"},null,-1),FEt={class:"flex flex-col items-start w-full"},BEt={key:1},GEt=["src"],zEt={class:"text-sm text-gray-400 mt-2"},VEt={class:"flex flex-row items-center gap-2"},HEt={key:0},qEt={class:"font-thin"},YEt={key:1},$Et={class:"font-thin"},WEt={key:2},KEt={class:"font-thin"},jEt={key:3},QEt=["title"],XEt={key:4},ZEt=["title"],JEt={key:5},evt=["title"],tvt={key:6},nvt=["title"];function ivt(n,e,t,i,s,r){var _;const o=ht("Step"),a=ht("RenderHTMLJS"),l=ht("MarkdownRenderer"),d=ht("JsonViewer"),c=ht("DynamicUIRenderer");return w(),M("div",Tbt,[u("div",xbt,[u("div",Cbt,[u("div",Rbt,[u("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=f=>r.defaultImg(f)),"data-popover-target":"avatar"+t.message.id,"data-popover-placement":"bottom",class:"w-10 h-10 rounded-full object-fill text-red-700"},null,40,Abt)])]),u("div",wbt,[u("div",Nbt,[u("div",Obt,[u("div",Ibt,fe(t.message.sender)+" ",1),t.message.created_at?(w(),M("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+r.created_at_parsed},fe(r.created_at),9,Mbt)):q("",!0)]),Dbt,u("div",kbt,[u("div",Lbt,[r.editMsgMode?(w(),M("div",Pbt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel edit",type:"button",onClick:e[1]||(e[1]=Te(f=>r.editMsgMode=!1,["stop"]))},Fbt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=Te((...f)=>r.updateMessage&&r.updateMessage(...f),["stop"]))},Gbt)])):q("",!0),r.editMsgMode?q("",!0):(w(),M("div",{key:1,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Edit message",onClick:e[3]||(e[3]=Te(f=>r.editMsgMode=!0,["stop"]))},Vbt)),r.editMsgMode?(w(),M("div",{key:2,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[4]||(e[4]=Te(f=>r.addBlock(""),["stop"]))},[u("img",{src:s.code_block,width:"25",height:"25"},null,8,Hbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:3,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[5]||(e[5]=Te(f=>r.addBlock("python"),["stop"]))},[u("img",{src:s.python_block,width:"25",height:"25"},null,8,qbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:4,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add javascript block",onClick:e[6]||(e[6]=Te(f=>r.addBlock("javascript"),["stop"]))},[u("img",{src:s.javascript_block,width:"25",height:"25"},null,8,Ybt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:5,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add json block",onClick:e[7]||(e[7]=Te(f=>r.addBlock("json"),["stop"]))},[u("img",{src:s.json_block,width:"25",height:"25"},null,8,$bt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:6,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add c++ block",onClick:e[8]||(e[8]=Te(f=>r.addBlock("c++"),["stop"]))},[u("img",{src:s.cpp_block,width:"25",height:"25"},null,8,Wbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:7,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add html block",onClick:e[9]||(e[9]=Te(f=>r.addBlock("html"),["stop"]))},[u("img",{src:s.html5_block,width:"25",height:"25"},null,8,Kbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:8,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add LaTex block",onClick:e[10]||(e[10]=Te(f=>r.addBlock("latex"),["stop"]))},[u("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,jbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:9,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add bash block",onClick:e[11]||(e[11]=Te(f=>r.addBlock("bash"),["stop"]))},[u("img",{src:s.bash_block,width:"25",height:"25"},null,8,Qbt)])):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Copy message to clipboard",onClick:e[12]||(e[12]=Te(f=>r.copyContentToClipboard(),["stop"]))},Zbt),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:10,class:Ye(["text-lg text-red-500 hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message with full context",onClick:e[13]||(e[13]=Te(f=>r.resendMessage("full_context"),["stop"]))},eEt,2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:11,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[14]||(e[14]=Te(f=>r.resendMessage("full_context_with_internet"),["stop"]))},[u("img",{src:s.sendGlobe,width:"25",height:"25"},null,8,tEt)],2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:12,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[15]||(e[15]=Te(f=>r.resendMessage("simple_question"),["stop"]))},iEt,2)):q("",!0),!r.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(w(),M("div",{key:13,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Resend message",onClick:e[16]||(e[16]=Te(f=>r.continueMessage(),["stop"]))},rEt)):q("",!0),s.deleteMsgMode?(w(),M("div",oEt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Cancel removal",type:"button",onClick:e[17]||(e[17]=Te(f=>s.deleteMsgMode=!1,["stop"]))},lEt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Confirm removal",type:"button",onClick:e[18]||(e[18]=Te(f=>r.deleteMsg(),["stop"]))},dEt)])):q("",!0),!r.editMsgMode&&!s.deleteMsgMode?(w(),M("div",{key:15,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Remove message",onClick:e[19]||(e[19]=f=>s.deleteMsgMode=!0)},pEt)):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Upvote",onClick:e[20]||(e[20]=Te(f=>r.rankUp(),["stop"]))},hEt),u("div",fEt,[u("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Downvote",onClick:e[21]||(e[21]=Te(f=>r.rankDown(),["stop"]))},gEt),t.message.rank!=0?(w(),M("div",{key:0,class:Ye(["rounded-full px-2 text-sm flex items-center justify-center font-bold cursor-pointer",t.message.rank>0?"bg-secondary":"bg-red-600"]),title:"Rank"},fe(t.message.rank),3)):q("",!0)]),u("div",bEt,[u("div",{class:Ye(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",{"text-red-500":r.isTalking}]),title:"speak",onClick:e[22]||(e[22]=Te(f=>r.speak(),["stop"]))},vEt,2)]),u("div",yEt,[s.isSynthesizingVoice?(w(),M("img",{key:1,src:s.loading_svg},null,8,xEt)):(w(),M("div",{key:0,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"read",onClick:e[23]||(e[23]=Te(f=>r.read(),["stop"]))},TEt))])])])]),u("div",CEt,[ne(u("details",REt,[u("summary",AEt,[u("div",wEt,[t.message.status_message!="Done"&t.message.status_message!="Generation canceled"?(w(),M("img",{key:0,src:s.loading_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,NEt)):q("",!0),t.message.status_message=="Generation canceled"?(w(),M("img",{key:1,src:s.failed_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,OEt)):q("",!0),t.message.status_message=="Done"?(w(),M("img",{key:2,src:s.ok_svg,class:"absolute m-2 w-6 inset-0 text-geen-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,IEt)):q("",!0)]),u("dl",MEt,[DEt,u("dt",kEt,fe(t.message==null?"":t.message.status_message),1)])]),u("div",LEt,[u("ol",PEt,[(w(!0),M($e,null,ct(t.message.steps,(f,m)=>(w(),M("div",{key:"step-"+t.message.id+"-"+m,class:"group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800",style:en({backgroundColor:f.done?"transparent":"inherit"})},[Oe(o,{done:f.done,message:f.message,status:f.status,step_type:f.type},null,8,["done","message","status","step_type"])],4))),128))])])],512),[[Ot,t.message!=null&&t.message.steps!=null&&t.message.steps.length>0]]),UEt,u("div",FEt,[(w(!0),M($e,null,ct(t.message.html_js_s,(f,m)=>(w(),M("div",{key:"htmljs-"+t.message.id+"-"+m,class:"htmljs font-bold",style:en({backgroundColor:n.step.done?"transparent":"inherit"})},[Oe(a,{htmlContent:f},null,8,["htmlContent"])],4))),128))]),r.editMsgMode?q("",!0):(w(),xt(l,{key:0,ref:"mdRender",host:t.host,"markdown-text":t.message.content,message_id:t.message.id,discussion_id:t.message.discussion_id,client_id:this.$store.state.client_id},null,8,["host","markdown-text","message_id","discussion_id","client_id"])),u("div",null,[t.message.open?ne((w(),M("textarea",{key:0,ref:"mdTextarea",onKeydown:e[24]||(e[24]=wr(Te((...f)=>r.insertTab&&r.insertTab(...f),["prevent"]),["tab"])),class:"block min-h-[900px] p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,placeholder:"Enter message here...","onUpdate:modelValue":e[25]||(e[25]=f=>t.message.content=f)},`\r - `,544)),[[Pe,t.message.content]]):q("",!0)]),t.message.metadata!==null?(w(),M("div",BEt,[(w(!0),M($e,null,ct(((_=t.message.metadata)==null?void 0:_.filter(f=>f!=null&&f.hasOwnProperty("title")&&f.hasOwnProperty("content")))||[],(f,m)=>(w(),M("div",{key:"json-"+t.message.id+"-"+m,class:"json font-bold"},[Oe(d,{jsonFormText:f.title,jsonData:f.content},null,8,["jsonFormText","jsonData"])]))),128))])):q("",!0),t.message.ui!==null&&t.message.ui!==void 0&&t.message.ui!==""?(w(),xt(c,{key:2,class:"w-full h-full",code:t.message.ui},null,8,["code"])):q("",!0),s.audio_url!=null?(w(),M("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,GEt),je(" Your browser does not support the audio element. ")])):q("",!0)]),u("div",zEt,[u("div",VEt,[t.message.binding?(w(),M("p",HEt,[je("Binding: "),u("span",qEt,fe(t.message.binding),1)])):q("",!0),t.message.model?(w(),M("p",YEt,[je("Model: "),u("span",$Et,fe(t.message.model),1)])):q("",!0),t.message.seed?(w(),M("p",WEt,[je("Seed: "),u("span",KEt,fe(t.message.seed),1)])):q("",!0),t.message.nb_tokens?(w(),M("p",jEt,[je("Number of tokens: "),u("span",{class:"font-thin",title:"Number of Tokens: "+t.message.nb_tokens},fe(t.message.nb_tokens),9,QEt)])):q("",!0),r.wait_duration?(w(),M("p",XEt,[je("Wait duration: "),u("span",{class:"font-thin",title:"Wait duration: "+r.wait_duration},fe(r.wait_duration),9,ZEt)])):q("",!0),r.time_spent?(w(),M("p",JEt,[je("Generation duration: "),u("span",{class:"font-thin",title:"Finished generating: "+r.time_spent},fe(r.time_spent),9,evt)])):q("",!0),r.time_spent?(w(),M("p",tvt,[je("Rate: "),u("span",{class:"font-thin",title:"Generation rate: "+r.generation_rate},fe(r.generation_rate),9,nvt)])):q("",!0)])])])])])}const SO=bt(Sbt,[["render",ivt]]),svt="/";Me.defaults.baseURL="/";const rvt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:fc,UniversalForm:Ec},data(){return{bUrl:svt,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},mountedPers:{get(){return this.$store.state.mountedPers},set(n){this.$store.commit("setMountedPers",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{onSettingsPersonality(n){try{Me.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.name,"Save changes","Cancel").then(t=>{try{Me.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. +`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),p=p+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?ybt+this.avatar:(console.log("No avatar found"),ga)},defaultImg(n){n.target.src=ga},parseDate(n){let e=new Date(Date.parse(n)),i=Math.floor((new Date-e)/1e3);return i<=1?"just now":i<20?i+" seconds ago":i<40?"half a minute ago":i<60?"less than a minute ago":i<=90?"one minute ago":i<=3540?Math.round(i/60)+" minutes ago":i<=5400?"1 hour ago":i<=86400?Math.round(i/3600)+" hours ago":i<=129600?"1 day ago":i<604800?Math.round(i/86400)+" days ago":i<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,i=Math.floor(t/86400);if(!(isNaN(i)||i<0||i>=31))return i==0&&(t<60&&"just now"||t<120&&"1 minute ago"||t<3600&&Math.floor(t/60)+" minutes ago"||t<7200&&"1 hour ago"||t<86400&&Math.floor(t/3600)+" hours ago")||i==1&&"Yesterday"||i<7&&i+" days ago"||i<31&&Math.ceil(i/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{audio_url(n){n&&(this.$refs.audio_player.src=n)},"message.content":function(n){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),console.log(this.message.ui)},showConfirmation(){Ve(()=>{qe.replace()})},deleteMsgMode(){Ve(()=>{qe.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,Ve(()=>{qe.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(console.log("Computing the generation duration, ",n," -> ",e),e.getTime()===n.getTime()||!n.getTime()||!e.getTime())return;let[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},warmup_duration(){const n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.started_generating_at));if(console.log("Computing the warmup duration, ",n," -> ",e),e.getTime()===n.getTime())return 0;if(!n.getTime()||!e.getTime())return;let i,s,r;[i,s,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(i)+"h:"+o(s)+"m:"+o(r)+"s"},generation_rate(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at)),t=this.message.nb_tokens;if(console.log("Computing the generation rate, ",t," in ",n," -> ",e),e.getTime()===n.getTime()||!t||!n.getTime()||!e.getTime())return;let s=e.getTime()-n.getTime();const r=Math.floor(s/1e3),o=t/r;return Math.round(o)+" t/s"}}},Tbt={class:"relative w-full group rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},xbt={class:"flex flex-row gap-2"},Cbt={class:"flex-shrink-0"},Rbt={class:"group/avatar"},Abt=["src","data-popover-target"],wbt={class:"flex flex-col w-full flex-grow-0"},Nbt={class:"flex flex-row flex-grow items-start"},Obt={class:"flex flex-col mb-2"},Ibt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},Mbt=["title"],Dbt=u("div",{class:"flex-grow"},null,-1),kbt={class:"flex-row justify-end mx-2"},Lbt={class:"invisible group-hover:visible flex flex-row"},Pbt={key:0,class:"flex items-center duration-75"},Ubt=u("i",{"data-feather":"x"},null,-1),Fbt=[Ubt],Bbt=u("i",{"data-feather":"check"},null,-1),Gbt=[Bbt],zbt=u("i",{"data-feather":"edit"},null,-1),Vbt=[zbt],Hbt=["src"],qbt=["src"],Ybt=["src"],$bt=["src"],Wbt=["src"],Kbt=["src"],jbt=["src"],Qbt=["src"],Xbt=u("i",{"data-feather":"copy"},null,-1),Zbt=[Xbt],Jbt=u("i",{"data-feather":"send"},null,-1),eEt=[Jbt],tEt=["src"],nEt=u("i",{"data-feather":"send"},null,-1),iEt=[nEt],sEt=u("i",{"data-feather":"fast-forward"},null,-1),rEt=[sEt],oEt={key:14,class:"flex items-center duration-75"},aEt=u("i",{"data-feather":"x"},null,-1),lEt=[aEt],cEt=u("i",{"data-feather":"check"},null,-1),dEt=[cEt],uEt=u("i",{"data-feather":"trash"},null,-1),pEt=[uEt],_Et=u("i",{"data-feather":"thumbs-up"},null,-1),hEt=[_Et],fEt={class:"flex flex-row items-center"},mEt=u("i",{"data-feather":"thumbs-down"},null,-1),gEt=[mEt],bEt={class:"flex flex-row items-center"},EEt=u("i",{"data-feather":"volume-2"},null,-1),vEt=[EEt],yEt={class:"flex flex-row items-center"},SEt=u("i",{"data-feather":"voicemail"},null,-1),TEt=[SEt],xEt=["src"],CEt={class:"overflow-x-auto w-full"},REt={class:"flex w-full cursor-pointer rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900 mb-3.5 max-w-full"},AEt={class:"grid min-w-72 select-none grid-cols-[40px,1fr] items-center gap-2.5 p-2"},wEt={class:"relative grid aspect-square place-content-center overflow-hidden rounded-lg bg-gray-300 dark:bg-gray-200"},NEt=["src"],OEt=["src"],IEt=["src"],MEt={class:"leading-4"},DEt=u("dd",{class:"text-sm"},"Processing infos",-1),kEt={class:"flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400"},LEt={class:"content px-5 pb-5 pt-4"},PEt={class:"list-none"},UEt=u("div",{class:"flex flex-col items-start w-full"},null,-1),FEt={class:"flex flex-col items-start w-full"},BEt={key:1},GEt=["src"],zEt={class:"text-sm text-gray-400 mt-2"},VEt={class:"flex flex-row items-center gap-2"},HEt={key:0},qEt={class:"font-thin"},YEt={key:1},$Et={class:"font-thin"},WEt={key:2},KEt={class:"font-thin"},jEt={key:3},QEt=["title"],XEt={key:4},ZEt=["title"],JEt={key:5},evt=["title"],tvt={key:6},nvt=["title"];function ivt(n,e,t,i,s,r){var _;const o=ht("Step"),a=ht("RenderHTMLJS"),l=ht("MarkdownRenderer"),d=ht("JsonViewer"),c=ht("DynamicUIRenderer");return w(),M("div",Tbt,[u("div",xbt,[u("div",Cbt,[u("div",Rbt,[u("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=f=>r.defaultImg(f)),"data-popover-target":"avatar"+t.message.id,"data-popover-placement":"bottom",class:"w-10 h-10 rounded-full object-fill text-red-700"},null,40,Abt)])]),u("div",wbt,[u("div",Nbt,[u("div",Obt,[u("div",Ibt,fe(t.message.sender)+" ",1),t.message.created_at?(w(),M("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+r.created_at_parsed},fe(r.created_at),9,Mbt)):q("",!0)]),Dbt,u("div",kbt,[u("div",Lbt,[r.editMsgMode?(w(),M("div",Pbt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel edit",type:"button",onClick:e[1]||(e[1]=Te(f=>r.editMsgMode=!1,["stop"]))},Fbt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=Te((...f)=>r.updateMessage&&r.updateMessage(...f),["stop"]))},Gbt)])):q("",!0),r.editMsgMode?q("",!0):(w(),M("div",{key:1,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Edit message",onClick:e[3]||(e[3]=Te(f=>r.editMsgMode=!0,["stop"]))},Vbt)),r.editMsgMode?(w(),M("div",{key:2,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[4]||(e[4]=Te(f=>r.addBlock(""),["stop"]))},[u("img",{src:s.code_block,width:"25",height:"25"},null,8,Hbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:3,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[5]||(e[5]=Te(f=>r.addBlock("python"),["stop"]))},[u("img",{src:s.python_block,width:"25",height:"25"},null,8,qbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:4,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add javascript block",onClick:e[6]||(e[6]=Te(f=>r.addBlock("javascript"),["stop"]))},[u("img",{src:s.javascript_block,width:"25",height:"25"},null,8,Ybt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:5,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add json block",onClick:e[7]||(e[7]=Te(f=>r.addBlock("json"),["stop"]))},[u("img",{src:s.json_block,width:"25",height:"25"},null,8,$bt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:6,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add c++ block",onClick:e[8]||(e[8]=Te(f=>r.addBlock("c++"),["stop"]))},[u("img",{src:s.cpp_block,width:"25",height:"25"},null,8,Wbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:7,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add html block",onClick:e[9]||(e[9]=Te(f=>r.addBlock("html"),["stop"]))},[u("img",{src:s.html5_block,width:"25",height:"25"},null,8,Kbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:8,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add LaTex block",onClick:e[10]||(e[10]=Te(f=>r.addBlock("latex"),["stop"]))},[u("img",{src:s.LaTeX_block,width:"25",height:"25"},null,8,jbt)])):q("",!0),r.editMsgMode?(w(),M("div",{key:9,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add bash block",onClick:e[11]||(e[11]=Te(f=>r.addBlock("bash"),["stop"]))},[u("img",{src:s.bash_block,width:"25",height:"25"},null,8,Qbt)])):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Copy message to clipboard",onClick:e[12]||(e[12]=Te(f=>r.copyContentToClipboard(),["stop"]))},Zbt),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:10,class:Ye(["text-lg text-red-500 hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message with full context",onClick:e[13]||(e[13]=Te(f=>r.resendMessage("full_context"),["stop"]))},eEt,2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:11,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[14]||(e[14]=Te(f=>r.resendMessage("full_context_with_internet"),["stop"]))},[u("img",{src:s.sendGlobe,width:"25",height:"25"},null,8,tEt)],2)):q("",!0),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(w(),M("div",{key:12,class:Ye(["text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend message without the full context",onClick:e[15]||(e[15]=Te(f=>r.resendMessage("simple_question"),["stop"]))},iEt,2)):q("",!0),!r.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(w(),M("div",{key:13,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Resend message",onClick:e[16]||(e[16]=Te(f=>r.continueMessage(),["stop"]))},rEt)):q("",!0),s.deleteMsgMode?(w(),M("div",oEt,[u("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Cancel removal",type:"button",onClick:e[17]||(e[17]=Te(f=>s.deleteMsgMode=!1,["stop"]))},lEt),u("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Confirm removal",type:"button",onClick:e[18]||(e[18]=Te(f=>r.deleteMsg(),["stop"]))},dEt)])):q("",!0),!r.editMsgMode&&!s.deleteMsgMode?(w(),M("div",{key:15,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Remove message",onClick:e[19]||(e[19]=f=>s.deleteMsgMode=!0)},pEt)):q("",!0),u("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Upvote",onClick:e[20]||(e[20]=Te(f=>r.rankUp(),["stop"]))},hEt),u("div",fEt,[u("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"Downvote",onClick:e[21]||(e[21]=Te(f=>r.rankDown(),["stop"]))},gEt),t.message.rank!=0?(w(),M("div",{key:0,class:Ye(["rounded-full px-2 text-sm flex items-center justify-center font-bold cursor-pointer",t.message.rank>0?"bg-secondary":"bg-red-600"]),title:"Rank"},fe(t.message.rank),3)):q("",!0)]),u("div",bEt,[u("div",{class:Ye(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",{"text-red-500":r.isTalking}]),title:"speak",onClick:e[22]||(e[22]=Te(f=>r.speak(),["stop"]))},vEt,2)]),u("div",yEt,[s.isSynthesizingVoice?(w(),M("img",{key:1,src:s.loading_svg},null,8,xEt)):(w(),M("div",{key:0,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2 cursor-pointer",title:"read",onClick:e[23]||(e[23]=Te(f=>r.read(),["stop"]))},TEt))])])])]),u("div",CEt,[ne(u("details",REt,[u("summary",AEt,[u("div",wEt,[t.message.status_message!="Done"&t.message.status_message!="Generation canceled"?(w(),M("img",{key:0,src:s.loading_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,NEt)):q("",!0),t.message.status_message=="Generation canceled"?(w(),M("img",{key:1,src:s.failed_svg,class:"absolute inset-0 text-gray-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,OEt)):q("",!0),t.message.status_message=="Done"?(w(),M("img",{key:2,src:s.ok_svg,class:"absolute m-2 w-6 inset-0 text-geen-100 transition-opacity dark:text-gray-800 opacity-100"},null,8,IEt)):q("",!0)]),u("dl",MEt,[DEt,u("dt",kEt,fe(t.message==null?"":t.message.status_message),1)])]),u("div",LEt,[u("ol",PEt,[(w(!0),M($e,null,ct(t.message.steps,(f,m)=>(w(),M("div",{key:"step-"+t.message.id+"-"+m,class:"group border-l pb-6 last:!border-transparent last:pb-0 dark:border-gray-800",style:en({backgroundColor:f.done?"transparent":"inherit"})},[Oe(o,{done:f.done,message:f.message,status:f.status,step_type:f.type},null,8,["done","message","status","step_type"])],4))),128))])])],512),[[Ot,t.message!=null&&t.message.steps!=null&&t.message.steps.length>0]]),UEt,u("div",FEt,[(w(!0),M($e,null,ct(t.message.html_js_s,(f,m)=>(w(),M("div",{key:"htmljs-"+t.message.id+"-"+m,class:"htmljs font-bold",style:en({backgroundColor:n.step.done?"transparent":"inherit"})},[Oe(a,{htmlContent:f},null,8,["htmlContent"])],4))),128))]),r.editMsgMode?q("",!0):(w(),xt(l,{key:0,ref:"mdRender",host:t.host,"markdown-text":t.message.content,message_id:t.message.id,discussion_id:t.message.discussion_id,client_id:this.$store.state.client_id},null,8,["host","markdown-text","message_id","discussion_id","client_id"])),u("div",null,[t.message.open?ne((w(),M("textarea",{key:0,ref:"mdTextarea",onKeydown:e[24]||(e[24]=wr(Te((...f)=>r.insertTab&&r.insertTab(...f),["prevent"]),["tab"])),class:"block min-h-[900px] p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,placeholder:"Enter message here...","onUpdate:modelValue":e[25]||(e[25]=f=>t.message.content=f)},`\r + `,544)),[[Pe,t.message.content]]):q("",!0)]),t.message.metadata!==null?(w(),M("div",BEt,[(w(!0),M($e,null,ct(((_=t.message.metadata)==null?void 0:_.filter(f=>f!=null&&f.hasOwnProperty("title")&&f.hasOwnProperty("content")))||[],(f,m)=>(w(),M("div",{key:"json-"+t.message.id+"-"+m,class:"json font-bold"},[Oe(d,{jsonFormText:f.title,jsonData:f.content},null,8,["jsonFormText","jsonData"])]))),128))])):q("",!0),t.message.ui!==null&&t.message.ui!==void 0&&t.message.ui!==""?(w(),xt(c,{key:2,class:"w-full h-full",code:t.message.ui},null,8,["code"])):q("",!0),s.audio_url!=null?(w(),M("audio",{controls:"",autoplay:"",key:s.audio_url},[u("source",{src:s.audio_url,type:"audio/wav",ref:"audio_player"},null,8,GEt),je(" Your browser does not support the audio element. ")])):q("",!0)]),u("div",zEt,[u("div",VEt,[t.message.binding?(w(),M("p",HEt,[je("Binding: "),u("span",qEt,fe(t.message.binding),1)])):q("",!0),t.message.model?(w(),M("p",YEt,[je("Model: "),u("span",$Et,fe(t.message.model),1)])):q("",!0),t.message.seed?(w(),M("p",WEt,[je("Seed: "),u("span",KEt,fe(t.message.seed),1)])):q("",!0),t.message.nb_tokens?(w(),M("p",jEt,[je("Number of tokens: "),u("span",{class:"font-thin",title:"Number of Tokens: "+t.message.nb_tokens},fe(t.message.nb_tokens),9,QEt)])):q("",!0),r.warmup_duration?(w(),M("p",XEt,[je("Warmup duration: "),u("span",{class:"font-thin",title:"Warmup duration: "+r.warmup_duration},fe(r.warmup_duration),9,ZEt)])):q("",!0),r.time_spent?(w(),M("p",JEt,[je("Generation duration: "),u("span",{class:"font-thin",title:"Finished generating: "+r.time_spent},fe(r.time_spent),9,evt)])):q("",!0),r.generation_rate?(w(),M("p",tvt,[je("Rate: "),u("span",{class:"font-thin",title:"Generation rate: "+r.generation_rate},fe(r.generation_rate),9,nvt)])):q("",!0)])])])])])}const SO=bt(Sbt,[["render",ivt]]),svt="/";Me.defaults.baseURL="/";const rvt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:fc,UniversalForm:Ec},data(){return{bUrl:svt,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},mountedPers:{get(){return this.$store.state.mountedPers},set(n){this.$store.commit("setMountedPers",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{onSettingsPersonality(n){try{Me.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.name,"Save changes","Cancel").then(t=>{try{Me.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. `+i,4,!1)})}catch(i){this.$refs.toast.showToast(`Did not get Personality settings responses. Endpoint error: `+i.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},toggleShowPersList(){this.onShowPersList()},async constructor(){for(Ve(()=>{qe.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Me.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=yc}}},ovt={class:"w-fit select-none"},avt={key:0,class:"flex -space-x-4"},lvt=["src","title"],cvt={key:1,class:"flex -space-x-4"},dvt=["src","title"],uvt={key:2,title:"Loading personalities"},pvt=u("div",{role:"status"},[u("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),u("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),u("span",{class:"sr-only"},"Loading...")],-1),_vt=[pvt];function hvt(n,e,t,i,s,r){const o=ht("UniversalForm");return w(),M($e,null,[u("div",ovt,[r.mountedPersArr.length>1?(w(),M("div",avt,[u("img",{src:s.bUrl+r.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+r.mountedPers.name,onClick:e[1]||(e[1]=a=>r.onSettingsPersonality(r.mountedPers))},null,40,lvt),u("div",{class:"flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90",onClick:e[2]||(e[2]=Te((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+fe(r.mountedPersArr.length-1),1)])):q("",!0),r.mountedPersArr.length==1?(w(),M("div",cvt,[u("img",{src:s.bUrl+this.$store.state.mountedPers.avatar,onError:e[3]||(e[3]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 cursor-pointer border-secondary",title:"Active personality: "+this.$store.state.mountedPers.name,onClick:e[4]||(e[4]=Te((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"]))},null,40,dvt)])):q("",!0),r.mountedPersArr.length==0?(w(),M("div",uvt,_vt)):q("",!0)]),Oe(o,{ref:"universalForm",class:"z-20"},null,512)],64)}const fvt=bt(rvt,[["render",hvt]]);const mvt="/";Me.defaults.baseURL="/";const gvt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:gO,Toast:fc,UniversalForm:Ec},name:"MountedPersonalitiesList",data(){return{bUrl:mvt,isMounted:!1,isLoading:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{toggleShowPersList(){this.onShowPersList()},async constructor(){},async api_get_req(n){try{const e=await Me.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=yc},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Me.post("/reinstall_personality",{name:n.personality.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$refs.toast.showToast("Personality reinstalled successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall personality `+e.message,4,!1),{status:!1}))},editPersonality(n){n=n.personality,Me.post("/get_personality_config",{category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this.$store.state.currentPersonConfig=t.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},onPersonalityMounted(n){this.mountPersonality(n)},onPersonalityUnMounted(n){this.unmountPersonality(n)},onPersonalityRemount(n){this.reMountPersonality(n)},async handleOnTalk(n){if(qe.replace(),console.log("ppa",n),n){if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality: diff --git a/web/dist/index.html b/web/dist/index.html index b85d0425..b548d6aa 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -6,7 +6,7 @@ LoLLMS WebUI - Welcome - + diff --git a/web/src/components/Message.vue b/web/src/components/Message.vue index f4b79c2d..1de28aae 100644 --- a/web/src/components/Message.vue +++ b/web/src/components/Message.vue @@ -228,11 +228,11 @@

Seed: {{ message.seed }}

Number of tokens: {{ message.nb_tokens }}

-

Wait duration: {{ wait_duration }}

+

Warmup duration: {{ warmup_duration }}

Generation duration: {{ time_spent }}

-

Rate: Rate: {{ generation_rate }}

@@ -800,6 +800,8 @@ export default { time_spent() { const startTime = new Date(Date.parse(this.message.started_generating_at)) const endTime = new Date(Date.parse(this.message.finished_generating_at)) + console.log("Computing the generation duration, ", startTime," -> ", endTime) + //const spentTime = new Date(endTime - startTime) const same = endTime.getTime() === startTime.getTime(); if (same) { @@ -830,13 +832,14 @@ export default { }, - wait_duration() { + warmup_duration() { const createdTime = new Date(Date.parse(this.message.created_at)) - const endTime = new Date(Date.parse(this.message.finished_generating_at)) + const endTime = new Date(Date.parse(this.message.started_generating_at)) + console.log("Computing the warmup duration, ",createdTime," -> ", endTime) //const spentTime = new Date(endTime - startTime) const same = endTime.getTime() === createdTime.getTime(); if (same) { - return undefined + return 0 } if (!createdTime.getTime() || !endTime.getTime()) { @@ -868,6 +871,7 @@ export default { const startTime = new Date(Date.parse(this.message.started_generating_at)) const endTime = new Date(Date.parse(this.message.finished_generating_at)) const nb_tokens = this.message.nb_tokens + console.log("Computing the generation rate, ", nb_tokens, " in ", startTime," -> ", endTime) //const spentTime = new Date(endTime - startTime) const same = endTime.getTime() === startTime.getTime(); if (same) {