mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-29 15:44:12 +00:00
Merge branch 'main' of https://github.com/ParisNeo/lollms-webui into main
This commit is contained in:
commit
a317238d86
46
app.py
46
app.py
@ -243,6 +243,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
|
||||
self.add_endpoint("/install_model_from_path", "install_model_from_path", self.install_model_from_path, methods=["GET"])
|
||||
|
||||
self.add_endpoint("/unInstall_binding", "unInstall_binding", self.unInstall_binding, methods=["POST"])
|
||||
self.add_endpoint("/reinstall_binding", "reinstall_binding", self.reinstall_binding, methods=["POST"])
|
||||
self.add_endpoint("/reinstall_personality", "reinstall_personality", self.reinstall_personality, methods=["POST"])
|
||||
|
||||
@ -981,6 +982,20 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
bnd["folder"]=f.stem
|
||||
installed = (self.lollms_paths.personal_configuration_path/"bindings"/f.stem/f"config.yaml").exists()
|
||||
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
|
||||
disclaimer_file_path = f/"disclaimer.md"
|
||||
if disclaimer_file_path.exists():
|
||||
with disclaimer_file_path.open("r") as file:
|
||||
text_content = file.read()
|
||||
bnd["disclaimer"]=text_content
|
||||
else:
|
||||
bnd["disclaimer"]=None
|
||||
icon_file = self.find_extension(self.lollms_paths.bindings_zoo_path/f"{f.name}", "logo", [".svg",".gif",".png"])
|
||||
if icon_file is not None:
|
||||
icon_path = Path(f"bindings/{f.name}/logo{icon_file.suffix}")
|
||||
@ -1279,7 +1294,36 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
ASCIIColors.error(f"Couldn't build binding: [{ex}]")
|
||||
trace_exception(ex)
|
||||
return jsonify({"status":False, 'error':str(ex)})
|
||||
|
||||
|
||||
def unInstall_binding(self):
|
||||
try:
|
||||
data = request.get_json()
|
||||
# Further processing of the data
|
||||
except Exception as e:
|
||||
print(f"Error occurred while parsing JSON: {e}")
|
||||
return jsonify({"status":False, 'error':str(e)})
|
||||
ASCIIColors.info(f"- UnInstalling binding {data['name']}...")
|
||||
try:
|
||||
ASCIIColors.info("Unmounting binding and model")
|
||||
self.binding = None
|
||||
self.model = None
|
||||
for per in self.mounted_personalities:
|
||||
per.model = None
|
||||
gc.collect()
|
||||
ASCIIColors.info("UnInstalling binding")
|
||||
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths, InstallOption.FORCE_INSTALL)
|
||||
self.binding.uninstall()
|
||||
ASCIIColors.success("Binding UnInstalled successfully")
|
||||
self.config.binding_name= None
|
||||
if self.config.auto_save:
|
||||
ASCIIColors.info("Saving configuration")
|
||||
self.config.save_config()
|
||||
ASCIIColors.info("Please select a binding")
|
||||
return jsonify({"status": True})
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Couldn't uninstall binding: [{ex}]")
|
||||
trace_exception(ex)
|
||||
return jsonify({"status":False, 'error':str(ex)})
|
||||
|
||||
def clear_uploads(self):
|
||||
ASCIIColors.info("")
|
||||
|
14
scripts/wsl/explainer.md
Normal file
14
scripts/wsl/explainer.md
Normal 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:
|
@ -25,7 +25,7 @@ DefaultDirName={userappdata}\{#MyAppName}
|
||||
ChangesAssociations=yes
|
||||
DisableProgramGroupPage=yes
|
||||
LicenseFile=../../LICENSE
|
||||
InfoBeforeFile=../../CODE_OF_CONDUCT.md
|
||||
InfoBeforeFile=./explainer.md.
|
||||
InfoAfterFile=./README.md
|
||||
; Remove the following line to run in administrative install mode (install for all users.)
|
||||
PrivilegesRequired=lowest
|
||||
@ -44,31 +44,33 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
|
||||
[Files]
|
||||
Source: "{#MyAppExeName}"; 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: "run_script.sh"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "ubuntu.bat"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "petals_server.bat"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "petals_server.sh"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "uninstall.bat"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
Source: "../../assets\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "../../assets\ubuntu.ico"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "../../assets\petals.ico"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Registry]
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
|
||||
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: ""
|
||||
[Run]
|
||||
Filename: "{app}\wsl_installer.bat"; Flags: shellexec waituntilterminated
|
||||
Filename: "{app}\ubuntu_installer.bat"; Flags: shellexec waituntilterminated
|
||||
Filename: "{app}\requirements_installer.bat"; Flags: shellexec waituntilterminated
|
||||
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "{app}\uninstall.bat"; Flags: shellexec; RunOnceId: 1
|
||||
|
||||
[Icons]
|
||||
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; 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}\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
|
||||
|
||||
|
@ -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
|
4
scripts/wsl/requirements_installer.bat
Normal file
4
scripts/wsl/requirements_installer.bat
Normal file
@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
echo installing requirements
|
||||
wsl.exe -d Ubuntu-20.04 ./install_script.sh
|
||||
echo Script execution complete.
|
3
scripts/wsl/ubuntu_installer.bat
Normal file
3
scripts/wsl/ubuntu_installer.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
echo installing ubuntu
|
||||
wsl --install -d Ubuntu-20.04
|
10
scripts/wsl/wsl_installer.bat
Normal file
10
scripts/wsl/wsl_installer.bat
Normal 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
8
web/dist/assets/index-1c21f712.css
vendored
Normal file
8
web/dist/assets/index-1c21f712.css
vendored
Normal file
File diff suppressed because one or more lines are too long
8
web/dist/assets/index-9d0cda62.css
vendored
8
web/dist/assets/index-9d0cda62.css
vendored
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-57e478b9.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-9d0cda62.css">
|
||||
<script type="module" crossorigin src="/assets/index-1b4fff03.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-1c21f712.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -56,10 +56,16 @@
|
||||
<span class="sr-only">Click to install</span>
|
||||
</button>
|
||||
<button v-if="binding.installed" title="Click to Reinstall binding" type="button" @click.stop="toggleReinstall"
|
||||
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">
|
||||
Reinstall binding
|
||||
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">
|
||||
Reinstall
|
||||
|
||||
<span class="sr-only">Reinstall binding</span>
|
||||
<span class="sr-only">Reinstall</span>
|
||||
</button>
|
||||
<button v-if="binding.installed" title="Click to Reinstall binding" type="button" @click.stop="toggleUnInstall"
|
||||
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">
|
||||
Uninstall
|
||||
|
||||
<span class="sr-only">UnInstall</span>
|
||||
</button>
|
||||
<button v-if="selected" title="Click to open Settings" type="button" @click.stop="toggleSettings"
|
||||
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">
|
||||
@ -68,6 +74,7 @@
|
||||
<span class="sr-only">Settings</span>
|
||||
</button>
|
||||
</div>
|
||||
<DynamicUIRenderer v-if="binding.ui" class="w-full h-full" :code="binding.ui"></DynamicUIRenderer>
|
||||
<!-- <div class=" justify-end">
|
||||
<i data-feather="sliders" class="w-5 m-1"></i>
|
||||
</div>
|
||||
@ -119,13 +126,17 @@ import { nextTick } from 'vue'
|
||||
import feather from 'feather-icons'
|
||||
import botImgPlaceholder from "../assets/logo.svg"
|
||||
import userImgPlaceholder from "../assets/default_user.svg"
|
||||
import DynamicUIRenderer from "@/components/DynamicUIRenderer.vue"
|
||||
|
||||
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
|
||||
export default {
|
||||
components:{DynamicUIRenderer},
|
||||
props: {
|
||||
binding: {},
|
||||
onSelected: Function,
|
||||
onReinstall: Function,
|
||||
onInstall: Function,
|
||||
onUnInstall: Function,
|
||||
onSettings: Function,
|
||||
onReloadBinding: Function,
|
||||
selected: Boolean,
|
||||
@ -161,6 +172,9 @@ export default {
|
||||
toggleInstall() {
|
||||
this.onInstall(this)
|
||||
},
|
||||
toggleUnInstall() {
|
||||
this.onUnInstall(this)
|
||||
},
|
||||
toggleReinstall() {
|
||||
this.onReinstall(this)
|
||||
},
|
||||
|
@ -451,6 +451,10 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
'message.ui': function (newContent) {
|
||||
console.log("ui changed")
|
||||
console.log(this.message_ui)
|
||||
},
|
||||
showConfirmation() {
|
||||
nextTick(() => {
|
||||
feather.replace()
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div
|
||||
class="relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer select-none"
|
||||
class="relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none"
|
||||
:class="computed_classes"
|
||||
:title="model.name">
|
||||
<!-- CUSTOM MODEL VIEW -->
|
||||
@ -31,13 +31,7 @@
|
||||
</button>
|
||||
Custom model
|
||||
</div>
|
||||
<button v-if="model.isInstalled" type="button" title="Select"
|
||||
@click="toggleSelected"
|
||||
class="hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center " @click.stop="">
|
||||
<i data-feather="check" :class="selected?'border-2 border-blue-300 rounded bg-green-300 w-5':'border-2 border-blue-300 rounded bg-gray-100 w-5'"></i>
|
||||
<span class="sr-only">Select</span>
|
||||
</button>
|
||||
|
||||
<input v-model="model.selected" @click.stop="toggleSelected" type="checkbox" class='cursor-pointer border-2 border-blue-300 rounded w-10 h-10'>
|
||||
<div>
|
||||
<button v-if="model.isInstalled" title="Delete file from disk" type="button" @click.stop="toggleInstall"
|
||||
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">
|
||||
@ -117,12 +111,7 @@
|
||||
<div class="grow">
|
||||
<!-- EMPTY SPACE FILLER -->
|
||||
</div>
|
||||
<button v-if="model.isInstalled" type="button" title="Select"
|
||||
@click="toggleSelected"
|
||||
class="hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center " @click.stop="">
|
||||
<i data-feather="check" :class="selected?'border-2 border-blue-300 rounded bg-green-300 w-5':'border-2 border-blue-300 rounded bg-gray-100 w-5'"></i>
|
||||
<span class="sr-only">Select</span>
|
||||
</button>
|
||||
<input v-model="model.selected" @click.stop="toggleSelected" type="checkbox" class='cursor-pointer border-2 border-blue-300 rounded w-10 h-10'>
|
||||
|
||||
<InteractiveMenu :commands="commandsList" :force_position=2 title="Menu">
|
||||
|
||||
@ -247,7 +236,6 @@ import feather from 'feather-icons'
|
||||
import defaultImgPlaceholder from "../assets/default_model.png"
|
||||
import InteractiveMenu from "@/components/InteractiveMenu.vue"
|
||||
|
||||
|
||||
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
|
||||
export default {
|
||||
components:{InteractiveMenu},
|
||||
|
@ -1084,6 +1084,7 @@
|
||||
<BindingEntry ref="bindingZoo" v-for="(binding, index) in bindingsArr"
|
||||
:key="'index-' + index + '-' + binding.folder" :binding="binding"
|
||||
:on-selected="onSelectedBinding" :on-reinstall="onReinstallBinding"
|
||||
:on-unInstall="onUnInstallBinding"
|
||||
:on-install="onInstallBinding" :on-settings="onSettingsBinding"
|
||||
:on-reload-binding="onReloadBinding"
|
||||
:selected="binding.folder === configFile.binding_name">
|
||||
@ -2597,10 +2598,45 @@ export default {
|
||||
|
||||
// return
|
||||
// }
|
||||
this.update_binding(binding_object.binding.folder)
|
||||
if (binding_object.disclaimer){
|
||||
this.$refs.yesNoDialog.askQuestion(binding_object.disclaimer, 'Proceed', 'Cancel')
|
||||
if (res) {
|
||||
this.update_binding(binding_object.binding.folder)
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
this.update_binding(binding_object.binding.folder)
|
||||
}
|
||||
//console.log('lol',binding_object)
|
||||
}
|
||||
},
|
||||
onUnInstallBinding(binding_object){
|
||||
this.isLoading = true
|
||||
axios.post('/unInstall_binding', { name: binding_object.binding.folder }).then((res) => {
|
||||
|
||||
if (res) {
|
||||
this.isLoading = false
|
||||
console.log('unInstall_binding', res)
|
||||
if (res.data.status) {
|
||||
this.$refs.toast.showToast("Reinstalled binding successfully!", 4, true)
|
||||
} else {
|
||||
this.$refs.toast.showToast("Could not reinstall binding", 4, false)
|
||||
}
|
||||
return res.data;
|
||||
}
|
||||
this.isLoading = false
|
||||
binding_object.isInstalled=False
|
||||
|
||||
})
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
.catch(error => {
|
||||
this.isLoading = false
|
||||
this.$refs.toast.showToast("Could not reinstall binding\n" + error.message, 4, false)
|
||||
return { 'status': false }
|
||||
});
|
||||
},
|
||||
onReinstallBinding(binding_object) {
|
||||
this.isLoading = true
|
||||
axios.post('/reinstall_binding', { name: binding_object.binding.folder }).then((res) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user