updated ui

This commit is contained in:
Saifeddine ALOUI 2023-09-22 23:16:22 +02:00
parent 5f816291e7
commit 69ae9628af
11 changed files with 84 additions and 74 deletions

7
app.py
View File

@ -981,6 +981,13 @@ class LoLLMsWebUI(LoLLMsAPPI):
bnd["folder"]=f.stem bnd["folder"]=f.stem
installed = (self.lollms_paths.personal_configuration_path/"bindings"/f.stem/f"config.yaml").exists() installed = (self.lollms_paths.personal_configuration_path/"bindings"/f.stem/f"config.yaml").exists()
bnd["installed"]=installed bnd["installed"]=installed
ui_file_path = f/"ui.html"
if ui_file_path.exists():
with ui_file_path.open("r") as file:
text_content = file.read()
bnd["ui"]=text_content
else:
bnd["ui"]=None
icon_file = self.find_extension(self.lollms_paths.bindings_zoo_path/f"{f.name}", "logo", [".svg",".gif",".png"]) icon_file = self.find_extension(self.lollms_paths.bindings_zoo_path/f"{f.name}", "logo", [".svg",".gif",".png"])
if icon_file is not None: if icon_file is not None:
icon_path = Path(f"bindings/{f.name}/logo{icon_file.suffix}") icon_path = Path(f"bindings/{f.name}/logo{icon_file.suffix}")

14
scripts/wsl/explainer.md Normal file
View File

