From 371a297eb4da63477b25a8218ea590a9a56de5d4 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Wed, 31 Jul 2024 01:19:11 +0200 Subject: [PATCH] enhanced tts --- lollms_core | 2 +- web/dist/assets/{index-e43bf984.js => index-9bc65a8f.js} | 2 +- web/dist/index.html | 2 +- web/src/views/PlayGroundView.vue | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename web/dist/assets/{index-e43bf984.js => index-9bc65a8f.js} (99%) diff --git a/lollms_core b/lollms_core index 390d0d49..208f57b1 160000 --- a/lollms_core +++ b/lollms_core @@ -1 +1 @@ -Subproject commit 390d0d49dae0136400a1f60bb4fffc1c41ce8aad +Subproject commit 208f57b1d71b2209543598b8bceafab1a336725f diff --git a/web/dist/assets/index-e43bf984.js b/web/dist/assets/index-9bc65a8f.js similarity index 99% rename from web/dist/assets/index-e43bf984.js rename to web/dist/assets/index-9bc65a8f.js index c0c61421..2b90aa60 100644 --- a/web/dist/assets/index-e43bf984.js +++ b/web/dist/assets/index-9bc65a8f.js @@ -76,7 +76,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),me=P,re=$),J===void 0& `?(this.text=this.text.slice(0,e)+"```"+t+"\n\n```\n"+this.text.slice(e),e=e+4+t.length):(this.text=this.text.slice(0,e)+"\n```"+t+"\n\n```\n"+this.text.slice(e),e=e+3+t.length):speechSynthesis==0||this.text[e-1]==` `?(this.text=this.text.slice(0,e)+"```"+t+` `+this.text.slice(e,n)+"\n```\n"+this.text.slice(n),e=e+4+t.length):(this.text=this.text.slice(0,e)+"\n```"+t+` -`+this.text.slice(e,n)+"\n```\n"+this.text.slice(n),e=e+3+t.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(t){const e=t.target,n=e.selectionStart,s=e.selectionEnd,i=e.value.substring(0,n),r=e.value.substring(s),o=i+" "+r;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=n+4}),t.preventDefault()},mdTextarea_changed(){console.log("mdTextarea_changed"),this.cursorPosition=this.$refs.mdTextarea.selectionStart},mdTextarea_clicked(){console.log(`mdTextarea_clicked: ${this.$refs.mdTextarea.selectionStart}`),this.cursorPosition=this.$refs.mdTextarea.selectionStart},setModel(){this.selecting_model=!0,de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:this.selectedModel}).then(t=>{console.log(t),t.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(t=>{this.$refs.toast.showToast(`Error ${t}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){console.log("READING..."),this.isSynthesizingVoice=!0;let t=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,n=this.text;t!=e&&(n=n.slice(t,e)),de.post("./text2Wave",{text:n}).then(s=>{console.log(s.data.url);let i=s.data.url;this.audio_url=i,this.isSynthesizingVoice=!1,Ue(()=>{Ge.replace()})}).catch(s=>{this.$refs.toast.showToast(`Error: ${s}`,4,!1),this.isSynthesizingVoice=!1,Ue(()=>{Ge.replace()})})},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let t=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(i=>i.name===this.$store.state.config.audio_out_voice)[0]);const n=i=>{let r=this.text.substring(i,i+e);const o=[".","!","?",` +`+this.text.slice(e,n)+"\n```\n"+this.text.slice(n),e=e+3+t.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(t){const e=t.target,n=e.selectionStart,s=e.selectionEnd,i=e.value.substring(0,n),r=e.value.substring(s),o=i+" "+r;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=n+4}),t.preventDefault()},mdTextarea_changed(){console.log("mdTextarea_changed"),this.cursorPosition=this.$refs.mdTextarea.selectionStart},mdTextarea_clicked(){console.log(`mdTextarea_clicked: ${this.$refs.mdTextarea.selectionStart}`),this.cursorPosition=this.$refs.mdTextarea.selectionStart},setModel(){this.selecting_model=!0,de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:this.selectedModel}).then(t=>{console.log(t),t.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(t=>{this.$refs.toast.showToast(`Error ${t}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){console.log("READING..."),this.isSynthesizingVoice=!0;let t=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,n=this.text;t!=e&&(n=n.slice(t,e)),de.post("./text2Wave",{client_id:this.$store.state.client_id,text:n}).then(s=>{console.log(s.data.url);let i=s.data.url;this.audio_url=i,this.isSynthesizingVoice=!1,Ue(()=>{Ge.replace()})}).catch(s=>{this.$refs.toast.showToast(`Error: ${s}`,4,!1),this.isSynthesizingVoice=!1,Ue(()=>{Ge.replace()})})},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let t=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(i=>i.name===this.$store.state.config.audio_out_voice)[0]);const n=i=>{let r=this.text.substring(i,i+e);const o=[".","!","?",` `];let a=-1;return o.forEach(c=>{const u=r.lastIndexOf(c);u>a&&(a=u)}),a==-1&&(a=r.length),console.log(a),a+i+1},s=()=>{const i=n(t),r=this.text.substring(t,i);this.msg.text=r,t=i+1,this.msg.onend=o=>{t{s()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",i))},this.speechSynthesis.speak(this.msg)};s()},getCursorPosition(){return this.$refs.mdTextarea.selectionStart},appendToOutput(t){this.pre_text+=t,this.text=this.pre_text+this.post_text},generate_in_placeholder(){console.log("Finding cursor position");let t=this.text.indexOf("@@");if(t<0){this.$refs.toast.showToast("No generation placeholder found",4,!1);return}this.text=this.text.substring(0,t)+this.text.substring(t+26,this.text.length),this.pre_text=this.text.substring(0,t),this.post_text=this.text.substring(t,this.text.length);var e=this.text.substring(0,t);console.log(e),qe.emit("generate_text",{prompt:e,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},async tokenize_text(){const t=await de.post("/lollms_tokenize",{prompt:this.text},{headers:this.posts_headers});console.log(t.data.named_tokens),this.namedTokens=t.data.named_tokens},generate(){console.log("Finding cursor position"),this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length);var t=this.text.substring(0,this.getCursorPosition());console.log(this.text),console.log(`cursor position :${this.getCursorPosition()}`),console.log(`pretext:${this.pre_text}`),console.log(`post_text:${this.post_text}`),console.log(`prompt:${t}`),qe.emit("generate_text",{prompt:t,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},stopGeneration(){qe.emit("cancel_text_generation",{})},exportText(){const t=this.text,e=document.createElement("a"),n=new Blob([t],{type:"text/plain"});e.href=URL.createObjectURL(n),e.download="exported_text.txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},importText(){const t=document.getElementById("import-input");t&&(t.addEventListener("change",e=>{if(e.target.files&&e.target.files[0]){const n=new FileReader;n.onload=()=>{this.text=n.result},n.readAsText(e.target.files[0])}else alert("Please select a file.")}),t.click())},setPreset(){console.log("Setting preset"),console.log(this.selectedPreset),this.tab_id="render",this.text=MZe(this.selectedPreset.content,t=>{console.log("Done"),console.log(t),this.text=t})},addPreset(){let t=prompt("Enter the title of the preset:");this.presets[t]={client_id:this.$store.state.client_id,name:t,content:this.text},de.post("./add_preset",this.presets[t]).then(e=>{console.log(e.data)}).catch(e=>{this.$refs.toast.showToast(`Error: ${e}`,4,!1)})},removePreset(){this.selectedPreset&&delete this.presets[this.selectedPreset.name]},reloadPresets(){de.get("./get_presets").then(t=>{console.log(t.data),this.presets=t.data,this.selectedPreset=this.presets[0]}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)})},startRecording(){this.pending=!0,this.is_recording?de.post("/stop_recording",{client_id:this.$store.state.client_id}).then(t=>{this.is_recording=!1,this.pending=!1,console.log(t),this.text+=t.data.text,console.log(t.data),this.presets=t.data,this.selectedPreset=this.presets[0]}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)}):de.post("/start_recording",{client_id:this.$store.state.client_id}).then(t=>{this.is_recording=!0,this.pending=!1,console.log(t.data)}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)})},startRecordingAndTranscribing(){this.pending=!0,this.is_deaf_transcribing?de.get("/stop_recording").then(t=>{this.is_deaf_transcribing=!1,this.pending=!1,this.text=t.data.text,this.read()}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)}):de.get("/start_recording").then(t=>{this.is_deaf_transcribing=!0,this.pending=!1}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)})},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length),this.recognition.onresult=t=>{this.generated="";for(let e=t.resultIndex;e{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=t=>{console.error("Speech recognition error:",t.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,this.pre_text=this.pre_text+this.generated,this.cursorPosition=this.pre_text.length,clearTimeout(this.silenceTimer)},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")}}},kZe={class:"container w-full bg-bg-light dark:bg-bg-dark shadow-lg overflow-y-auto 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"},LZe={class:"container flex flex-row m-2 w-full"},PZe={class:"flex-grow max-w-[900px] m-2"},UZe={class:"flex gap-3 flex-1 items-center flex-grow flex-row m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4"},FZe=l("i",{"data-feather":"pen-tool"},null,-1),BZe=[FZe],GZe=l("i",{"data-feather":"archive"},null,-1),VZe=[GZe],zZe=["src"],HZe=l("span",{class:"w-80"},null,-1),qZe=l("i",{"data-feather":"x"},null,-1),YZe=[qZe],$Ze=l("i",{"data-feather":"mic"},null,-1),WZe=[$Ze],KZe=l("i",{"data-feather":"volume-2"},null,-1),jZe=[KZe],QZe=l("i",{"data-feather":"speaker"},null,-1),XZe=[QZe],ZZe=["src"],JZe=["src"],eJe=["src"],tJe=["src"],nJe=l("i",{"data-feather":"voicemail"},null,-1),sJe=[nJe],iJe={key:1,"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"},rJe=l("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"},null,-1),oJe=l("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"},null,-1),aJe=[rJe,oJe],lJe=l("i",{"data-feather":"upload"},null,-1),cJe=[lJe],dJe=l("i",{"data-feather":"download"},null,-1),uJe=[dJe],pJe={class:"flex gap-3 flex-1 items-center flex-grow justify-end"},_Je=l("input",{type:"file",id:"import-input",class:"hidden"},null,-1),hJe={key:0},fJe={class:"flex flex-row justify-end mx-2"},mJe=["src"],gJe=["src"],bJe=["src"],EJe=["src"],yJe=["src"],vJe=["src"],SJe=["src"],TJe=["src"],xJe=l("i",{"data-feather":"copy"},null,-1),CJe=[xJe],wJe=["src"],RJe={key:2},AJe=["value"],NJe={key:0,title:"Selecting model",class:"flex flex-row flex-grow justify-end"},OJe=l("div",{role:"status"},[l("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"},[l("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"}),l("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"})]),l("span",{class:"sr-only"},"Selecting model...")],-1),IJe=[OJe],MJe=["value"],DJe=l("br",null,null,-1),kJe=l("i",{"data-feather":"check"},null,-1),LJe=[kJe],PJe=l("i",{"data-feather":"plus"},null,-1),UJe=[PJe],FJe=l("i",{"data-feather":"x"},null,-1),BJe=[FJe],GJe=l("i",{"data-feather":"refresh-ccw"},null,-1),VJe=[GJe],zJe={class:"slider-container ml-2 mr-2"},HJe=l("h3",{class:"text-gray-600"},"Temperature",-1),qJe={class:"slider-value text-gray-500"},YJe={class:"slider-container ml-2 mr-2"},$Je=l("h3",{class:"text-gray-600"},"Top K",-1),WJe={class:"slider-value text-gray-500"},KJe={class:"slider-container ml-2 mr-2"},jJe=l("h3",{class:"text-gray-600"},"Top P",-1),QJe={class:"slider-value text-gray-500"},XJe={class:"slider-container ml-2 mr-2"},ZJe=l("h3",{class:"text-gray-600"},"Repeat Penalty",-1),JJe={class:"slider-value text-gray-500"},eet={class:"slider-container ml-2 mr-2"},tet=l("h3",{class:"text-gray-600"},"Repeat Last N",-1),net={class:"slider-value text-gray-500"},set={class:"slider-container ml-2 mr-2"},iet=l("h3",{class:"text-gray-600"},"Number of tokens to crop the text to",-1),ret={class:"slider-value text-gray-500"},oet={class:"slider-container ml-2 mr-2"},aet=l("h3",{class:"text-gray-600"},"Number of tokens to generate",-1),cet={class:"slider-value text-gray-500"},det={class:"slider-container ml-2 mr-2"},uet=l("h3",{class:"text-gray-600"},"Seed",-1),pet={class:"slider-value text-gray-500"};function _et(t,e,n,s,i,r){const o=ut("tokens-hilighter"),a=ut("MarkdownRenderer"),c=ut("Card"),u=ut("Toast");return T(),R(Ve,null,[l("div",kZe,[l("div",LZe,[l("div",PZe,[l("div",UZe,[F(l("button",{id:"generate-button",title:"Generate from current cursor position",onClick:e[0]||(e[0]=(...d)=>r.generate&&r.generate(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},BZe,512),[[Ot,!i.generating]]),F(l("button",{id:"generate-next-button",title:"Generate from next place holder",onClick:e[1]||(e[1]=(...d)=>r.generate_in_placeholder&&r.generate_in_placeholder(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},VZe,512),[[Ot,!i.generating]]),F(l("button",{id:"tokenize",title:"Tokenize text",onClick:e[2]||(e[2]=(...d)=>r.tokenize_text&&r.tokenize_text(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},[l("img",{width:"25",height:"25",src:i.tokenize_icon},null,8,zZe)],512),[[Ot,!i.generating]]),HZe,F(l("button",{id:"stop-button",onClick:e[3]||(e[3]=(...d)=>r.stopGeneration&&r.stopGeneration(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},YZe,512),[[Ot,i.generating]]),l("button",{type:"button",title:"Dictate (using your browser for transcription)",onClick:e[4]||(e[4]=(...d)=>r.startSpeechRecognition&&r.startSpeechRecognition(...d)),class:Fe([{"text-red-500":i.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},WZe,2),l("button",{title:"convert text to audio (not saved and uses your browser tts service)",onClick:e[5]||(e[5]=ae(d=>r.speak(),["stop"])),class:Fe([{"text-red-500":r.isTalking},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},jZe,2),l("input",{type:"file",ref:"fileInput",onChange:e[6]||(e[6]=(...d)=>r.handleFileUpload&&r.handleFileUpload(...d)),style:{display:"none"},accept:".wav"},null,544),l("button",{title:"Upload a voice",onClick:e[7]||(e[7]=(...d)=>r.triggerFileUpload&&r.triggerFileUpload(...d))},XZe),l("button",{type:"button",title:"Start audio to audio",onClick:e[8]||(e[8]=(...d)=>r.startRecordingAndTranscribing&&r.startRecordingAndTranscribing(...d)),class:Fe([{"text-green-500":i.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[i.pending?G("",!0):(T(),R("img",{key:0,src:i.is_deaf_transcribing?i.deaf_on:i.deaf_off,height:"25"},null,8,ZZe)),i.pending?(T(),R("img",{key:1,src:i.loading_icon,height:"25"},null,8,JZe)):G("",!0)],2),l("button",{type:"button",title:"Start recording audio",onClick:e[9]||(e[9]=(...d)=>r.startRecording&&r.startRecording(...d)),class:Fe([{"text-green-500":i.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"])},[i.pending?G("",!0):(T(),R("img",{key:0,src:i.is_recording?i.rec_on:i.rec_off,height:"25"},null,8,eJe)),i.pending?(T(),R("img",{key:1,src:i.loading_icon,height:"25"},null,8,tJe)):G("",!0)],2),i.isSynthesizingVoice?(T(),R("svg",iJe,aJe)):(T(),R("button",{key:0,title:"generate audio from the text",onClick:e[10]||(e[10]=ae(d=>r.read(),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},sJe)),F(l("button",{id:"export-button",onClick:e[11]||(e[11]=(...d)=>r.exportText&&r.exportText(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},cJe,512),[[Ot,!i.generating]]),F(l("button",{id:"import-button",onClick:e[12]||(e[12]=(...d)=>r.importText&&r.importText(...d)),class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"},uJe,512),[[Ot,!i.generating]]),l("div",pJe,[l("button",{class:Fe(["border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer",{"bg-blue-200 dark:bg-blue-500":i.tab_id=="source"}]),onClick:e[13]||(e[13]=d=>i.tab_id="source")}," Source ",2),l("button",{class:Fe(["border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer",{"bg-blue-200 dark:bg-blue-500":i.tab_id=="render"}]),onClick:e[14]||(e[14]=d=>i.tab_id="render")}," Render ",2)]),_Je]),l("div",{class:Fe(["flex-grow m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4",{"border-red-500":i.generating}])},[i.tab_id==="source"?(T(),R("div",hJe,[l("div",fJe,[l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[15]||(e[15]=ae(d=>r.addBlock(""),["stop"]))},[l("img",{src:i.code_block,width:"25",height:"25"},null,8,mJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[16]||(e[16]=ae(d=>r.addBlock("python"),["stop"]))},[l("img",{src:i.python_block,width:"25",height:"25"},null,8,gJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add javascript block",onClick:e[17]||(e[17]=ae(d=>r.addBlock("javascript"),["stop"]))},[l("img",{src:i.javascript_block,width:"25",height:"25"},null,8,bJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add json block",onClick:e[18]||(e[18]=ae(d=>r.addBlock("json"),["stop"]))},[l("img",{src:i.json_block,width:"25",height:"25"},null,8,EJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add c++ block",onClick:e[19]||(e[19]=ae(d=>r.addBlock("c++"),["stop"]))},[l("img",{src:i.cpp_block,width:"25",height:"25"},null,8,yJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add html block",onClick:e[20]||(e[20]=ae(d=>r.addBlock("html"),["stop"]))},[l("img",{src:i.html5_block,width:"25",height:"25"},null,8,vJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add LaTex block",onClick:e[21]||(e[21]=ae(d=>r.addBlock("latex"),["stop"]))},[l("img",{src:i.LaTeX_block,width:"25",height:"25"},null,8,SJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add bash block",onClick:e[22]||(e[22]=ae(d=>r.addBlock("bash"),["stop"]))},[l("img",{src:i.bash_block,width:"25",height:"25"},null,8,TJe)]),l("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Copy message to clipboard",onClick:e[23]||(e[23]=ae(d=>t.copyContentToClipboard(),["stop"]))},CJe)]),F(l("textarea",{ref:"mdTextarea",onKeydown:e[24]||(e[24]=Ni(ae((...d)=>r.insertTab&&r.insertTab(...d),["prevent"]),["tab"])),class:"block min-h-500 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,style:jt({minHeight:i.mdRenderHeight+"px"}),placeholder:"Enter message here...","onUpdate:modelValue":e[25]||(e[25]=d=>i.text=d),onClick:e[26]||(e[26]=ae((...d)=>r.mdTextarea_clicked&&r.mdTextarea_clicked(...d),["prevent"])),onChange:e[27]||(e[27]=ae((...d)=>r.mdTextarea_changed&&r.mdTextarea_changed(...d),["prevent"]))},`\r `,36),[[pe,i.text]]),l("span",null,"Cursor position "+ee(i.cursorPosition),1)])):G("",!0),i.audio_url!=null?(T(),R("audio",{controls:"",key:i.audio_url},[l("source",{src:i.audio_url,type:"audio/wav",ref:"audio_player"},null,8,wJe),je(" Your browser does not support the audio element. ")])):G("",!0),he(o,{namedTokens:i.namedTokens},null,8,["namedTokens"]),i.tab_id==="render"?(T(),R("div",RJe,[he(a,{ref:"mdRender",client_id:this.$store.state.client_id,message_id:0,discussion_id:0,"markdown-text":i.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["client_id","markdown-text"])])):G("",!0)],2)]),he(c,{title:"settings",class:"slider-container ml-0 mr-0",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:He(()=>[he(c,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:He(()=>[F(l("select",{"onUpdate:modelValue":e[28]||(e[28]=d=>this.$store.state.selectedModel=d),onChange:e[29]||(e[29]=(...d)=>r.setModel&&r.setModel(...d)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(T(!0),R(Ve,null,Je(r.models,d=>(T(),R("option",{key:d,value:d},ee(d),9,AJe))),128))],544),[[Vt,this.$store.state.selectedModel]]),i.selecting_model?(T(),R("div",NJe,IJe)):G("",!0)]),_:1}),he(c,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:He(()=>[F(l("select",{"onUpdate:modelValue":e[30]||(e[30]=d=>i.selectedPreset=d),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(T(!0),R(Ve,null,Je(i.presets,d=>(T(),R("option",{key:d,value:d},ee(d.name),9,MJe))),128))],512),[[Vt,i.selectedPreset]]),DJe,l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[31]||(e[31]=(...d)=>r.setPreset&&r.setPreset(...d)),title:"Use preset"},LJe),l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[32]||(e[32]=(...d)=>r.addPreset&&r.addPreset(...d)),title:"Add this text as a preset"},UJe),l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[33]||(e[33]=(...d)=>r.removePreset&&r.removePreset(...d)),title:"Remove preset"},BJe),l("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[34]||(e[34]=(...d)=>r.reloadPresets&&r.reloadPresets(...d)),title:"Reload presets list"},VJe)]),_:1}),he(c,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:He(()=>[l("div",zJe,[HJe,F(l("input",{type:"range","onUpdate:modelValue":e[35]||(e[35]=d=>i.temperature=d),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[pe,i.temperature]]),l("span",qJe,"Current value: "+ee(i.temperature),1)]),l("div",YJe,[$Je,F(l("input",{type:"range","onUpdate:modelValue":e[36]||(e[36]=d=>i.top_k=d),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[pe,i.top_k]]),l("span",WJe,"Current value: "+ee(i.top_k),1)]),l("div",KJe,[jJe,F(l("input",{type:"range","onUpdate:modelValue":e[37]||(e[37]=d=>i.top_p=d),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[pe,i.top_p]]),l("span",QJe,"Current value: "+ee(i.top_p),1)]),l("div",XJe,[ZJe,F(l("input",{type:"range","onUpdate:modelValue":e[38]||(e[38]=d=>i.repeat_penalty=d),min:"0",max:"5",step:"0.1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.repeat_penalty]]),l("span",JJe,"Current value: "+ee(i.repeat_penalty),1)]),l("div",eet,[tet,F(l("input",{type:"range","onUpdate:modelValue":e[39]||(e[39]=d=>i.repeat_last_n=d),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.repeat_last_n]]),l("span",net,"Current value: "+ee(i.repeat_last_n),1)]),l("div",set,[iet,F(l("input",{type:"number","onUpdate:modelValue":e[40]||(e[40]=d=>i.n_crop=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.n_crop]]),l("span",ret,"Current value: "+ee(i.n_crop),1)]),l("div",oet,[aet,F(l("input",{type:"number","onUpdate:modelValue":e[41]||(e[41]=d=>i.n_predicts=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.n_predicts]]),l("span",cet,"Current value: "+ee(i.n_predicts),1)]),l("div",det,[uet,F(l("input",{type:"number","onUpdate:modelValue":e[42]||(e[42]=d=>i.seed=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[pe,i.seed]]),l("span",pet,"Current value: "+ee(i.seed),1)])]),_:1})]),_:1})])]),he(u,{ref:"toast"},null,512)],64)}const het=ct(DZe,[["render",_et]]);const fet={data(){return{activeExtension:null}},computed:{activeExtensions(){return console.log(this.$store.state.extensionsZoo),console.log(hI(this.$store.state.extensionsZoo)),this.$store.state.extensionsZoo}},methods:{showExtensionPage(t){this.activeExtension=t}}},met={class:"container overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll w-full 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"},get={key:0},bet=["onClick"],Eet={key:0},yet=["src"],vet={key:1},Tet=l("p",null,"No extension is active. Please install and activate an extension.",-1),xet=[Tet];function Cet(t,e,n,s,i,r){return T(),R("div",met,[r.activeExtensions.length>0?(T(),R("div",get,[(T(!0),R(Ve,null,Je(r.activeExtensions,o=>(T(),R("div",{key:o.name,onClick:a=>r.showExtensionPage(o)},[l("div",{class:Fe({"active-tab":o===i.activeExtension})},ee(o.name),3)],8,bet))),128)),i.activeExtension?(T(),R("div",Eet,[l("iframe",{src:i.activeExtension.page,width:"100%",height:"500px",frameborder:"0"},null,8,yet)])):G("",!0)])):(T(),R("div",vet,xet))])}const wet=ct(fet,[["render",Cet]]),Ret={},Aet={style:{width:"100vw",height:"100vh"}},Net=l("iframe",{src:"/help/index.html",class:"m-0 p-0 w-full h-full"},null,-1),Oet=[Net];function Iet(t,e,n,s,i,r){return T(),R("div",Aet,Oet)}const Met=ct(Ret,[["render",Iet]]);function Xs(t,e=!0,n=1){const s=e?1e3:1024;if(Math.abs(t)=s&&r{Ge.replace()})},executeCommand(t){this.isMenuOpen=!1,console.log("Selected"),console.log(t.value),typeof t.value=="function"&&(console.log("Command detected",t),t.value()),this.execute_cmd&&(console.log("executing generic command"),this.execute_cmd(t))},positionMenu(){var t;if(this.$refs.menuButton!=null){if(this.force_position==0||this.force_position==null){const e=this.$refs.menuButton.getBoundingClientRect(),n=window.innerHeight;t=e.bottom>n/2}else this.force_position==1?t=!0:t=!1;this.menuPosition.top=t?"auto":"calc(100% + 10px)",this.menuPosition.bottom=t?"100%":"auto"}}},mounted(){window.addEventListener("resize",this.positionMenu),this.positionMenu(),Ue(()=>{Ge.replace()})},beforeDestroy(){window.removeEventListener("resize",this.positionMenu)},watch:{isMenuOpen:"positionMenu"}},ket={class:"menu-container"},Let=["title"],Pet=["src"],Uet=["data-feather"],Fet={key:2,class:"w-5 h-5"},Bet={key:3,"data-feather":"menu"},Get={class:"flex-grow menu-ul"},Vet=["onClick"],zet={key:0,"data-feather":"check"},Het=["src","alt"],qet=["data-feather"],Yet={key:3,class:"menu-icon"};function $et(t,e,n,s,i,r){return T(),R("div",ket,[l("button",{onClick:e[0]||(e[0]=ae((...o)=>r.toggleMenu&&r.toggleMenu(...o),["prevent"])),title:n.title,class:Fe([n.menuIconClass,"menu-button m-0 p-0 bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 rounded flex items-center justify-center w-6 h-6 border-none cursor-pointer hover:bg-blue-400 w-8 h-8 object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-gray-300 border-secondary cursor-pointer"]),ref:"menuButton"},[n.icon&&!n.icon.includes("#")&&!n.icon.includes("feather")?(T(),R("img",{key:0,src:n.icon,class:"w-5 h-5 p-0 m-0 shadow-lg bold"},null,8,Pet)):n.icon&&n.icon.includes("feather")?(T(),R("i",{key:1,"data-feather":n.icon.split(":")[1],class:"w-5 h-5"},null,8,Uet)):n.icon&&n.icon.includes("#")?(T(),R("p",Fet,ee(n.icon.split("#")[1]),1)):(T(),R("i",Bet))],10,Let),he(Ds,{name:"slide"},{default:He(()=>[i.isMenuOpen?(T(),R("div",{key:0,class:"menu-list flex-grow",style:jt(i.menuPosition),ref:"menu"},[l("ul",Get,[(T(!0),R(Ve,null,Je(n.commands,(o,a)=>(T(),R("li",{key:a,onClick:ae(c=>r.executeCommand(o),["prevent"]),class:"menu-command menu-li flex-grow hover:bg-blue-400"},[n.selected_entry==o.name?(T(),R("i",zet)):o.icon&&!o.icon.includes("feather")&&!o.is_file?(T(),R("img",{key:1,src:o.icon,alt:o.name,class:"menu-icon"},null,8,Het)):G("",!0),o.icon&&o.icon.includes("feather")&&!o.is_file?(T(),R("i",{key:2,"data-feather":o.icon.split(":")[1],class:"mr-2"},null,8,qet)):(T(),R("span",Yet)),l("span",null,ee(o.name),1)],8,Vet))),128))])],4)):G("",!0)]),_:1})])}const eE=ct(Det,[["render",$et]]),Wet={components:{InteractiveMenu:eE},props:{isInstalled:Boolean,onInstall:Function,onCancelInstall:Function,onUninstall:Function,onSelected:Function,onCopy:Function,onCopyLink:Function,selected:Boolean,model:Object,model_type:String},data(){return{progress:0,speed:0,total_size:0,downloaded_size:0,start_time:"",installing:!1,uninstalling:!1,failedToLoad:!1,linkNotValid:!1,selected_variant:""}},async mounted(){Ue(()=>{Ge.replace()})},methods:{formatFileSize(t){return t<1024?t+" bytes":t<1024*1024?(t/1024).toFixed(2)+" KB":t<1024*1024*1024?(t/(1024*1024)).toFixed(2)+" MB":(t/(1024*1024*1024)).toFixed(2)+" GB"},computedFileSize(t){return Xs(t)},getImgUrl(){return this.model.icon==null||this.model.icon==="/images/default_model.png"?Rs:this.model.icon},defaultImg(t){t.target.src=Rs},install(){this.onInstall(this)},uninstall(){this.isInstalled&&this.onUninstall(this)},toggleInstall(){this.isInstalled?(this.uninstalling=!0,this.onUninstall(this)):this.onInstall(this)},toggleSelected(t){if(console.log("event.target.tagName.toLowerCase()"),console.log(t.target.tagName.toLowerCase()),t.target.tagName.toLowerCase()==="button"||t.target.tagName.toLowerCase()==="svg"){t.stopPropagation();return}this.onSelected(this),this.model.selected=!0,Ue(()=>{Ge.replace()})},toggleCopy(){this.onCopy(this)},toggleCopyLink(){this.onCopyLink(this)},toggleCancelInstall(){this.onCancelInstall(this),this.installing=!1},handleSelection(){this.isInstalled&&!this.selected&&this.onSelected(this)},copyContentToClipboard(){this.$emit("copy","this.message.content")}},computed:{computed_classes(){return this.model.isInstalled?this.selected?"border-4 border-gray-200 bg-primary cursor-pointer":"border-0 border-primary bg-primary cursor-pointer":"border-transparent"},commandsList(){let t=[{name:this.model.isInstalled?"Install Extra":"Install",icon:"feather:settings",is_file:!1,value:this.install},{name:"Copy model info to clipboard",icon:"feather:settings",is_file:!1,value:this.toggleCopy}];return this.model.isInstalled&&t.push({name:"UnInstall",icon:"feather:settings",is_file:!1,value:this.uninstall}),this.selected&&t.push({name:"Reload",icon:"feather:refresh-ccw",is_file:!1,value:this.toggleSelected}),t},selected_computed(){return this.selected},fileSize:{get(){if(this.model&&this.model.variants&&this.model.variants.length>0){const t=this.model.variants[0].size;return this.formatFileSize(t)}return null}},speed_computed(){return Xs(this.speed)},total_size_computed(){return Xs(this.total_size)},downloaded_size_computed(){return Xs(this.downloaded_size)}},watch:{linkNotValid(){Ue(()=>{Ge.replace()})}}},Ket=["title"],jet={key:0,class:"flex flex-row"},Qet={class:"max-w-[300px] overflow-x-auto"},Xet={class:"flex gap-3 items-center grow"},Zet=["href"],Jet=["src"],ett={class:"flex-1 overflow-hidden"},ttt={class:"font-bold font-large text-lg truncate"},ntt={key:1,class:"flex items-center flex-row gap-2 my-1"},stt={class:"flex grow items-center"},itt=l("i",{"data-feather":"box",class:"w-5"},null,-1),rtt=l("span",{class:"sr-only"},"Custom model / local model",-1),ott=[itt,rtt],att=l("span",{class:"sr-only"},"Remove",-1),ltt={key:2,class:"absolute z-10 -m-4 p-5 shadow-md text-center rounded-lg w-full h-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel bg-opacity-70 dark:bg-opacity-70 flex justify-center items-center"},ctt={class:"relative flex flex-col items-center justify-center flex-grow h-full"},dtt=l("div",{role:"status",class:"justify-center"},[l("svg",{"aria-hidden":"true",class:"w-24 h-24 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("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"}),l("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"})]),l("span",{class:"sr-only"},"Loading...")],-1),utt={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},ptt={class:"w-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel rounded-lg p-2"},_tt={class:"flex justify-between mb-1"},htt=l("span",{class:"text-base font-medium text-blue-700 dark:text-white"},"Downloading",-1),ftt={class:"text-sm font-medium text-blue-700 dark:text-white"},mtt={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},gtt={class:"flex justify-between mb-1"},btt={class:"text-base font-medium text-blue-700 dark:text-white"},Ett={class:"text-sm font-medium text-blue-700 dark:text-white"},ytt={class:"flex flex-grow"},vtt={class:"flex flex-row flex-grow gap-3"},Stt={class:"p-2 text-center grow"},Ttt={key:3},xtt={class:"flex flex-row items-center gap-3"},Ctt=["src"],wtt={class:"font-bold font-large text-lg truncate"},Rtt=l("div",{class:"grow"},null,-1),Att={class:"flex items-center flex-row-reverse gap-2 my-1"},Ntt={class:"flex flex-row items-center"},Ott={key:0,class:"text-base text-red-600 flex items-center mt-1"},Itt=l("i",{"data-feather":"alert-triangle",class:"flex-shrink-0 mx-1"},null,-1),Mtt=["title"],Dtt={class:""},ktt={class:"flex flex-row items-center"},Ltt=l("i",{"data-feather":"download",class:"w-5 m-1 flex-shrink-0"},null,-1),Ptt=l("b",null,"Card: ",-1),Utt=["href","title"],Ftt=l("div",{class:"grow"},null,-1),Btt=l("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Gtt=[Btt],Vtt={class:"flex items-center"},ztt=l("i",{"data-feather":"file",class:"w-5 m-1"},null,-1),Htt=l("b",null,"File size: ",-1),qtt={class:"flex items-center"},Ytt=l("i",{"data-feather":"key",class:"w-5 m-1"},null,-1),$tt=l("b",null,"License: ",-1),Wtt={key:0,class:"flex items-center"},Ktt=l("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),jtt=l("b",null,"quantizer: ",-1),Qtt=["href"],Xtt={class:"flex items-center"},Ztt=l("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),Jtt=l("b",null,"Model creator: ",-1),ent=["href"],tnt={class:"flex items-center"},nnt=l("i",{"data-feather":"clock",class:"w-5 m-1"},null,-1),snt=l("b",null,"Release date: ",-1),int={class:"flex items-center"},rnt=l("i",{"data-feather":"grid",class:"w-5 m-1"},null,-1),ont=l("b",null,"Category: ",-1),ant=["href"];function lnt(t,e,n,s,i,r){const o=ut("InteractiveMenu");return T(),R("div",{class:Fe(["relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none",r.computed_classes]),title:n.model.name,onClick:e[10]||(e[10]=ae(a=>r.toggleSelected(a),["prevent"]))},[n.model.isCustomModel?(T(),R("div",jet,[l("div",Qet,[l("div",Xet,[l("a",{href:n.model.model_creator_link,target:"_blank"},[l("img",{src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-lg object-fill"},null,40,Jet)],8,Zet),l("div",ett,[l("h3",ttt,ee(n.model.name),1)])])])])):G("",!0),n.model.isCustomModel?(T(),R("div",ntt,[l("div",stt,[l("button",{type:"button",title:"Custom model / local model",class:"font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",onClick:e[1]||(e[1]=ae(()=>{},["stop"]))},ott),je(" Custom model ")]),l("div",null,[n.model.isInstalled?(T(),R("button",{key:0,title:"Delete file from disk",type:"button",onClick:e[2]||(e[2]=ae((...a)=>r.uninstall&&r.uninstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"},[je(" Uninstall "),att])):G("",!0)])])):G("",!0),i.installing?(T(),R("div",ltt,[l("div",ctt,[dtt,l("div",utt,[l("div",ptt,[l("div",_tt,[htt,l("span",ftt,ee(Math.floor(i.progress))+"%",1)]),l("div",mtt,[l("div",{class:"bg-blue-600 h-2.5 rounded-full",style:jt({width:i.progress+"%"})},null,4)]),l("div",gtt,[l("span",btt,"Download speed: "+ee(r.speed_computed)+"/s",1),l("span",Ett,ee(r.downloaded_size_computed)+"/"+ee(r.total_size_computed),1)])])]),l("div",ytt,[l("div",vtt,[l("div",Stt,[l("button",{onClick:e[3]||(e[3]=ae((...a)=>r.toggleCancelInstall&&r.toggleCancelInstall(...a),["stop"])),type:"button",title:"Cancel download",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"}," Cancel ")])])])])])):G("",!0),n.model.isCustomModel?G("",!0):(T(),R("div",Ttt,[l("div",xtt,[l("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[4]||(e[4]=a=>r.defaultImg(a)),class:Fe(["w-10 h-10 rounded-lg object-fill",i.linkNotValid?"grayscale":""])},null,42,Ctt),l("h3",wtt,ee(n.model.name),1),Rtt,he(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])]),l("div",Att,[l("div",Ntt,[i.linkNotValid?(T(),R("div",Ott,[Itt,je(" Link is not valid ")])):G("",!0)])]),l("div",{class:"",title:n.model.isInstalled?n.model.name:"Not installed"},[l("div",Dtt,[l("div",ktt,[Ltt,Ptt,l("a",{href:"https://huggingface.co/"+n.model.quantizer+"/"+n.model.name,target:"_blank",onClick:e[5]||(e[5]=ae(()=>{},["stop"])),class:"m-1 flex items-center hover:text-secondary duration-75 active:scale-90 truncate",title:i.linkNotValid?"Link is not valid":"Download this manually (faster) and put it in the models/ folder then refresh"}," View full model card ",8,Utt),Ftt,l("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[6]||(e[6]=ae(a=>r.toggleCopyLink(),["stop"]))},Gtt)]),l("div",Vtt,[l("div",{class:Fe(["flex flex-shrink-0 items-center",i.linkNotValid?"text-red-600":""])},[ztt,Htt,je(" "+ee(r.fileSize),1)],2)]),l("div",qtt,[Ytt,$tt,je(" "+ee(n.model.license),1)]),n.model.quantizer!="None"&&n.model.type!="transformers"?(T(),R("div",Wtt,[Ktt,jtt,l("a",{href:"https://huggingface.co/"+n.model.quantizer,target:"_blank",rel:"noopener noreferrer",onClick:e[7]||(e[7]=ae(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},ee(n.model.quantizer),9,Qtt)])):G("",!0),l("div",Xtt,[Ztt,Jtt,l("a",{href:n.model.model_creator_link,target:"_blank",rel:"noopener noreferrer",onClick:e[8]||(e[8]=ae(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},ee(n.model.model_creator),9,ent)]),l("div",tnt,[nnt,snt,je(" "+ee(n.model.last_commit_time),1)]),l("div",int,[rnt,ont,l("a",{href:"https://huggingface.co/"+n.model.model_creator,target:"_blank",rel:"noopener noreferrer",onClick:e[9]||(e[9]=ae(()=>{},["stop"])),class:"flex hover:text-secondary duration-75 active:scale-90",title:"quantizer's profile"},ee(n.model.category),9,ant)])])],8,Mtt)]))],10,Ket)}const cnt=ct(Wet,[["render",lnt]]),dnt={data(){return{editMode:!1,avatar:"path/to/avatar.jpg",personalityName:"Personality Name",personalityAuthor:"Author Name",personalityDescription:"Personality Description",personalityCategory:"Category",disclaimer:"Disclaimer text",conditioningText:"Conditioning Text",aiPrefix:"AI Prefix",userPrefix:"User Prefix",antipromptsList:[{id:1,text:"Antiprompt 1"},{id:2,text:"Antiprompt 2"},{id:3,text:"Antiprompt 3"}]}},methods:{commitChanges(){console.log("Personality changes committed"),this.editMode=!1}}},unt={class:"p-4"},pnt={class:"flex items-center mb-4"},_nt=["src"],hnt={class:"text-lg font-semibold"},fnt=l("strong",null,"Author:",-1),mnt=l("strong",null,"Description:",-1),gnt=l("strong",null,"Category:",-1),bnt={key:0},Ent=l("strong",null,"Disclaimer:",-1),ynt=l("strong",null,"Conditioning Text:",-1),vnt=l("strong",null,"AI Prefix:",-1),Snt=l("strong",null,"User Prefix:",-1),Tnt=l("strong",null,"Antiprompts:",-1);function xnt(t,e,n,s,i,r){return T(),R("div",unt,[l("div",pnt,[l("img",{src:i.avatar,class:"w-12 h-12 rounded-full mr-2",alt:"Avatar"},null,8,_nt),l("h2",hnt,ee(i.personalityName),1)]),l("p",null,[fnt,je(" "+ee(i.personalityAuthor),1)]),l("p",null,[mnt,je(" "+ee(i.personalityDescription),1)]),l("p",null,[gnt,je(" "+ee(i.personalityCategory),1)]),i.disclaimer?(T(),R("p",bnt,[Ent,je(" "+ee(i.disclaimer),1)])):G("",!0),l("p",null,[ynt,je(" "+ee(i.conditioningText),1)]),l("p",null,[vnt,je(" "+ee(i.aiPrefix),1)]),l("p",null,[Snt,je(" "+ee(i.userPrefix),1)]),l("div",null,[Tnt,l("ul",null,[(T(!0),R(Ve,null,Je(i.antipromptsList,o=>(T(),R("li",{key:o.id},ee(o.text),1))),128))])]),l("button",{onClick:e[0]||(e[0]=o=>i.editMode=!0),class:"mt-4 bg-blue-500 text-white px-4 py-2 rounded"}," Edit "),i.editMode?(T(),R("button",{key:1,onClick:e[1]||(e[1]=(...o)=>r.commitChanges&&r.commitChanges(...o)),class:"mt-4 bg-green-500 text-white px-4 py-2 rounded"}," Commit ")):G("",!0)])}const Cnt=ct(dnt,[["render",xnt]]),Vu="/assets/logo-9d653710.svg",wnt="/",Rnt={props:{personality:{},select_language:Boolean,selected:Boolean,full_path:String,onTalk:Function,onOpenFolder:Function,onSelected:Function,onMount:Function,onUnMount:Function,onRemount:Function,onCopyToCustom:Function,onEdit:Function,onReinstall:Function,onSettings:Function,onCopyPersonalityName:Function},components:{InteractiveMenu:eE},data(){return{isMounted:!1,name:this.personality.name,thumbnailVisible:!1,thumbnailPosition:{x:0,y:0}}},computed:{commandsList(){let t=[{name:this.isMounted?"unmount":"mount",icon:"feather:settings",is_file:!1,value:this.isMounted?this.unmount:this.mount},{name:"reinstall",icon:"feather:terminal",is_file:!1,value:this.toggleReinstall}];return console.log("this.category",this.personality.category),this.personality.category=="custom_personalities"?t.push({name:"edit",icon:"feather:settings",is_file:!1,value:this.edit}):t.push({name:"Copy to custom personas folder for editing",icon:"feather:copy",is_file:!1,value:this.copyToCustom}),this.isMounted&&t.push({name:"remount",icon:"feather:refresh-ccw",is_file:!1,value:this.reMount}),this.selected&&this.personality.has_scripts&&t.push({name:"settings",icon:"feather:settings",is_file:!1,value:this.toggleSettings}),t},selected_computed(){return this.selected}},mounted(){this.isMounted=this.personality.isMounted,Ue(()=>{Ge.replace()})},methods:{showThumbnail(){this.thumbnailVisible=!0},hideThumbnail(){this.thumbnailVisible=!1},updateThumbnailPosition(t){this.thumbnailPosition={x:t.clientX+10,y:t.clientY+10}},getImgUrl(){return wnt+this.personality.avatar},defaultImg(t){t.target.src=Vu},showFolder(){this.onOpenFolder(this)},toggleTalk(){this.onTalk(this)},toggleCopyLink(){this.onCopyPersonalityName(this)},toggleSelected(){this.isMounted&&this.onSelected(this)},edit(){this.onEdit(this)},copyToCustom(){this.onCopyToCustom(this)},reMount(){this.onRemount(this)},mount(){console.log("Mounting"),this.onMount(this)},unmount(){console.log("Unmounting"),console.log(this.onUnMount),this.onUnMount(this),this.isMounted=!1},toggleSettings(){this.onSettings(this)},toggleReinstall(){this.onReinstall(this)}},watch:{selected(){Ue(()=>{Ge.replace()})}}},Ant=["title"],Nnt={class:"flex flex-row items-center flex-shrink-0 gap-3"},Ont=["src"],Int=l("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Mnt=[Int],Dnt=["src"],knt={class:""},Lnt={class:""},Pnt={class:"flex items-center"},Unt=l("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),Fnt=l("b",null,"Author: ",-1),Bnt={class:"flex items-center"},Gnt=l("i",{"data-feather":"git-commit",class:"w-5 m-1"},null,-1),Vnt=l("b",null,"Version: ",-1),znt={key:0,class:"flex items-center"},Hnt=l("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),qnt=l("b",null,"Languages: ",-1),Ynt=["selected"],$nt={key:1,class:"flex items-center"},Wnt=l("i",{"data-feather":"globe",class:"w-5 m-1"},null,-1),Knt=l("b",null,"Language: ",-1),jnt={class:"flex items-center"},Qnt=l("i",{"data-feather":"bookmark",class:"w-5 m-1"},null,-1),Xnt=l("b",null,"Category: ",-1),Znt=l("div",{class:"flex items-center"},[l("i",{"data-feather":"info",class:"w-5 m-1"}),l("b",null,"Description: "),l("br")],-1),Jnt=["title","innerHTML"],est={class:"rounded bg-blue-300"},tst=l("i",{"data-feather":"check"},null,-1),nst=l("span",{class:"sr-only"},"Select",-1),sst=[tst,nst],ist=l("i",{"data-feather":"send",class:"w-5"},null,-1),rst=l("span",{class:"sr-only"},"Talk",-1),ost=[ist,rst],ast=l("i",{"data-feather":"folder",class:"w-5"},null,-1),lst=l("span",{class:"sr-only"},"Show Folder",-1),cst=[ast,lst];function dst(t,e,n,s,i,r){const o=ut("InteractiveMenu");return T(),R("div",{class:Fe(["min-w-96 items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",r.selected_computed?"border-2 border-primary-light":"border-transparent",i.isMounted?"bg-blue-200 dark:bg-blue-700":""]),tabindex:"-1",title:n.personality.installed?"":"Not installed"},[l("div",{class:Fe(n.personality.installed?"":"border-red-500")},[l("div",Nnt,[l("img",{onClick:e[0]||(e[0]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),ref:"imgElement",src:r.getImgUrl(),onError:e[1]||(e[1]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-red-700 cursor-pointer",onMouseover:e[2]||(e[2]=(...a)=>r.showThumbnail&&r.showThumbnail(...a)),onMousemove:e[3]||(e[3]=(...a)=>r.updateThumbnailPosition&&r.updateThumbnailPosition(...a)),onMouseleave:e[4]||(e[4]=(...a)=>r.hideThumbnail&&r.hideThumbnail(...a))},null,40,Ont),l("h3",{onClick:e[5]||(e[5]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),class:"font-bold font-large text-lg line-clamp-3 cursor-pointer",onMouseover:e[6]||(e[6]=(...a)=>r.showThumbnail&&r.showThumbnail(...a)),onMousemove:e[7]||(e[7]=(...a)=>r.updateThumbnailPosition&&r.updateThumbnailPosition(...a)),onMouseleave:e[8]||(e[8]=(...a)=>r.hideThumbnail&&r.hideThumbnail(...a))},ee(n.personality.name),33),l("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[9]||(e[9]=ae(a=>r.toggleCopyLink(),["stop"]))},Mnt),i.thumbnailVisible?(T(),R("div",{key:0,style:jt({top:i.thumbnailPosition.y+"px",left:i.thumbnailPosition.x+"px"}),class:"fixed z-50 w-20 h-20 rounded-full overflow-hidden"},[l("img",{src:r.getImgUrl(),class:"w-full h-full object-fill"},null,8,Dnt)],4)):G("",!0)]),l("div",knt,[l("div",Lnt,[l("div",Pnt,[Unt,Fnt,je(" "+ee(n.personality.author),1)]),l("div",Bnt,[Gnt,Vnt,je(" "+ee(n.personality.version),1)]),n.personality.languages&&n.select_language?(T(),R("div",znt,[Hnt,qnt,i.isMounted?G("",!0):F((T(),R("select",{key:0,id:"languages","onUpdate:modelValue":e[10]||(e[10]=a=>n.personality.language=a),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 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"},[(T(!0),R(Ve,null,Je(n.personality.languages,(a,c)=>(T(),R("option",{key:c,selected:a==n.personality.languages[0]},ee(a),9,Ynt))),128))],512)),[[Vt,n.personality.language]])])):G("",!0),n.personality.language?(T(),R("div",$nt,[Wnt,Knt,je(" "+ee(n.personality.language),1)])):G("",!0),l("div",jnt,[Qnt,Xnt,je(" "+ee(n.personality.category),1)])]),Znt,l("p",{class:"mx-1 opacity-80 h-20 overflow-y-auto 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",title:n.personality.description,innerHTML:n.personality.description},null,8,Jnt)]),l("div",est,[i.isMounted?(T(),R("button",{key:0,type:"button",title:"Select",onClick:[e[11]||(e[11]=(...a)=>r.toggleSelected&&r.toggleSelected(...a)),e[12]||(e[12]=ae(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},sst)):G("",!0),i.isMounted?(T(),R("button",{key:1,type:"button",title:"Talk",onClick:[e[13]||(e[13]=(...a)=>r.toggleTalk&&r.toggleTalk(...a)),e[14]||(e[14]=ae(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},ost)):G("",!0),l("button",{type:"button",title:"Show_folder",onClick:[e[15]||(e[15]=(...a)=>r.showFolder&&r.showFolder(...a)),e[16]||(e[16]=ae(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},cst),he(o,{commands:r.commandsList,force_position:2,title:"Menu"},null,8,["commands"])])],2)],10,Ant)}const wN=ct(Rnt,[["render",dst]]);const ust={props:{ui:{type:String,required:!0,default:""}},watch:{ui(t,e){console.log(`ui changed from ${e} to ${t}`),this.$nextTick(()=>{this.evaluateScriptTags()})}},data(){return{}},mounted(){this.$nextTick(()=>{this.evaluateScriptTags()})},methods:{evaluateScriptTags(){console.log("evaluateScriptTags");const t=document.createElement("div");t.innerHTML=this.ui,t.querySelectorAll("script").forEach(n=>{const s=document.createElement("script");s.textContent=n.textContent,document.body.appendChild(s),document.body.removeChild(s)}),this.$refs.ui.innerHTML=t.innerHTML,console.log("this.$refs.ui.innerHTML"),console.log(this.$refs.ui.innerHTML)}}},pst={class:"w-full h-auto overflow-y-auto 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",ref:"ui"};function _st(t,e,n,s,i,r){return T(),R("div",pst,null,512)}const RN=ct(ust,[["render",_st]]),hst="/",fst={components:{DynamicUIRenderer:RN},props:{binding:{},onSelected:Function,onReinstall:Function,onInstall:Function,onUnInstall:Function,onSettings:Function,onReloadBinding:Function,selected:Boolean},data(){return{isTemplate:!1}},mounted(){Ue(()=>{Ge.replace()})},methods:{copyToClipBoard(t){console.log("Copying to clipboard :",t),navigator.clipboard.writeText(t)},getImgUrl(){return hst+this.binding.icon},defaultImg(t){t.target.src=Vu},toggleSelected(){this.onSelected(this)},toggleInstall(){this.onInstall(this)},toggleUnInstall(){this.onUnInstall(this)},toggleReinstall(){this.onReinstall(this)},toggleReloadBinding(){this.onReloadBinding(this)},toggleSettings(){this.onSettings(this)},getStatus(){(this.binding.folder==="backend_template"||this.binding.folder==="binding_template")&&(this.isTemplate=!0)}},watch:{selected(){Ue(()=>{Ge.replace()})}}},mst=["title"],gst={class:"flex flex-row items-center gap-3"},bst=["src"],Est={class:"font-bold font-large text-lg truncate"},yst=l("div",{class:"grow"},null,-1),vst={class:"flex-none gap-1"},Sst=l("i",{"data-feather":"refresh-cw",class:"w-5"},null,-1),Tst=l("span",{class:"sr-only"},"Help",-1),xst=[Sst,Tst],Cst={class:"flex items-center flex-row-reverse gap-2 my-1"},wst=l("span",{class:"sr-only"},"Click to install",-1),Rst=l("span",{class:"sr-only"},"Reinstall",-1),Ast=l("span",{class:"sr-only"},"UnInstall",-1),Nst=l("span",{class:"sr-only"},"Settings",-1),Ost={class:""},Ist={class:""},Mst={class:"flex items-center"},Dst=l("i",{"data-feather":"user",class:"w-5 m-1"},null,-1),kst=l("b",null,"Author: ",-1),Lst={class:"flex items-center"},Pst=l("i",{"data-feather":"folder",class:"w-5 m-1"},null,-1),Ust=l("b",null,"Folder: ",-1),Fst=l("div",{class:"grow"},null,-1),Bst=l("i",{"data-feather":"clipboard",class:"w-5"},null,-1),Gst=[Bst],Vst={class:"flex items-center"},zst=l("i",{"data-feather":"git-merge",class:"w-5 m-1"},null,-1),Hst=l("b",null,"Version: ",-1),qst={class:"flex items-center"},Yst=l("i",{"data-feather":"github",class:"w-5 m-1"},null,-1),$st=l("b",null,"Link: ",-1),Wst=["href"],Kst=l("div",{class:"flex items-center"},[l("i",{"data-feather":"info",class:"w-5 m-1"}),l("b",null,"Description: "),l("br")],-1),jst=["title","innerHTML"];function Qst(t,e,n,s,i,r){const o=ut("DynamicUIRenderer");return T(),R("div",{class:Fe(["items-start p-4 hover:bg-primary-light hover:border-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none",n.selected?" border-primary bg-primary":"border-transparent"]),onClick:e[8]||(e[8]=ae((...a)=>r.toggleSelected&&r.toggleSelected(...a),["stop"])),title:n.binding.installed?n.binding.name:"Not installed"},[l("div",null,[l("div",gst,[l("img",{ref:"imgElement",src:r.getImgUrl(),onError:e[0]||(e[0]=a=>r.defaultImg(a)),class:"w-10 h-10 rounded-full object-fill text-blue-700"},null,40,bst),l("h3",Est,ee(n.binding.name),1),yst,l("div",vst,[n.selected?(T(),R("button",{key:0,type:"button",title:"Reload binding",onClick:[e[1]||(e[1]=(...a)=>r.toggleReloadBinding&&r.toggleReloadBinding(...a)),e[2]||(e[2]=ae(()=>{},["stop"]))],class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center"},xst)):G("",!0)])]),l("div",Cst,[n.binding.installed?G("",!0):(T(),R("button",{key:0,title:"Click to install",type:"button",onClick:e[3]||(e[3]=ae((...a)=>r.toggleInstall&&r.toggleInstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},[je(" Install "),wst])),n.binding.installed?(T(),R("button",{key:1,title:"Click to Reinstall binding",type:"button",onClick:e[4]||(e[4]=ae((...a)=>r.toggleReinstall&&r.toggleReinstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-green-700 hover:bg-red-800 focus:ring-4 focus:ring-green-300 rounded-lg dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-red-900"},[je(" Reinstall "),Rst])):G("",!0),n.binding.installed?(T(),R("button",{key:2,title:"Click to Reinstall binding",type:"button",onClick:e[5]||(e[5]=ae((...a)=>r.toggleUnInstall&&r.toggleUnInstall(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"},[je(" Uninstall "),Ast])):G("",!0),n.selected?(T(),R("button",{key:3,title:"Click to open Settings",type:"button",onClick:e[6]||(e[6]=ae((...a)=>r.toggleSettings&&r.toggleSettings(...a),["stop"])),class:"inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},[je(" Settings "),Nst])):G("",!0)]),n.binding.ui?(T(),St(o,{key:0,class:"w-full h-full",code:n.binding.ui},null,8,["code"])):G("",!0),l("div",Ost,[l("div",Ist,[l("div",Mst,[Dst,kst,je(" "+ee(n.binding.author),1)]),l("div",Lst,[Pst,Ust,je(" "+ee(n.binding.folder)+" ",1),Fst,l("button",{class:"hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center",title:"Copy link to clipboard",onClick:e[7]||(e[7]=ae(a=>r.copyToClipBoard(this.binding.folder),["stop"]))},Gst)]),l("div",Vst,[zst,Hst,je(" "+ee(n.binding.version),1)]),l("div",qst,[Yst,$st,l("a",{href:n.binding.link,target:"_blank",class:"flex items-center hover:text-secondary duration-75 active:scale-90"},ee(n.binding.link),9,Wst)])]),Kst,l("p",{class:"mx-1 opacity-80 line-clamp-3",title:n.binding.description,innerHTML:n.binding.description},null,8,jst)])])],10,mst)}const Xst=ct(fst,[["render",Qst]]),Zst={data(){return{show:!1,model_path:"",resolve:null}},methods:{cancel(){this.resolve(null)},openInputBox(){return new Promise(t=>{this.resolve=t})},hide(t){this.show=!1,this.resolve&&(this.resolve(t),this.resolve=null)},showDialog(t){return new Promise(e=>{this.model_path=t,this.show=!0,this.resolve=e})}}},Jst={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50"},eit={class:"relative w-full max-w-md max-h-full"},tit={class:"relative bg-white rounded-lg shadow dark:bg-gray-700"},nit=l("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[l("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),sit=l("span",{class:"sr-only"},"Close modal",-1),iit=[nit,sit],rit={class:"p-4 text-center"},oit=l("svg",{"aria-hidden":"true",class:"mx-auto mb-4 text-gray-400 w-14 h-14 dark:text-gray-200",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[l("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),ait={class:"p-4 text-center mx-auto mb-4"},lit=l("label",{class:"mr-2"},"Model path",-1);function cit(t,e,n,s,i,r){return i.show?(T(),R("div",Jst,[l("div",eit,[l("div",tit,[l("button",{type:"button",onClick:e[0]||(e[0]=o=>r.hide(!1)),class:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white"},iit),l("div",rit,[oit,l("div",ait,[lit,F(l("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>i.model_path=o),class:"px-4 py-2 border border-gray-300 rounded-lg",type:"text"},null,512),[[pe,i.model_path]])]),l("button",{onClick:e[2]||(e[2]=o=>r.hide(!0)),type:"button",class:"text-white bg-green-600 hover:bg-green-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2"}," Add "),l("button",{onClick:e[3]||(e[3]=o=>r.hide(!1)),type:"button",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"},"No, cancel")])])])])):G("",!0)}const dit=ct(Zst,[["render",cit]]);const uit={props:{show:{type:Boolean,default:!1,required:!1},can_remove:{type:Boolean,default:!1},title:{type:String,default:"Select an option"},choices:{type:Array,required:!0}},data(){return{selectedChoice:null,showInput:!1,newFilename:""}},methods:{displayName(t){return console.log("choice:",t),typeof t=="string"?t:t&&t.name?t.name:""},selectChoice(t){this.selectedChoice=t,this.$emit("choice-selected",t)},closeDialog(){this.$emit("close-dialog")},validateChoice(){this.$emit("choice-validated",this.selectedChoice)},formatSize(t){return t<1024?t+" bytes":t<1024*1024?(t/1024).toFixed(2)+" KB":t<1024*1024*1024?(t/(1024*1024)).toFixed(2)+" MB":(t/(1024*1024*1024)).toFixed(2)+" GB"},toggleInput(){this.showInput=!this.showInput},addNewFilename(){const t=this.newFilename.trim();t!==""&&(this.choices.push(t),this.newFilename="",this.selectChoice(t)),this.showInput=!1},removeChoice(t,e){this.choices.splice(e,1),t===this.selectedChoice&&(this.selectedChoice=null),this.$emit("choice-removed",t)}}},pit={key:0,class:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-20"},_it={class:"bg-bg-light dark:bg-bg-dark rounded-lg p-6 w-96"},hit={class:"text-xl font-bold text-5xl drop-shadow-md align-middle"},fit={class:"h-48 text-light-text-panel dark:text-dark-text-panel bg-bg-light-tone-panel dark:bg-dark-tone-panel overflow-y-auto rounded drop-shadow-md overflow-y-auto 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"},mit=["onClick"],git={class:"font-bold text-dark-text-panel dark:text-light-text-panel"},bit=l("br",null,null,-1),Eit={key:0,class:"text-xs text-gray-500"},yit=["onClick"],vit={key:0,class:"flex flex-row mt-4 bg-light-tone-panel dark:bg-dark-tone-panel"},Sit={class:"flex justify-end mt-4"},Tit=["disabled"];function xit(t,e,n,s,i,r){return T(),St(Ds,{name:"fade"},{default:He(()=>[n.show?(T(),R("div",pit,[l("div",_it,[l("h2",hit,ee(n.title),1),l("div",fit,[l("ul",null,[(T(!0),R(Ve,null,Je(n.choices,(o,a)=>(T(),R("li",{key:a,onClick:c=>r.selectChoice(o),class:Fe([{"selected-choice":o===i.selectedChoice},"py-2 px-4 cursor-pointer hover:bg-accent dark:hover:bg-secondary"])},[l("span",git,ee(r.displayName(o)),1),bit,o.size?(T(),R("span",Eit,ee(r.formatSize(o.size)),1)):G("",!0),n.can_remove?(T(),R("button",{key:1,onClick:ae(c=>r.removeChoice(o,a),["stop"]),class:"ml-2 text-red-500 hover:text-red-600"}," X ",8,yit)):G("",!0)],10,mit))),128))])]),i.showInput?(T(),R("div",vit,[F(l("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>i.newFilename=o),placeholder:"Enter a filename",class:"border border-gray-300 p-2 rounded-lg w-full"},null,512),[[pe,i.newFilename]]),l("button",{onClick:e[1]||(e[1]=(...o)=>r.addNewFilename&&r.addNewFilename(...o)),class:"ml-2 grow pl-2 pr-2 bg-primary hover:bg-primary-light text-white rounded-lg transition duration-300"}," Add ")])):G("",!0),l("div",Sit,[l("button",{onClick:e[2]||(e[2]=(...o)=>r.closeDialog&&r.closeDialog(...o)),class:"py-2 px-4 mr-2 bg-secondary hover:bg-accent text-white rounded-lg transition duration-300"}," Cancel "),l("button",{onClick:e[3]||(e[3]=(...o)=>r.validateChoice&&r.validateChoice(...o)),class:Fe([{"bg-gray-400 cursor-not-allowed":!i.selectedChoice,"bg-primary hover:bg-primary-light":i.selectedChoice,"text-white":i.selectedChoice,"text-gray-500":!i.selectedChoice},"py-2 px-4 rounded-lg transition duration-300"]),disabled:!i.selectedChoice}," Validate ",10,Tit),l("button",{onClick:e[4]||(e[4]=(...o)=>r.toggleInput&&r.toggleInput(...o)),class:"py-2 px-4 ml-2 bg-accent hover:bg-secondary text-white rounded-lg transition duration-300"}," Add New ")])])])):G("",!0)]),_:1})}const tE=ct(uit,[["render",xit]]),Cit={props:{radioOptions:{type:Array,required:!0},defaultValue:{type:String,default:"0"}},data(){return{selectedValue:this.defaultValue}},computed:{selectedLabel(){const t=this.radioOptions.find(e=>e.value===this.selectedValue);return t?t.label:""}},watch:{selectedValue(t,e){this.$emit("radio-selected",t)}},methods:{handleRadioChange(){}}},wit={class:"flex space-x-4"},Rit=["value","aria-checked"],Ait={class:"text-gray-700"};function Nit(t,e,n,s,i,r){return T(),R("div",wit,[(T(!0),R(Ve,null,Je(n.radioOptions,(o,a)=>(T(),R("label",{key:o.value,class:"flex items-center space-x-2"},[F(l("input",{type:"radio",value:o.value,"onUpdate:modelValue":e[0]||(e[0]=c=>i.selectedValue=c),onChange:e[1]||(e[1]=(...c)=>r.handleRadioChange&&r.handleRadioChange(...c)),class:"text-blue-500 focus:ring-2 focus:ring-blue-200","aria-checked":i.selectedValue===o.value.toString(),role:"radio"},null,40,Rit),[[tD,i.selectedValue]]),l("span",Ait,ee(o.label),1)]))),128))])}const Oit=ct(Cit,[["render",Nit]]),Iit="/assets/gpu-df72bf63.svg";const Mit="/";de.defaults.baseURL="/";const Dit={components:{AddModelDialog:dit,ModelEntry:cnt,PersonalityViewer:Cnt,PersonalityEntry:wN,BindingEntry:Xst,ChoiceDialog:tE,Card:Gu,RadioOptions:Oit},data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},defaultModelImgPlaceholder:Rs,snd_input_devices:[],snd_input_devices_indexes:[],snd_output_devices:[],snd_output_devices_indexes:[],voices:[],voice_languages:{Arabic:"ar","Brazilian Portuguese":"pt",Chinese:"zh-cn",Czech:"cs",Dutch:"nl",English:"en",French:"fr",German:"de",Italian:"it",Polish:"pl",Russian:"ru",Spanish:"es",Turkish:"tr",Japanese:"ja",Korean:"ko",Hungarian:"hu",Hindi:"hi"},storeLogo:fs,binding_changed:!1,SVGGPU:Iit,models_zoo:[],models_zoo_initialLoadCount:10,models_zoo_loadMoreCount:5,models_zoo_loadedEntries:[],models_zoo_scrollThreshold:200,sortOptions:[{label:"Sort by Date",value:0},{label:"Sort by Rank",value:1},{label:"Sort by Name",value:2},{label:"Sort by Maker",value:3},{label:"Sort by Quantizer",value:4}],comfyui_models:[],show_only_installed_models:!1,reference_path:"",audioVoices:[],has_updates:!1,variant_choices:[],variantSelectionDialogVisible:!1,currenModelToInstall:null,loading_text:"",personality_category:null,addModelDialogVisibility:!1,modelPath:"",personalitiesFiltered:[],modelsFiltered:[],collapsedArr:[],all_collapsed:!0,data_conf_collapsed:!0,internet_conf_collapsed:!0,servers_conf_collapsed:!0,minconf_collapsed:!0,bec_collapsed:!0,sort_type:0,is_loading_zoo:!1,mzc_collapsed:!0,mzdc_collapsed:!0,pzc_collapsed:!0,bzc_collapsed:!0,pc_collapsed:!0,mc_collapsed:!0,sc_collapsed:!0,mzl_collapsed:!1,pzl_collapsed:!1,ezl_collapsed:!1,bzl_collapsed:!1,extCatgArr:[],persCatgArr:[],persArr:[],showConfirmation:!1,showToast:!1,isLoading:!1,settingsChanged:!1,isModelSelected:!1,isMounted:!1,bUrl:Mit,searchPersonality:"",searchModel:"",searchPersonalityTimer:{},searchPersonalityTimerInterval:1500,searchModelTimerInterval:1500,searchPersonalityInProgress:!1,searchModelInProgress:!1,addModel:{},modelDownlaodInProgress:!1,uploadData:[]}},async created(){try{this.$store.state.loading_infos="Getting Hardware usage",await this.refreshHardwareUsage(this.$store)}catch(t){console.log("Error cought:",t)}qe.on("loading_text",this.on_loading_text),this.updateHasUpdates()},methods:{fetchElevenLabsVoices(){fetch("https://api.elevenlabs.io/v1/voices").then(t=>t.json()).then(t=>{this.voices=t.voices}).catch(t=>console.error("Error fetching voices:",t))},async refreshHardwareUsage(t){await t.dispatch("refreshDiskUsage"),await t.dispatch("refreshRamUsage"),await t.dispatch("refreshVramUsage")},addDataSource(){this.$store.state.config.rag_databases.push(""),this.settingsChanged=!0},removeDataSource(t){this.$store.state.config.rag_databases.splice(t,1),this.settingsChanged=!0},async vectorize_folder(t){await de.post("/vectorize_folder",{client_id:this.$store.state.client_id,db_path:this.$store.state.config.rag_databases[t]},this.posts_headers)},async select_folder(t){try{qe.on("rag_db_added",e=>{console.log(e),e?(this.$store.state.config.rag_databases[t]=`${e.database_name}::${e.database_path}`,this.settingsChanged=!0):this.$store.state.toast.showToast("Failed to select a folder",4,!1)}),await de.post("/add_rag_database",{client_id:this.$store.state.client_id},this.posts_headers)}catch{this.$store.state.toast.showToast("Failed to select a folder",4,!1)}},handleTemplateSelection(t){console.log("handleTemplateSelection");const e=t.target.value;console.log("handleTemplateSelection: ",e),e==="lollms"?(console.log("Using lollms template"),this.configFile.start_header_id_template="!@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=` `,this.configFile.start_user_header_id_template="!@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="!@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="lollms_simplified"?(console.log("Using lollms template"),this.configFile.start_header_id_template="@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=` diff --git a/web/dist/index.html b/web/dist/index.html index f0c1c1dc..3b14142b 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -6,7 +6,7 @@ LoLLMS WebUI - + diff --git a/web/src/views/PlayGroundView.vue b/web/src/views/PlayGroundView.vue index 40be1eb7..3e954904 100644 --- a/web/src/views/PlayGroundView.vue +++ b/web/src/views/PlayGroundView.vue @@ -696,7 +696,7 @@ export default { if(ss!=se){ text = text.slice(ss,se) } - axios.post("./text2Wave",{text:text}).then(response => { + axios.post("./text2Wave",{client_id:this.$store.state.client_id, text:text}).then(response => { console.log(response.data.url) let url = response.data.url this.audio_url = url