From 35d57ecafb74b2ae2d67cbb7ecaf914bfaa54271 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Thu, 21 Sep 2023 21:35:15 +0200 Subject: [PATCH] upgraded --- README.md | 6 ++-- app.py | 2 +- docs/youtube/lollms_v6_windows_install | 2 +- docs/youtube/script_install.md | 2 +- presets/make_programming_project.yaml | 4 +-- presets/original.json | 2 +- scripts/wsl/README.md | 6 ++-- scripts/wsl/install_script.sh | 8 ++++- scripts/wsl/lollms_petals_installer.bat | 30 ++++++++++++------- scripts/wsl/lollms_petals_installer.bat.bak | 18 ----------- scripts/wsl/petals_server.sh | 5 +++- scripts/wsl/run_script.sh | 5 +++- scripts/wsl/uninstall.bat | 2 ++ .../{index-fce2c7cf.js => index-57e478b9.js} | 2 +- web/dist/index.html | 2 +- 15 files changed, 51 insertions(+), 45 deletions(-) delete mode 100644 scripts/wsl/lollms_petals_installer.bat.bak rename web/dist/assets/{index-fce2c7cf.js => index-57e478b9.js} (99%) diff --git a/README.md b/README.md index 6d272e5f1..9519c2f5e 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ Once installed, you need to activate the environment then run the app. By using this tool, users agree to follow these guidelines : - This tool is not meant to be used for building and spreading fakenews / misinformation. - You are responsible for what you generate by using this tool. The creators will take no responsibility for anything created via this lollms. -- You can use lollms in your own project free of charge if you agree to respect the Apache 2.0 licenceterms. Please refer to https://www.apache.org/licenses/LICENSE-2.0 . +- You can use lollms in your own project free of charge if you agree to respect the Apache 2.0 licenseterms. Please refer to https://www.apache.org/licenses/LICENSE-2.0 . - You are not allowed to use lollms to harm others directly or indirectly. This tool is meant for peacefull purposes and should be used for good never for bad. - Users must comply with local laws when accessing content provided by third parties like OpenAI API etc., including copyright restrictions where applicable. @@ -143,8 +143,8 @@ Large Language Models are amazing tools that can be used for diverse purposes. L The performance of the system varies depending on the used model, its size and the dataset on whichit has been trained. The larger a language model's training set (the more examples), generally speaking - better results will follow when using such systems as opposed those with smaller ones. But there is still no garantee that the output generated from any given prompt would always be perfect and it may contain errors due various reasons. So please make sure you do not use it for serious matters like choosing medications or making financial decisions without consultating an expert first hand ! -# Licence -This repository uses code under ApacheLicense Version 2.0 , see [LICENCE](https://github.com/ParisNeo/lollms-webui/blob/main/LICENSE) file for details about rights granted with respect to usage & distribution +# license +This repository uses code under ApacheLicense Version 2.0 , see [license](https://github.com/ParisNeo/lollms-webui/blob/main/LICENSE) file for details about rights granted with respect to usage & distribution # Copyright: ParisNeo 2023 diff --git a/app.py b/app.py index 691a6a45e..90982b9d6 100644 --- a/app.py +++ b/app.py @@ -14,7 +14,7 @@ __copyright__ = "Copyright 2023, " __license__ = "Apache 2.0" -__version__ ="6.5(RC2)" +__version__ ="6.5" main_repo = "https://github.com/ParisNeo/lollms-webui.git" import os diff --git a/docs/youtube/lollms_v6_windows_install b/docs/youtube/lollms_v6_windows_install index 7796fd1b5..33b1507b6 100644 --- a/docs/youtube/lollms_v6_windows_install +++ b/docs/youtube/lollms_v6_windows_install @@ -2,7 +2,7 @@ Hi there. Today I'll show you how to install and use lollms v6 on windows using First go to the github page shown below and download lollms_v6_cpu.exe. Then, run the downloaded file. Sometimes, windows may warn you as the executable is not signed and not yet massively used. You can simply ignore the warning and procede with the installation. -You will be presented with a classic installer, accept the licence and read the code of conduct, then the installer will install the tool on your PC. +You will be presented with a classic installer, accept the license and read the code of conduct, then the installer will install the tool on your PC. Optionally, you can add a shortcut to your desktop for fast and easy access. The install may take a while, so let's fast forward. After the install, you may get this error if you did run the installer as regular user. It is windows trying to forbid the installer from creating the start menu element. Don't bother, you can just press ok and finish the installation. diff --git a/docs/youtube/script_install.md b/docs/youtube/script_install.md index 20c316838..1093d9aae 100644 --- a/docs/youtube/script_install.md +++ b/docs/youtube/script_install.md @@ -8,7 +8,7 @@ If not done yet, and if you think this project is useful, please consider giftin Before starting, let me tell you what this project is made for. This project is aimed to be a hub to all LLM models that people can use. You will be able to choose your preferred binding, your preferred model, and your preferred or needed personality then have it do what you need. Help you enhance your mails, help you write an essai, help you debug a code, help you organize your thoughts, help you find answers to your questions, search for you, organize your data, generate images for you, discuss with you about things. And much more. -This project is under Apache 2.0 licence which is an open source licence that can be used commercially, so people can built things from this and use it in their business. +This project is under Apache 2.0 license which is an open source license that can be used commercially, so people can built things from this and use it in their business. Also, please don't confuse the LoLLMs application built by Nomic AI which is an interesting more professional application that you can find on their website lollms.io. It has a great community and I encourage you to check it up. diff --git a/presets/make_programming_project.yaml b/presets/make_programming_project.yaml index 8e3d6ba46..5c14e41a0 100644 --- a/presets/make_programming_project.yaml +++ b/presets/make_programming_project.yaml @@ -7,14 +7,14 @@ content: | ``` --------- Extra information: - Licence: apache 2.0 + license: apache 2.0 Program type: Stand alone. Documentation: Make README.md with the following table of contents: ## Description ## Installation ## Usage - ## Licence + ## license ## Contribute ## Ethical guidelines Instructions: diff --git a/presets/original.json b/presets/original.json index 15751077d..34af83970 100644 --- a/presets/original.json +++ b/presets/original.json @@ -6,7 +6,7 @@ "Instruct mode": "Instructions:\n@@\nAnswer:@@", "Make a function": "Here is a @@ function that @@:\n```@@\n@@", "Fix a code": "Here is a @@ code:\n```@@\n@@\n```\nInstruction:Check this code and fix any errors if there are any.\nAI:@@", - "Make programming project": "```@@\n# project: @@ \n# author: @@\n# description: @@\n\n@@\n```\n---------\nExtra information:\nLicence: apache 2.0\nProgram type: Stand alone.\nDocumentation:\nMake README.md with the following table of contents:\n## Description\n## Installation\n## Usage\n## Licence\n## Contribute\n## Ethical guidelines\nInstructions:\nWrite a user side README.md\nStick to the provided code content and do not invent extra information.\nMake sure all sections of the table of contents are present in the file.\n----\nREADME.md:\n```markdown\n@@\n```", + "Make programming project": "```@@\n# project: @@ \n# author: @@\n# description: @@\n\n@@\n```\n---------\nExtra information:\nlicense: apache 2.0\nProgram type: Stand alone.\nDocumentation:\nMake README.md with the following table of contents:\n## Description\n## Installation\n## Usage\n## license\n## Contribute\n## Ethical guidelines\nInstructions:\nWrite a user side README.md\nStick to the provided code content and do not invent extra information.\nMake sure all sections of the table of contents are present in the file.\n----\nREADME.md:\n```markdown\n@@\n```", "Explain code": "```@@\n@@\n```\nHere is an explanation of the previous method:@@", "Translate code file strings": "Instruction: Translate the comments and values of the @@ file from @@ to @@.\nSession 1:\n```yaml language=english\n# This is a comment\nparameter_1: this is parameter 1\nparameter_2: this is parameter 2\nparameter_3: 25\nparameter_4: |\n This is a multi\n line parameter\n```\n```yaml language=french\n# Ceci est un commentaire\nparameter_1: ceci est le param\u00e8tre 1\nparameter_2: ceci est le param\u00e8tre 2\nparameter_3: 25\nparameter_4: |\n Ceci est une multiligne\n ligne de param\u00e8tre\n```\nSession 2:\n```yaml language=@@\n@@\n```\n```yaml language=@@@@", "Translate text": "```@@\n@@\n```\n```@@\n@@\n```\n" diff --git a/scripts/wsl/README.md b/scripts/wsl/README.md index 746a53073..7c41bcecd 100644 --- a/scripts/wsl/README.md +++ b/scripts/wsl/README.md @@ -28,7 +28,7 @@ Thank you for all users who tested this tool and helped making it more user frie By using this tool, users agree to follow these guidelines : - This tool is not meant to be used for building and spreading fakenews / misinformation. - You are responsible for what you generate by using this tool. The creators will take no responsibility for anything created via this lollms. -- You can use lollms in your own project free of charge if you agree to respect the Apache 2.0 licenceterms. Please refer to https://www.apache.org/licenses/LICENSE-2.0 . +- You can use lollms in your own project free of charge if you agree to respect the Apache 2.0 licenseterms. Please refer to https://www.apache.org/licenses/LICENSE-2.0 . - You are not allowed to use lollms to harm others directly or indirectly. This tool is meant for peacefull purposes and should be used for good never for bad. - Users must comply with local laws when accessing content provided by third parties like OpenAI API etc., including copyright restrictions where applicable. @@ -37,8 +37,8 @@ Large Language Models are amazing tools that can be used for diverse purposes. L The performance of the system varies depending on the used model, its size and the dataset on whichit has been trained. The larger a language model's training set (the more examples), generally speaking - better results will follow when using such systems as opposed those with smaller ones. But there is still no garantee that the output generated from any given prompt would always be perfect and it may contain errors due various reasons. So please make sure you do not use it for serious matters like choosing medications or making financial decisions without consultating an expert first hand ! -# Licence -This repository uses code under ApacheLicense Version 2.0 , see [LICENCE](https://github.com/ParisNeo/lollms-webui/blob/main/LICENSE) file for details about rights granted with respect to usage & distribution +# license +This repository uses code under ApacheLicense Version 2.0 , see [license](https://github.com/ParisNeo/lollms-webui/blob/main/LICENSE) file for details about rights granted with respect to usage & distribution # Copyright: ParisNeo 2023 diff --git a/scripts/wsl/install_script.sh b/scripts/wsl/install_script.sh index 11f451017..34ffc1511 100644 --- a/scripts/wsl/install_script.sh +++ b/scripts/wsl/install_script.sh @@ -17,6 +17,7 @@ sudo ln -s /usr/bin/pip3 /usr/local/bin/pip wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh bash ~/miniconda.sh -b -p ~/miniconda rm ~/miniconda.sh +source ~/miniconda/etc/profile.d/conda.sh # Clone the git repository git clone https://github.com/ParisNeo/lollms-webui.git ~/lollms-webui @@ -24,8 +25,13 @@ cd ~/lollms-webui # Create and activate conda environment conda create --prefix ./env python=3.10 pip -y -conda activate env +conda activate ./env +# install cuda +conda install -c anaconda cudatoolkit==11.7 +export LD_LIBRARY_PATH=/path/to/directory:$LD_LIBRARY_PATH +#make it permanant +echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:$new_path\"" >> ~/.bashrc # Install requirements pip install -r requirements.txt diff --git a/scripts/wsl/lollms_petals_installer.bat b/scripts/wsl/lollms_petals_installer.bat index f5e9f8eb7..088b20fbc 100644 --- a/scripts/wsl/lollms_petals_installer.bat +++ b/scripts/wsl/lollms_petals_installer.bat @@ -1,18 +1,28 @@ @echo off - -:: Check if WSL is installed +echo Checking if wsl is installed... wsl --list >nul 2>&1 if %errorlevel% neq 0 ( - echo WSL is not installed. Installing... - echo Installing Ubuntu 20.04 LTS... - wsl --install -d Ubuntu-20.04 - wsl --set-default-version 2 + echo WSL is not enabled or installed. Enabling and installing... + dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart + echo WSL installation complete. +) else ( + echo WSL is enabled and installed. +) + +set "distribution=Ubuntu-20.04" +wsl --list | findstr "%distribution%" +if %errorlevel% equ 0 ( + echo %distribution% exists in WSL. ) else ( - echo WSL is already installed. + echo %distribution% does not exist in WSL. + echo Installing Ubuntu 20.04... + wsl --install -d Ubuntu-20.04 + wsl -d Ubuntu-20.04 -- apt upgrade -y + echo Ubuntu 20.04 installation complete. ) -:: Execute the .sh script +echo Running the install script... wsl.exe -d Ubuntu-20.04 ./install_script.sh +echo Script execution complete. -echo Installation and script execution complete! -pause \ No newline at end of file +pause diff --git a/scripts/wsl/lollms_petals_installer.bat.bak b/scripts/wsl/lollms_petals_installer.bat.bak deleted file mode 100644 index 77edfa51e..000000000 --- a/scripts/wsl/lollms_petals_installer.bat.bak +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -:: Check if WSL is installed -wsl --list >nul 2>&1 -if %errorlevel% neq 0 ( - echo WSL is not installed. Installing... - wsl --install -e - wsl --set-default-version 2 - echo Installing Ubuntu 20.04 LTS... - wsl --install -d Ubuntu-20.04 -e -) else ( - echo WSL is already installed. -) - -:: Execute the .sh script -wsl.exe -d Ubuntu-20.04 ./install_script.sh - -echo Installation and script execution complete! \ No newline at end of file diff --git a/scripts/wsl/petals_server.sh b/scripts/wsl/petals_server.sh index 8a6fdcb35..e22bf41f2 100644 --- a/scripts/wsl/petals_server.sh +++ b/scripts/wsl/petals_server.sh @@ -1,8 +1,11 @@ #!/bin/bash +echo changing dir to lollms-webui cd ~/lollms-webui # activate conda environment +echo sourcing miniconda source ~/miniconda/etc/profile.d/conda.sh +echo activating environment conda activate ./env - +echo running server # Run petals server python3 -m petals.cli.run_server petals-team/StableBeluga2 diff --git a/scripts/wsl/run_script.sh b/scripts/wsl/run_script.sh index 88cdf2656..b848f5080 100644 --- a/scripts/wsl/run_script.sh +++ b/scripts/wsl/run_script.sh @@ -1,9 +1,12 @@ #!/bin/bash +echo changing dir to lollms-webui cd ~/lollms-webui # activate conda environment +echo sourcing miniconda source ~/miniconda/etc/profile.d/conda.sh +echo activating environment conda activate ./env - +echo running lollmw-webui # Run lollms webui python3 app.py diff --git a/scripts/wsl/uninstall.bat b/scripts/wsl/uninstall.bat index 1b8dc4c25..60e642ad3 100644 --- a/scripts/wsl/uninstall.bat +++ b/scripts/wsl/uninstall.bat @@ -1 +1,3 @@ +wsl --shutdown wsl --unregister Ubuntu-20.04 +pause diff --git a/web/dist/assets/index-fce2c7cf.js b/web/dist/assets/index-57e478b9.js similarity index 99% rename from web/dist/assets/index-fce2c7cf.js rename to web/dist/assets/index-57e478b9.js index b9470783f..a33c97384 100644 --- a/web/dist/assets/index-fce2c7cf.js +++ b/web/dist/assets/index-57e478b9.js @@ -197,4 +197,4 @@ ${o} ${l}`;navigator.clipboard.writeText(d),be(()=>{ve.replace()})},closeToast(){this.showToast=!1},saveJSONtoFile(t,e){e=e||"data.json";const n=document.createElement("a");n.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:"text/plain"})),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)},parseJsonObj(t){try{return JSON.parse(t)}catch(e){return this.$refs.toast.showToast(`Could not parse JSON. `+e.message,4,!1),null}},async parseJsonFile(t){return new Promise((e,n)=>{const s=new FileReader;s.onload=o=>e(this.parseJsonObj(o.target.result)),s.onerror=o=>n(o),s.readAsText(t)})},async exportDiscussions(){const t=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(t.length>0){console.log("export",t);let e=new Date;const n=e.getFullYear(),s=(e.getMonth()+1).toString().padStart(2,"0"),o=e.getDate().toString().padStart(2,"0"),r=e.getHours().toString().padStart(2,"0"),i=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),d="discussions_export_"+(n+"."+s+"."+o+"."+r+i+a)+".json";this.loading=!0;const u=await this.export_multiple_discussions(t);u?(this.saveJSONtoFile(u,d),this.$refs.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$refs.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async importDiscussions(t){const e=await this.parseJsonFile(t.target.files[0]);await this.import_multiple_discussions(e)?(this.$refs.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$refs.toast.showToast("Failed to import discussions",4,!1)},async getPersonalityAvatars(){for(;this.$store.state.personalities===null;)await new Promise(e=>setTimeout(e,100));let t=this.$store.state.personalities;this.personalityAvatars=t.map(e=>({name:e.name,avatar:e.avatar}))},getAvatar(t){if(t.toLowerCase().trim()==this.$store.state.config.user_name.toLowerCase().trim())return"user_infos/"+this.$store.state.config.user_avatar;const e=this.personalityAvatars.findIndex(s=>s.name===t),n=this.personalityAvatars[e];if(n)return console.log("Avatar",n.avatar),n.avatar},setFileListChat(t){try{this.$refs.chatBox.fileList=this.$refs.chatBox.fileList.concat(t)}catch(e){this.$refs.toast.showToast(`Failed to set filelist in chatbox -`+e.message,4,!1)}this.isDragOverChat=!1},setDropZoneChat(){this.isDragOverChat=!0,this.$refs.dragdropChat.show=!0},async setFileListDiscussion(t){if(t.length>1){this.$refs.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(t[0]);await this.import_multiple_discussions(e)?(this.$refs.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$refs.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1},setDropZoneDiscussion(){this.isDragOverDiscussion=!0,this.$refs.dragdropDiscussion.show=!0}},async created(){for(this.$nextTick(()=>{ve.replace()}),Ee.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},Ee.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),Ee.disconnect()},Ee.on("connected",this.socketIOConnected),Ee.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this.$store.state.ready===!1;)await new Promise(t=>setTimeout(t,100));this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),Ee.on("notification",this.notify),Ee.on("new_message",this.new_message),Ee.on("update_message",this.streamMessageContent),Ee.on("close_message",this.finalMsgEvent),Ee.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.isCreated=!0},async mounted(){this.$nextTick(()=>{ve.replace()})},async activated(){await this.getPersonalityAvatars(),this.isCreated&&be(()=>{const t=document.getElementById("messages-list");this.scrollBottom(t)})},components:{Discussion:Ug,Message:qg,ChatBox:Hg,WelcomeComponent:Vg,Toast:Ys,DragDrop:yl},watch:{filterTitle(t){t==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(t){be(()=>{ve.replace()}),t||(this.isSelectAll=!1)},socketConnected(t){console.log("Websocket connected (watch)",t)},showConfirmation(){be(()=>{ve.replace()})},isSearch(){be(()=>{ve.replace()})}},computed:{client_id(){return Ee.id},isReady(){return console.log("verify ready",this.isCreated),this.isCreated},showPanel(){return this.$store.state.ready&&!this.panelCollapsed},socketConnected(){return console.log(" --- > Websocket connected"),this.$store.commit("setIsConnected",!0),!0},socketDisconnected(){return this.$store.commit("setIsConnected",!1),console.log(" --- > Websocket disconnected"),!0},selectedDiscussions(){return be(()=>{ve.replace()}),this.list.filter(t=>t.checkBoxValue==!0)}}},JKe=Object.assign(YKe,{__name:"DiscussionsView",setup(t){return Xr(()=>{AGe()}),ye.defaults.baseURL="/",(e,n)=>(k(),E(Oe,null,[ae(Os,{name:"fade-and-fly"},{default:Ne(()=>[e.isReady?L("",!0):(k(),E("div",TGe,[c("div",MGe,[c("div",OGe,[c("div",RGe,[NGe,c("div",DGe,[c("p",LGe,"Lord of Large Language Models v "+U(dt(xm).state.version),1),IGe,PGe])]),FGe,BGe,$Ge,zGe])])]))]),_:1}),e.isReady?(k(),E("button",{key:0,onClick:n[0]||(n[0]=(...s)=>e.togglePanel&&e.togglePanel(...s)),class:"absolute top-0 left-0 z-50 p-2 m-2 bg-white rounded-full shadow-md bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-primary-light dark:hover:bg-primary"},[se(c("div",null,UGe,512),[[Ye,e.panelCollapsed]]),se(c("div",null,HGe,512),[[Ye,!e.panelCollapsed]])])):L("",!0),ae(Os,{name:"slide-right"},{default:Ne(()=>[e.showPanel?(k(),E("div",VGe,[c("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:n[19]||(n[19]=de(s=>e.setDropZoneDiscussion(),["stop","prevent"]))},[c("div",GGe,[c("div",KGe,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:n[1]||(n[1]=s=>e.createNewDiscussion())},ZGe),c("button",{class:Ce(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:n[2]||(n[2]=s=>e.isCheckbox=!e.isCheckbox)},JGe,2),QGe,XGe,c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:n[3]||(n[3]=(...s)=>e.importDiscussions&&e.importDiscussions(...s))},null,544),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:n[4]||(n[4]=de(s=>e.$refs.fileDialog.click(),["stop"]))},tKe),e.isOpen?(k(),E("div",nKe,[c("button",{onClick:n[5]||(n[5]=(...s)=>e.importDiscussions&&e.importDiscussions(...s))},"LOLLMS"),c("button",{onClick:n[6]||(n[6]=(...s)=>e.importChatGPT&&e.importChatGPT(...s))},"ChatGPT")])):L("",!0),c("button",{class:Ce(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:n[7]||(n[7]=s=>e.isSearch=!e.isSearch)},oKe,2),e.showConfirmation?L("",!0):(k(),E("button",{key:1,title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:n[8]||(n[8]=s=>e.showConfirmation=!0)},iKe)),e.showConfirmation?(k(),E("div",aKe,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:n[9]||(n[9]=de(s=>e.showConfirmation=!1,["stop"]))},cKe),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:n[10]||(n[10]=de(s=>e.save_configuration(),["stop"]))},uKe)])):L("",!0),e.loading?(k(),E("div",hKe,pKe)):L("",!0)]),e.isSearch?(k(),E("div",gKe,[c("div",mKe,[c("div",_Ke,[bKe,c("div",yKe,[c("div",{class:Ce(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:n[11]||(n[11]=s=>e.filterTitle="")},wKe,2)]),se(c("input",{type:"search",id:"default-search",class:"block w-full p-2 pl-10 pr-10 text-sm border border-gray-300 rounded-lg bg-bg-light focus:ring-secondary focus:border-secondary dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-secondary dark:focus:border-secondary",placeholder:"Search...",title:"Filter discussions by title","onUpdate:modelValue":n[12]||(n[12]=s=>e.filterTitle=s),onInput:n[13]||(n[13]=s=>e.filterDiscussions())},null,544),[[Re,e.filterTitle]])])])])):L("",!0),e.isCheckbox?(k(),E("hr",xKe)):L("",!0),e.isCheckbox?(k(),E("div",kKe,[c("div",EKe,[e.selectedDiscussions.length>0?(k(),E("p",CKe,"Selected: "+U(e.selectedDiscussions.length),1)):L("",!0)]),c("div",AKe,[e.selectedDiscussions.length>0?(k(),E("div",SKe,[e.showConfirmation?L("",!0):(k(),E("button",{key:0,class:"flex mx-3 flex-1 text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove selected",type:"button",onClick:n[14]||(n[14]=de(s=>e.showConfirmation=!0,["stop"]))},MKe)),e.showConfirmation?(k(),E("div",OKe,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:n[15]||(n[15]=de((...s)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...s),["stop"]))},NKe),c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:n[16]||(n[16]=de(s=>e.showConfirmation=!1,["stop"]))},LKe)])):L("",!0)])):L("",!0),c("div",IKe,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a file",type:"button",onClick:n[17]||(n[17]=de((...s)=>e.exportDiscussions&&e.exportDiscussions(...s),["stop"]))},FKe),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:n[18]||(n[18]=de((...s)=>e.selectAllDiscussions&&e.selectAllDiscussions(...s),["stop"]))},$Ke)])])])):L("",!0)]),c("div",zKe,[ae(yl,{ref:"dragdropDiscussion",onPanelDrop:e.setFileListDiscussion},{default:Ne(()=>[xe("Drop your discussion file here ")]),_:1},8,["onPanelDrop"])]),c("div",jKe,[c("div",{class:Ce(["mx-4 flex flex-col flex-grow",e.isDragOverDiscussion?"pointer-events-none":""])},[c("div",{id:"dis-list",class:Ce([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow"])},[e.list.length>0?(k(),nt(Ut,{key:0,name:"list"},{default:Ne(()=>[(k(!0),E(Oe,null,Ve(e.list,(s,o)=>(k(),nt(Ug,{key:s.id,id:s.id,title:s.title,selected:e.currentDiscussion.id==s.id,loading:s.loading,isCheckbox:e.isCheckbox,checkBoxValue:s.checkBoxValue,onSelect:r=>e.selectDiscussion(s),onDelete:r=>e.deleteDiscussion(s.id),onEditTitle:e.editTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onEditTitle","onChecked"]))),128))]),_:1})):L("",!0),e.list.length<1?(k(),E("div",UKe,HKe)):L("",!0),VKe],2)],2)])],32)])):L("",!0)]),_:1}),e.isReady?(k(),E("div",{key:1,class:"relative flex flex-col flex-grow",onDragover:n[20]||(n[20]=de(s=>e.setDropZoneChat(),["stop","prevent"]))},[c("div",GKe,[ae(yl,{ref:"dragdropChat",onPanelDrop:e.setFileListChat},null,8,["onPanelDrop"])]),c("div",{id:"messages-list",class:Ce(["z-0 flex flex-col flex-grow 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",e.isDragOverChat?"pointer-events-none":""])},[c("div",KKe,[e.discussionArr.length>0?(k(),nt(Ut,{key:0,name:"list"},{default:Ne(()=>[(k(!0),E(Oe,null,Ve(e.discussionArr,(s,o)=>(k(),nt(qg,{key:s.id,message:s,id:"msg-"+s.id,ref_for:!0,ref:"messages",onCopy:e.copyToClipBoard,onDelete:e.deleteMessage,onRankUp:e.rankUpMessage,onRankDown:e.rankDownMessage,onUpdateMessage:e.updateMessage,onResendMessage:e.resendMessage,onContinueMessage:e.continueMessage,avatar:e.getAvatar(s.sender)},null,8,["message","id","onCopy","onDelete","onRankUp","onRankDown","onUpdateMessage","onResendMessage","onContinueMessage","avatar"]))),128))]),_:1})):L("",!0),e.currentDiscussion.id?L("",!0):(k(),nt(Vg,{key:1}))]),WKe,e.currentDiscussion.id?(k(),E("div",ZKe,[ae(Hg,{ref:"chatBox",onMessageSentEvent:e.sendMsg,loading:e.isGenerating,discussionList:e.discussionArr,onStopGenerating:e.stopGenerating,"on-show-toast-message":e.showToastMessage,"on-talk":e.talk,onLoaded:e.recoverFiles},null,8,["onMessageSentEvent","loading","discussionList","onStopGenerating","on-show-toast-message","on-talk","onLoaded"])])):L("",!0)],2)],32)):L("",!0),ae(Ys,{ref:"toast"},null,512),ae(zg,{ref:"messageBox"},null,512)],64))}}),QKe=ze(JKe,[["__scopeId","data-v-02ad3264"]]),XKe=Uy({history:iy("/"),routes:[{path:"/playground/",name:"playground",component:fMe},{path:"/extensions/",name:"extensions",component:kMe},{path:"/help/",name:"help",component:qMe},{path:"/settings/",name:"settings",component:Yze},{path:"/training/",name:"training",component:_je},{path:"/quantizing/",name:"quantizing",component:Aje},{path:"/",name:"discussions",component:QKe}]});const Ei=t0(x2);console.log("Loaded main.js");const xm=T0({state(){return{ready:!1,version:"unknown",sort_type:0,refreshingModelsList:!1,settingsChanged:!1,isConnected:!1,config:null,mountedPers:null,mountedPersArr:null,bindingsArr:null,modelsArr:null,models_zoo:null,selectedModel:null,personalities:null,diskUsage:null,ramUsage:null,vramUsage:null,extensionsZoo:null}},mutations:{setIsConnected(t,e){t.isConnected=e},setConfig(t,e){t.config=e},setPersonalities(t,e){t.personalities=e},setMountedPers(t,e){t.mountedPers=e},setMountedPersArr(t,e){t.mountedPersArr=e},setBindingsArr(t,e){t.bindingsArr=e},setModelsArr(t,e){t.modelsArr=e},setselectedModel(t,e){t.selectedModel=e},setDiskUsage(t,e){t.diskUsage=e},setRamUsage(t,e){t.ramUsage=e},setVramUsage(t,e){t.vramUsage=e},setExtensionsZoo(t,e){t.extensionsZoo=e},setModelsZoo(t,e){t.models_zoo=e}},getters:{getIsConnected(t){return t.isConnected},getConfig(t){return t.config},getPersonalities(t){return t.personalities},getMountedPersArr(t){return t.mountedPersArr},getMountedPers(t){return t.mountedPers},getbindingsArr(t){return t.bindingsArr},getModelsArr(t){return t.modelsArr},getDiskUsage(t){return t.diskUsage},getRamUsage(t){return t.ramUsage},getVramUsage(t){return t.vramUsage},getModelsZoo(t){return t.models_zoo},getExtensionsZoo(t){return t.extensionsZoo}},actions:{async getVersion(){let t=await ye.get("/get_lollms_webui_version",{});t&&(this.state.version=t.data.version)},async refreshConfig({commit:t}){console.log("Fetching configuration");try{const e=await tn("get_config");e.active_personality_id<0&&(e.active_personality_id=0);let n=e.personalities[e.active_personality_id].split("/");e.personality_category=n[0],e.personality_folder=n[1],console.log("Recovered config"),console.log(e),console.log("Committing config"),console.log(e),console.log(this.state.config),t("setConfig",e)}catch(e){console.log(e.message,"refreshConfig")}},async refreshPersonalitiesArr({commit:t}){let e=[];const n=await tn("get_all_personalities"),s=Object.keys(n);console.log("Personalities recovered:"+this.state.config.personalities);for(let o=0;o{let d=!1;for(const h of this.state.config.personalities)if(h.includes(r+"/"+l.folder)&&(d=!0,h.includes(":"))){const f=h.split(":");l.language=f[1]}let u={};return u=l,u.category=r,u.full_path=r+"/"+l.folder,u.isMounted=d,u});e.length==0?e=a:e=e.concat(a)}e.sort((o,r)=>o.name.localeCompare(r.name)),t("setPersonalities",e),console.log("Done loading personalities")},refreshMountedPersonalities({commit:t}){this.state.config.active_personality_id<0&&(this.state.config.active_personality_id=0);let e=[];for(let n=0;ni.full_path==s||i.full_path+":"+i.language==s),r=this.state.personalities[o];r?e.push(r):e.push(this.state.personalities[this.state.personalities.findIndex(i=>i.full_path=="generic/lollms")])}t("setMountedPersArr",e),this.state.mountedPers=this.state.personalities[this.state.personalities.findIndex(n=>n.full_path==this.state.config.personalities[this.state.config.active_personality_id]||n.full_path+":"+n.language==this.state.config.personalities[this.state.config.active_personality_id])]},async refreshBindings({commit:t}){let e=await tn("list_bindings");t("setBindingsArr",e)},async refreshModels({commit:t}){console.log("Fetching models");let e=await tn("list_models");console.log(`Found ${e}`);let n=await tn("get_active_model");n!=null&&t("setselectedModel",n.model),t("setModelsArr",e)},async refreshExtensionsZoo({commit:t}){let e=await tn("list_extensions");t("setExtensionsZoo",e)},async refreshDiskUsage({commit:t}){this.state.diskUsage=await tn("disk_usage")},async refreshRamUsage({commit:t}){this.state.ramUsage=await tn("ram_usage")},async refreshVramUsage({commit:t}){const e=await tn("vram_usage"),n=[];if(e.nb_gpus>0){for(let o=0;o{console.log("HERE WE GO");let n=e.data;console.log("models_zoo"),console.log(n),n=n.filter(s=>s.variants&&s.variants.length>0),this.state.sort_type==0?n.sort((s,o)=>{const r=new Date(s.last_commit_time);return new Date(o.last_commit_time)-r}):this.state.sort_type==1?n.sort((s,o)=>o.rank-s.rank):this.state.sort_type==2?n.sort((s,o)=>s.name.localeCompare(o.name)):this.state.sort_type==3&&n.sort((s,o)=>s.name.localeCompare(o.name));for(let s=0;si.name==o);if(r==-1)for(let i=0;il.name==o),r!=-1)){r=i,console.log(`Found ${o} at index ${r}`);break}}if(r==-1){let i={};i.name=o,i.icon="",i.isCustomModel=!0,i.isInstalled=!0,n.push(i)}else n[r].isInstalled=!0}console.log("models_zoo"),n.sort((s,o)=>s.isInstalled&&!o.isInstalled?-1:!s.isInstalled&&o.isInstalled?1:0),n.forEach(s=>{s.name==this.state.config.model_name?s.selected=!0:s.selected=!1}),t("setModelsZoo",n),this.state.refreshingModelsList=!1}).catch(e=>{console.log(e.message,"fetchModels"),this.state.refreshingModelsList=!1})},fetchCustomModels({commit:t}){ye.get("/list_models").then(e=>{}).catch(e=>{console.log(e.message,"fetchCustomModels")})}}});async function tn(t){try{const e=await ye.get("/"+t);if(e)return e.data}catch(e){throw console.log(e.message,"api_get_req"),e}}let Uh=!1;Ei.mixin({created(){Uh||(Uh=!0,console.log("Calling"),this.$store.dispatch("refreshConfig").then(async()=>{console.log("recovered config : ${}"),await this.$store.dispatch("getVersion"),console.log("recovered version"),await this.$store.dispatch("refreshPersonalitiesArr"),this.$store.dispatch("refreshMountedPersonalities"),this.$store.dispatch("refreshBindings"),this.$store.dispatch("refreshModels"),this.$store.dispatch("refreshDiskUsage"),this.$store.dispatch("refreshRamUsage"),this.$store.dispatch("refreshVramUsage"),this.$store.dispatch("refreshModelsZoo"),this.$store.dispatch("refreshExtensionsZoo"),this.$store.state.ready=!0,console.log("done loading data")}))},beforeMount(){}});Ei.use(XKe);Ei.use(xm);Ei.mount("#app"); +`+e.message,4,!1)}this.isDragOverChat=!1},setDropZoneChat(){this.isDragOverChat=!0,this.$refs.dragdropChat.show=!0},async setFileListDiscussion(t){if(t.length>1){this.$refs.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(t[0]);await this.import_multiple_discussions(e)?(this.$refs.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$refs.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1},setDropZoneDiscussion(){this.isDragOverDiscussion=!0,this.$refs.dragdropDiscussion.show=!0}},async created(){for(this.$nextTick(()=>{ve.replace()}),Ee.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},Ee.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),Ee.disconnect()},Ee.on("connected",this.socketIOConnected),Ee.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this.$store.state.ready===!1;)await new Promise(t=>setTimeout(t,100));this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),Ee.on("notification",this.notify),Ee.on("new_message",this.new_message),Ee.on("update_message",this.streamMessageContent),Ee.on("close_message",this.finalMsgEvent),Ee.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.isCreated=!0},async mounted(){this.$nextTick(()=>{ve.replace()})},async activated(){await this.getPersonalityAvatars(),this.isCreated&&be(()=>{const t=document.getElementById("messages-list");this.scrollBottom(t)})},components:{Discussion:Ug,Message:qg,ChatBox:Hg,WelcomeComponent:Vg,Toast:Ys,DragDrop:yl},watch:{filterTitle(t){t==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(t){be(()=>{ve.replace()}),t||(this.isSelectAll=!1)},socketConnected(t){console.log("Websocket connected (watch)",t)},showConfirmation(){be(()=>{ve.replace()})},isSearch(){be(()=>{ve.replace()})}},computed:{client_id(){return Ee.id},isReady(){return console.log("verify ready",this.isCreated),this.isCreated},showPanel(){return this.$store.state.ready&&!this.panelCollapsed},socketConnected(){return console.log(" --- > Websocket connected"),this.$store.commit("setIsConnected",!0),!0},socketDisconnected(){return this.$store.commit("setIsConnected",!1),console.log(" --- > Websocket disconnected"),!0},selectedDiscussions(){return be(()=>{ve.replace()}),this.list.filter(t=>t.checkBoxValue==!0)}}},JKe=Object.assign(YKe,{__name:"DiscussionsView",setup(t){return Xr(()=>{AGe()}),ye.defaults.baseURL="/",(e,n)=>(k(),E(Oe,null,[ae(Os,{name:"fade-and-fly"},{default:Ne(()=>[e.isReady?L("",!0):(k(),E("div",TGe,[c("div",MGe,[c("div",OGe,[c("div",RGe,[NGe,c("div",DGe,[c("p",LGe,"Lord of Large Language Models v "+U(dt(xm).state.version),1),IGe,PGe])]),FGe,BGe,$Ge,zGe])])]))]),_:1}),e.isReady?(k(),E("button",{key:0,onClick:n[0]||(n[0]=(...s)=>e.togglePanel&&e.togglePanel(...s)),class:"absolute top-0 left-0 z-50 p-2 m-2 bg-white rounded-full shadow-md bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-primary-light dark:hover:bg-primary"},[se(c("div",null,UGe,512),[[Ye,e.panelCollapsed]]),se(c("div",null,HGe,512),[[Ye,!e.panelCollapsed]])])):L("",!0),ae(Os,{name:"slide-right"},{default:Ne(()=>[e.showPanel?(k(),E("div",VGe,[c("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:n[19]||(n[19]=de(s=>e.setDropZoneDiscussion(),["stop","prevent"]))},[c("div",GGe,[c("div",KGe,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:n[1]||(n[1]=s=>e.createNewDiscussion())},ZGe),c("button",{class:Ce(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:n[2]||(n[2]=s=>e.isCheckbox=!e.isCheckbox)},JGe,2),QGe,XGe,c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:n[3]||(n[3]=(...s)=>e.importDiscussions&&e.importDiscussions(...s))},null,544),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:n[4]||(n[4]=de(s=>e.$refs.fileDialog.click(),["stop"]))},tKe),e.isOpen?(k(),E("div",nKe,[c("button",{onClick:n[5]||(n[5]=(...s)=>e.importDiscussions&&e.importDiscussions(...s))},"LOLLMS"),c("button",{onClick:n[6]||(n[6]=(...s)=>e.importChatGPT&&e.importChatGPT(...s))},"ChatGPT")])):L("",!0),c("button",{class:Ce(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:n[7]||(n[7]=s=>e.isSearch=!e.isSearch)},oKe,2),e.showConfirmation?L("",!0):(k(),E("button",{key:1,title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:n[8]||(n[8]=s=>e.showConfirmation=!0)},iKe)),e.showConfirmation?(k(),E("div",aKe,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:n[9]||(n[9]=de(s=>e.showConfirmation=!1,["stop"]))},cKe),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:n[10]||(n[10]=de(s=>e.save_configuration(),["stop"]))},uKe)])):L("",!0),e.loading?(k(),E("div",hKe,pKe)):L("",!0)]),e.isSearch?(k(),E("div",gKe,[c("div",mKe,[c("div",_Ke,[bKe,c("div",yKe,[c("div",{class:Ce(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:n[11]||(n[11]=s=>e.filterTitle="")},wKe,2)]),se(c("input",{type:"search",id:"default-search",class:"block w-full p-2 pl-10 pr-10 text-sm border border-gray-300 rounded-lg bg-bg-light focus:ring-secondary focus:border-secondary dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-secondary dark:focus:border-secondary",placeholder:"Search...",title:"Filter discussions by title","onUpdate:modelValue":n[12]||(n[12]=s=>e.filterTitle=s),onInput:n[13]||(n[13]=s=>e.filterDiscussions())},null,544),[[Re,e.filterTitle]])])])])):L("",!0),e.isCheckbox?(k(),E("hr",xKe)):L("",!0),e.isCheckbox?(k(),E("div",kKe,[c("div",EKe,[e.selectedDiscussions.length>0?(k(),E("p",CKe,"Selected: "+U(e.selectedDiscussions.length),1)):L("",!0)]),c("div",AKe,[e.selectedDiscussions.length>0?(k(),E("div",SKe,[e.showConfirmation?L("",!0):(k(),E("button",{key:0,class:"flex mx-3 flex-1 text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove selected",type:"button",onClick:n[14]||(n[14]=de(s=>e.showConfirmation=!0,["stop"]))},MKe)),e.showConfirmation?(k(),E("div",OKe,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:n[15]||(n[15]=de((...s)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...s),["stop"]))},NKe),c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:n[16]||(n[16]=de(s=>e.showConfirmation=!1,["stop"]))},LKe)])):L("",!0)])):L("",!0),c("div",IKe,[c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a file",type:"button",onClick:n[17]||(n[17]=de((...s)=>e.exportDiscussions&&e.exportDiscussions(...s),["stop"]))},FKe),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:n[18]||(n[18]=de((...s)=>e.selectAllDiscussions&&e.selectAllDiscussions(...s),["stop"]))},$Ke)])])])):L("",!0)]),c("div",zKe,[ae(yl,{ref:"dragdropDiscussion",onPanelDrop:e.setFileListDiscussion},{default:Ne(()=>[xe("Drop your discussion file here ")]),_:1},8,["onPanelDrop"])]),c("div",jKe,[c("div",{class:Ce(["mx-4 flex flex-col flex-grow",e.isDragOverDiscussion?"pointer-events-none":""])},[c("div",{id:"dis-list",class:Ce([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow"])},[e.list.length>0?(k(),nt(Ut,{key:0,name:"list"},{default:Ne(()=>[(k(!0),E(Oe,null,Ve(e.list,(s,o)=>(k(),nt(Ug,{key:s.id,id:s.id,title:s.title,selected:e.currentDiscussion.id==s.id,loading:s.loading,isCheckbox:e.isCheckbox,checkBoxValue:s.checkBoxValue,onSelect:r=>e.selectDiscussion(s),onDelete:r=>e.deleteDiscussion(s.id),onEditTitle:e.editTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onEditTitle","onChecked"]))),128))]),_:1})):L("",!0),e.list.length<1?(k(),E("div",UKe,HKe)):L("",!0),VKe],2)],2)])],32)])):L("",!0)]),_:1}),e.isReady?(k(),E("div",{key:1,class:"relative flex flex-col flex-grow",onDragover:n[20]||(n[20]=de(s=>e.setDropZoneChat(),["stop","prevent"]))},[c("div",GKe,[ae(yl,{ref:"dragdropChat",onPanelDrop:e.setFileListChat},null,8,["onPanelDrop"])]),c("div",{id:"messages-list",class:Ce(["z-0 flex flex-col flex-grow 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",e.isDragOverChat?"pointer-events-none":""])},[c("div",KKe,[e.discussionArr.length>0?(k(),nt(Ut,{key:0,name:"list"},{default:Ne(()=>[(k(!0),E(Oe,null,Ve(e.discussionArr,(s,o)=>(k(),nt(qg,{key:s.id,message:s,id:"msg-"+s.id,ref_for:!0,ref:"messages",onCopy:e.copyToClipBoard,onDelete:e.deleteMessage,onRankUp:e.rankUpMessage,onRankDown:e.rankDownMessage,onUpdateMessage:e.updateMessage,onResendMessage:e.resendMessage,onContinueMessage:e.continueMessage,avatar:e.getAvatar(s.sender)},null,8,["message","id","onCopy","onDelete","onRankUp","onRankDown","onUpdateMessage","onResendMessage","onContinueMessage","avatar"]))),128))]),_:1})):L("",!0),e.currentDiscussion.id?L("",!0):(k(),nt(Vg,{key:1}))]),WKe,e.currentDiscussion.id?(k(),E("div",ZKe,[ae(Hg,{ref:"chatBox",onMessageSentEvent:e.sendMsg,loading:e.isGenerating,discussionList:e.discussionArr,onStopGenerating:e.stopGenerating,"on-show-toast-message":e.showToastMessage,"on-talk":e.talk,onLoaded:e.recoverFiles},null,8,["onMessageSentEvent","loading","discussionList","onStopGenerating","on-show-toast-message","on-talk","onLoaded"])])):L("",!0)],2)],32)):L("",!0),ae(Ys,{ref:"toast"},null,512),ae(zg,{ref:"messageBox"},null,512)],64))}}),QKe=ze(JKe,[["__scopeId","data-v-02ad3264"]]),XKe=Uy({history:iy("/"),routes:[{path:"/playground/",name:"playground",component:fMe},{path:"/extensions/",name:"extensions",component:kMe},{path:"/help/",name:"help",component:qMe},{path:"/settings/",name:"settings",component:Yze},{path:"/training/",name:"training",component:_je},{path:"/quantizing/",name:"quantizing",component:Aje},{path:"/",name:"discussions",component:QKe}]});const Ei=t0(x2);console.log("Loaded main.js");const xm=T0({state(){return{ready:!1,version:"unknown",sort_type:0,refreshingModelsList:!1,settingsChanged:!1,isConnected:!1,config:null,mountedPers:null,mountedPersArr:null,bindingsArr:null,modelsArr:null,models_zoo:null,selectedModel:null,personalities:null,diskUsage:null,ramUsage:null,vramUsage:null,extensionsZoo:null}},mutations:{setIsConnected(t,e){t.isConnected=e},setConfig(t,e){t.config=e},setPersonalities(t,e){t.personalities=e},setMountedPers(t,e){t.mountedPers=e},setMountedPersArr(t,e){t.mountedPersArr=e},setBindingsArr(t,e){t.bindingsArr=e},setModelsArr(t,e){t.modelsArr=e},setselectedModel(t,e){t.selectedModel=e},setDiskUsage(t,e){t.diskUsage=e},setRamUsage(t,e){t.ramUsage=e},setVramUsage(t,e){t.vramUsage=e},setExtensionsZoo(t,e){t.extensionsZoo=e},setModelsZoo(t,e){t.models_zoo=e}},getters:{getIsConnected(t){return t.isConnected},getConfig(t){return t.config},getPersonalities(t){return t.personalities},getMountedPersArr(t){return t.mountedPersArr},getMountedPers(t){return t.mountedPers},getbindingsArr(t){return t.bindingsArr},getModelsArr(t){return t.modelsArr},getDiskUsage(t){return t.diskUsage},getRamUsage(t){return t.ramUsage},getVramUsage(t){return t.vramUsage},getModelsZoo(t){return t.models_zoo},getExtensionsZoo(t){return t.extensionsZoo}},actions:{async getVersion(){let t=await ye.get("/get_lollms_webui_version",{});t&&(this.state.version=t.data.version)},async refreshConfig({commit:t}){console.log("Fetching configuration");try{const e=await tn("get_config");e.active_personality_id<0&&(e.active_personality_id=0);let n=e.personalities[e.active_personality_id].split("/");e.personality_category=n[0],e.personality_folder=n[1],console.log("Recovered config"),console.log(e),console.log("Committing config"),console.log(e),console.log(this.state.config),t("setConfig",e)}catch(e){console.log(e.message,"refreshConfig")}},async refreshPersonalitiesArr({commit:t}){let e=[];const n=await tn("get_all_personalities"),s=Object.keys(n);console.log("Personalities recovered:"+this.state.config.personalities);for(let o=0;o{let d=!1;for(const h of this.state.config.personalities)if(h.includes(r+"/"+l.folder)&&(d=!0,h.includes(":"))){const f=h.split(":");l.language=f[1]}let u={};return u=l,u.category=r,u.full_path=r+"/"+l.folder,u.isMounted=d,u});e.length==0?e=a:e=e.concat(a)}e.sort((o,r)=>o.name.localeCompare(r.name)),t("setPersonalities",e),console.log("Done loading personalities")},refreshMountedPersonalities({commit:t}){this.state.config.active_personality_id<0&&(this.state.config.active_personality_id=0);let e=[];for(let n=0;ni.full_path==s||i.full_path+":"+i.language==s),r=this.state.personalities[o];r?e.push(r):e.push(this.state.personalities[this.state.personalities.findIndex(i=>i.full_path=="generic/lollms")])}t("setMountedPersArr",e),this.state.mountedPers=this.state.personalities[this.state.personalities.findIndex(n=>n.full_path==this.state.config.personalities[this.state.config.active_personality_id]||n.full_path+":"+n.language==this.state.config.personalities[this.state.config.active_personality_id])]},async refreshBindings({commit:t}){let e=await tn("list_bindings");t("setBindingsArr",e)},async refreshModels({commit:t}){console.log("Fetching models");let e=await tn("list_models");console.log(`Found ${e}`);let n=await tn("get_active_model");n!=null&&t("setselectedModel",n.model),t("setModelsArr",e)},async refreshExtensionsZoo({commit:t}){let e=await tn("list_extensions");t("setExtensionsZoo",e)},async refreshDiskUsage({commit:t}){this.state.diskUsage=await tn("disk_usage")},async refreshRamUsage({commit:t}){this.state.ramUsage=await tn("ram_usage")},async refreshVramUsage({commit:t}){const e=await tn("vram_usage"),n=[];if(e.nb_gpus>0){for(let o=0;o{console.log("HERE WE GO");let n=e.data;n=n.filter(s=>s.variants&&s.variants.length>0),console.log("models_zoo"),console.log(n),this.state.sort_type==0?n.sort((s,o)=>{const r=new Date(s.last_commit_time);return new Date(o.last_commit_time)-r}):this.state.sort_type==1?n.sort((s,o)=>o.rank-s.rank):this.state.sort_type==2?n.sort((s,o)=>s.name.localeCompare(o.name)):this.state.sort_type==3&&n.sort((s,o)=>s.name.localeCompare(o.name));for(let s=0;si.name==o);if(r==-1)for(let i=0;il.name==o),r!=-1)){r=i,console.log(`Found ${o} at index ${r}`);break}}if(r==-1){let i={};i.name=o,i.icon="",i.isCustomModel=!0,i.isInstalled=!0,n.push(i)}else n[r].isInstalled=!0}console.log("models_zoo"),n.sort((s,o)=>s.isInstalled&&!o.isInstalled?-1:!s.isInstalled&&o.isInstalled?1:0),n.forEach(s=>{s.name==this.state.config.model_name?s.selected=!0:s.selected=!1}),console.log("models_zoo"),console.log(n),t("setModelsZoo",n),this.state.refreshingModelsList=!1}).catch(e=>{console.log(e.message,"fetchModels"),this.state.refreshingModelsList=!1})},fetchCustomModels({commit:t}){ye.get("/list_models").then(e=>{}).catch(e=>{console.log(e.message,"fetchCustomModels")})}}});async function tn(t){try{const e=await ye.get("/"+t);if(e)return e.data}catch(e){throw console.log(e.message,"api_get_req"),e}}let Uh=!1;Ei.mixin({created(){Uh||(Uh=!0,console.log("Calling"),this.$store.dispatch("refreshConfig").then(async()=>{console.log("recovered config : ${}"),await this.$store.dispatch("getVersion"),console.log("recovered version"),await this.$store.dispatch("refreshPersonalitiesArr"),this.$store.dispatch("refreshMountedPersonalities"),this.$store.dispatch("refreshBindings"),this.$store.dispatch("refreshModels"),this.$store.dispatch("refreshDiskUsage"),this.$store.dispatch("refreshRamUsage"),this.$store.dispatch("refreshVramUsage"),this.$store.dispatch("refreshModelsZoo"),this.$store.dispatch("refreshExtensionsZoo"),this.$store.state.ready=!0,console.log("done loading data")}))},beforeMount(){}});Ei.use(XKe);Ei.use(xm);Ei.mount("#app"); diff --git a/web/dist/index.html b/web/dist/index.html index b7b8a0dd2..1ea7fe3fb 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -6,7 +6,7 @@ LoLLMS WebUI - Welcome - +