@ -0,0 +1,14 @@
- After copying files, a console window wil appear. If you don't have wsl, it will install it and install an ubuntu distribution, It will ask you for a user name and password to be used for the ubuntu distribution. Otherwize, it may load a terminal. Just type exit to go on.
- After that, another script is executed, this script requires sudo privileges, so make sure you type the password you have created when installed the ubuntu wsl. This script will update all files, install cuda, add it to the path and setup the environment variables, configure the whole system, install miniconda, clone lollms-webui repository, install all required files.
- Now you have finished the install, you will be asked if you want to run lollms, you can accept.
- Notice that there will be three new shortcuts on the desktop as stated before:
- The first one is a simple ubuntu terminal, useful for debug and manual execution of petals
- The second one is for running lollms to do inference with petals or any other binding
- The third one is for running a petals server to give part of your PC to the community (you'll be prompted for a model hugging face path. if you press enter it will use petals-team/StableBeluga2)
You need to run lollms to install petals binding. When it is loaded it opens a browser. If it doesn't open a browser and navigate to localhost:9600.
Go to settings -> Bindings zoo -> petals and press install. You can monitor the install by looking at the console output.
Once ready, open the models zoo and select a model you want to use for petals. Wait for it to load. If no model is showing up, just reload the localhost:9600 page and then go to settings and the models zoo should have models in it.
You can run the petals server by double clicking the petals server icon on the desktop. This will use your machine as part of the hive mind:

View File

@ -25,7 +25,7 @@ DefaultDirName={userappdata}\{#MyAppName}
ChangesAssociations=yes ChangesAssociations=yes
DisableProgramGroupPage=yes DisableProgramGroupPage=yes
LicenseFile=../../LICENSE LicenseFile=../../LICENSE
InfoBeforeFile=../../CODE_OF_CONDUCT.md InfoBeforeFile=./explainer.md.
InfoAfterFile=./README.md InfoAfterFile=./README.md
; Remove the following line to run in administrative install mode (install for all users.) ; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest PrivilegesRequired=lowest
@ -44,7 +44,9 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
[Files] [Files]
Source: "{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "install_script.sh"; DestDir: "{app}"; Flags: ignoreversion Source: "install_script.sh"; DestDir: "{app}"; Flags: ignoreversion
Source: "lollms_petals_installer.bat"; DestDir: "{app}"; Flags: ignoreversion Source: "wsl_installer.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "ubuntu_installer.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "requirements_installer.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "lollms_petals_runner.bat"; DestDir: "{app}"; Flags: ignoreversion Source: "lollms_petals_runner.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "run_script.sh"; DestDir: "{app}"; Flags: ignoreversion Source: "run_script.sh"; DestDir: "{app}"; Flags: ignoreversion
Source: "ubuntu.bat"; DestDir: "{app}"; Flags: ignoreversion Source: "ubuntu.bat"; DestDir: "{app}"; Flags: ignoreversion
@ -55,20 +57,15 @@ Source: "../../assets\ubuntu.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "../../assets\petals.ico"; DestDir: "{app}"; Flags: ignoreversion Source: "../../assets\petals.ico"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Registry] [Run]
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue Filename: "{app}\wsl_installer.bat"; Flags: shellexec waituntilterminated
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey Filename: "{app}\ubuntu_installer.bat"; Flags: shellexec waituntilterminated
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0" Filename: "{app}\requirements_installer.bat"; Flags: shellexec waituntilterminated
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: "" Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent
[Icons] [Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\logo.ico" Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\logo.ico"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\logo.ico" Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\logo.ico"
Name: "{autodesktop}\ubuntu.bat"; Filename: "{app}\ubuntu.bat"; Tasks: desktopicon; IconFilename: "{app}\ubuntu.ico" Name: "{autodesktop}\ubuntu.bat"; Filename: "{app}\ubuntu.bat"; Tasks: desktopicon; IconFilename: "{app}\ubuntu.ico"
Name: "{autodesktop}\petals_server.bat"; Filename: "{app}\petals_server.bat"; Tasks: desktopicon; IconFilename: "{app}\petals.ico" Name: "{autodesktop}\petals_server.bat"; Filename: "{app}\petals_server.bat"; Tasks: desktopicon; IconFilename: "{app}\petals.ico"
[Run]
Filename: "{app}\lollms_petals_installer.bat"; Flags: shellexec
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent

View File

@ -1,28 +0,0 @@
@echo off
echo Checking if wsl is installed...
wsl --list >nul 2>&1
if %errorlevel% neq 0 (
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 %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.
)
echo Running the install script...
wsl.exe -d Ubuntu-20.04 ./install_script.sh
echo Script execution complete.
pause

View File

@ -0,0 +1,4 @@
@echo off
echo installing requirements
wsl.exe -d Ubuntu-20.04 ./install_script.sh
echo Script execution complete.

View File

@ -0,0 +1,3 @@
@echo off
echo installing ubuntu
wsl --install -d Ubuntu-20.04

View File

@ -0,0 +1,10 @@
@echo off
echo Checking if wsl is installed...
wsl --list >nul 2>&1
if %errorlevel% neq 0 (
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.
)

File diff suppressed because one or more lines are too long

2
web/dist/index.html vendored
View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title> <title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-57e478b9.js"></script> <script type="module" crossorigin src="/assets/index-e5ee3294.js"></script>
<link rel="stylesheet" href="/assets/index-9d0cda62.css"> <link rel="stylesheet" href="/assets/index-9d0cda62.css">
</head> </head>
<body> <body>

View File

@ -49,6 +49,7 @@
</div> </div>
<div class="flex items-center flex-row-reverse gap-2 my-1"> <div class="flex items-center flex-row-reverse gap-2 my-1">
<!-- CONTROLS --> <!-- CONTROLS -->
<DynamicUIRenderer v-if="binding.ui" class="w-full h-full" :code="binding.ui"></DynamicUIRenderer>
<button v-if="!binding.installed" title="Click to install" type="button" @click.stop="toggleInstall" <button v-if="!binding.installed" title="Click to install" type="button" @click.stop="toggleInstall"
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"> 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">
Install Install
@ -119,8 +120,11 @@ import { nextTick } from 'vue'
import feather from 'feather-icons' import feather from 'feather-icons'
import botImgPlaceholder from "../assets/logo.svg" import botImgPlaceholder from "../assets/logo.svg"
import userImgPlaceholder from "../assets/default_user.svg" import userImgPlaceholder from "../assets/default_user.svg"
import DynamicUIRenderer from "@/components/DynamicUIRenderer.vue"
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
export default { export default {
components:{DynamicUIRenderer},
props: { props: {
binding: {}, binding: {},
onSelected: Function, onSelected: Function,

View File

@ -247,7 +247,6 @@ import feather from 'feather-icons'
import defaultImgPlaceholder from "../assets/default_model.png" import defaultImgPlaceholder from "../assets/default_model.png"
import InteractiveMenu from "@/components/InteractiveMenu.vue" import InteractiveMenu from "@/components/InteractiveMenu.vue"
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
export default { export default {
components:{InteractiveMenu}, components:{InteractiveMenu},