mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
New structure, lollms is no more grubbed from pypi
This commit is contained in:
parent
a1dc373d15
commit
0046a804fb
8
.gitmodules
vendored
8
.gitmodules
vendored
@ -14,3 +14,11 @@
|
||||
path = zoos/models_zoo
|
||||
url = https://github.com/ParisNeo/models_zoo.git
|
||||
branch = main
|
||||
[submodule "lollms"]
|
||||
path = lollms_core
|
||||
url = https://github.com/ParisNeo/lollms.git
|
||||
branch = main
|
||||
[submodule "utilities/safe_store"]
|
||||
path = utilities/safe_store
|
||||
url = https://github.com/ParisNeo/safe_store.git
|
||||
branch = main
|
||||
|
@ -11,6 +11,9 @@
|
||||
[![Follow me on Twitter](https://img.shields.io/twitter/follow/SpaceNerduino?style=social)](https://twitter.com/SpaceNerduino)
|
||||
[![Follow Me on YouTube](https://img.shields.io/badge/Follow%20Me%20on-YouTube-red?style=flat&logo=youtube)](https://www.youtube.com/user/Parisneo)
|
||||
[![pages-build-deployment](https://github.com/ParisNeo/lollms-webui/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/ParisNeo/lollms-webui/actions/workflows/pages/pages-build-deployment)
|
||||
[![Downloads](https://static.pepy.tech/badge/lollms-webui)](https://pepy.tech/project/lollms-webui)
|
||||
[![Downloads](https://static.pepy.tech/badge/lollms-webui/month)](https://pepy.tech/project/lollms-webui)
|
||||
[![Downloads](https://static.pepy.tech/badge/lollms-webui/week)](https://pepy.tech/project/lollms-webui)
|
||||
|
||||
Welcome to LoLLMS WebUI (Lord of Large Language Models: One tool to rule them all), the hub for LLM (Large Language Model) models. This project aims to provide a user-friendly interface to access and utilize various LLM models for a wide range of tasks. Whether you need help with writing, coding, organizing data, generating images, generating music or seeking answers to your questions, LoLLMS WebUI has got you covered.
|
||||
|
||||
|
@ -117,8 +117,6 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
super().__init__("Lollms_webui",config, lollms_paths, callback=self.process_chunk)
|
||||
|
||||
|
||||
|
||||
|
||||
self.busy = False
|
||||
self.nb_received_tokens = 0
|
||||
|
||||
@ -956,7 +954,7 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
if personality in loaded_names:
|
||||
mounted_personalities.append(loaded[loaded_names.index(personality)])
|
||||
else:
|
||||
personality_path = self.lollms_paths.personalities_zoo_path/f"{personality}" if not ":" in personality else self.lollms_paths.personalities_zoo_path/f"{personality.split(':')[0]}"
|
||||
personality_path = f"{personality}" if not ":" in personality else f"{personality.split(':')[0]}"
|
||||
try:
|
||||
personality = AIPersonality(personality_path,
|
||||
self.lollms_paths,
|
||||
|
10
app.py
10
app.py
@ -1806,7 +1806,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
if self.config.auto_save:
|
||||
ASCIIColors.info("Saving configuration")
|
||||
self.config.save_config()
|
||||
ASCIIColors.error(f"Personality {name} mounted successfully")
|
||||
ASCIIColors.success(f"Personality {name} mounted successfully")
|
||||
return jsonify({"status": True,
|
||||
"personalities":self.config["personalities"],
|
||||
"active_personality_id":self.config["active_personality_id"]
|
||||
@ -1896,7 +1896,10 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
else:
|
||||
self.personalities = ["generic/lollms"]
|
||||
self.mounted_personalities = self.rebuild_personalities()
|
||||
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
|
||||
if self.config["active_personality_id"]<len(self.mounted_personalities):
|
||||
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
|
||||
else:
|
||||
self.config["active_personality_id"] = -1
|
||||
ASCIIColors.success("ok")
|
||||
if self.config.auto_save:
|
||||
ASCIIColors.info("Saving configuration")
|
||||
@ -1906,7 +1909,8 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
"personalities":self.config["personalities"],
|
||||
"active_personality_id":self.config["active_personality_id"]
|
||||
})
|
||||
except:
|
||||
except Exception as ex:
|
||||
trace_exception(ex)
|
||||
if language:
|
||||
ASCIIColors.error(f"nok : Personality not found @ {category}/{name}:{language}")
|
||||
else:
|
||||
|
1
lollms_core
Submodule
1
lollms_core
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 6f583fe3164d389fbcc91617e5b58b21cb9c33a6
|
@ -7,12 +7,10 @@ pyyaml
|
||||
markdown
|
||||
gevent
|
||||
gevent-websocket
|
||||
lollms
|
||||
langchain
|
||||
requests
|
||||
eventlet
|
||||
websocket-client
|
||||
GitPython
|
||||
setuptools
|
||||
numpy==1.24
|
||||
safe_store
|
||||
numpy==1.24
|
@ -7,7 +7,6 @@ pyyaml
|
||||
markdown
|
||||
gevent
|
||||
gevent-websocket
|
||||
lollms
|
||||
langchain
|
||||
requests
|
||||
eventlet
|
||||
|
@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
## untested Linux shell script
|
||||
#
|
||||
|
||||
#set filename=../models/%1
|
||||
FILENAME="../models/$1"
|
||||
#set newname=../models/%1.original
|
||||
NEWNAME="../models/$1.original"
|
||||
|
||||
#echo %modelPath%
|
||||
echo Converting the model to the new format...
|
||||
#if not exist tmp\llama.cpp git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp
|
||||
if [! -e tmp\llama.cpp]; then $(git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp)
|
||||
cd tmp\llama.cpp
|
||||
cd ../..
|
||||
#move /y "%filename%" "%newname%"
|
||||
mv -f $FILENAME $NEWNAME
|
||||
echo Converting ...
|
||||
#python tmp\llama.cpp\convert.py "%newname%" --outfile "%filename%"
|
||||
python -c tmp\llama.cpp\convert.py \"$NEWNAME\" --outfile \"$FILENAME\"
|
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
## Untested Linux shell script
|
||||
#
|
||||
FILENAME="../models/alpaca"
|
||||
TOKENIZER="../models/alpaca/alpaca_tokenizer.model"
|
||||
# echo %modelPath%
|
||||
echo Converting the model to the new format...
|
||||
if [! -e tmp\llama.cpp]; then $(git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp)
|
||||
cd tmp\llama.cpp
|
||||
$(git checkout 6c248707f51c8a50f7792e7f7787ec481881db88)
|
||||
cd ../..
|
||||
echo Converting ...
|
||||
python -c tmp\llama.cpp\convert-lollms-to-ggml.py \"$FILENAME\" \"$TOKENIZER\"
|
@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
## untested Linux shell script
|
||||
#
|
||||
FILENAME="../models/$1"
|
||||
NEWNAME="../models/$1.original"
|
||||
|
||||
#echo %modelPath%
|
||||
echo Converting the model to the new format...
|
||||
#if not exist tmp\llama.cpp git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp
|
||||
if [! -e tmp\llama.cpp]; then $(git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp)
|
||||
cd tmp\llama.cpp
|
||||
cd ../..
|
||||
#move /y "%filename%" "%newname%"
|
||||
mv -f $FILENAME $NEWNAME
|
||||
echo Converting ...
|
||||
python -c tmp\llama.cpp\convert.py \"$NEWNAME\" --outfile \"$FILENAME\" --vocab-dir $2
|
@ -126,6 +126,9 @@ else
|
||||
git clone "$REPO_URL"
|
||||
cd lollms-webui || exit 1
|
||||
fi
|
||||
|
||||
# Initilize all submodules and set them to main branch
|
||||
echo "Initializing submodules"
|
||||
git submodule update --init
|
||||
cd zoos/bindings_zoo
|
||||
git checkout main
|
||||
@ -136,6 +139,13 @@ git checkout main
|
||||
cd ../models_zoo
|
||||
git checkout main
|
||||
|
||||
cd ../..
|
||||
cd ../lollms_core
|
||||
git checkout main
|
||||
|
||||
cd ../utilities/safe_store
|
||||
git checkout main
|
||||
|
||||
cd ../..
|
||||
# Loop through each "git+" requirement and uninstall it (workaround for inconsistent git package updating)
|
||||
while IFS= read -r requirement; do
|
||||
@ -147,6 +157,9 @@ done < requirements.txt
|
||||
|
||||
# Install the pip requirements
|
||||
python -m pip install -r requirements.txt --upgrade
|
||||
python -m pip install -e lollms_core --upgrade
|
||||
python -m pip install -e utilities/safe_store --upgrade
|
||||
|
||||
|
||||
if [[ -e "../linux_run.sh" ]]; then
|
||||
echo "Linux run found"
|
||||
|
41
scripts/macos/macos_conda_session.sh
Normal file
41
scripts/macos/macos_conda_session.sh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
echo "Starting LOLLMS Web UI..."
|
||||
echo " ___ ___ ___ ___ ___ ___ "
|
||||
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
|
||||
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
|
||||
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
|
||||
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
|
||||
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
|
||||
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
|
||||
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
|
||||
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
|
||||
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
|
||||
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
|
||||
echo " By ParisNeo"
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Better isolation for virtual environment
|
||||
CONDA_SHLVL=""
|
||||
PYTHONNOUSERSITE=1
|
||||
PYTHONPATH=""
|
||||
PYTHONHOME=""
|
||||
TEMP="./installer_files/temp"
|
||||
TMP="./installer_files/temp"
|
||||
ENV_NAME="lollms"
|
||||
INSTALL_ENV_DIR="./installer_files/miniconda3/envs/lollms"
|
||||
MINICONDA_DIR="./installer_files/miniconda3"
|
||||
|
||||
if [ ! -f "$MINICONDA_DIR/bin/activate" ]; then
|
||||
echo "Miniconda not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$MINICONDA_DIR/bin/activate" "$ENV_NAME"
|
||||
cd lollms-webui
|
||||
|
||||
# Set default CUDA toolkit to the one in the environment
|
||||
CUDA_PATH="$INSTALL_ENV_DIR"
|
||||
|
||||
|
||||
read -rp "Conda environment activated"
|
@ -119,6 +119,8 @@ else
|
||||
cd lollms-webui || exit 1
|
||||
fi
|
||||
|
||||
# Initilize all submodules and set them to main branch
|
||||
echo "Initializing submodules"
|
||||
git submodule update --init
|
||||
cd zoos/bindings_zoo
|
||||
git checkout main
|
||||
@ -129,6 +131,13 @@ git checkout main
|
||||
cd ../models_zoo
|
||||
git checkout main
|
||||
|
||||
cd ../..
|
||||
cd ../lollms_core
|
||||
git checkout main
|
||||
|
||||
cd ../utilities/safe_store
|
||||
git checkout main
|
||||
|
||||
cd ../..
|
||||
|
||||
# Loop through each "git+" requirement and uninstall it (workaround for inconsistent git package updating)
|
||||
@ -142,6 +151,9 @@ done < requirements.txt
|
||||
# Install the pip requirements
|
||||
python -m pip install -r requirements.txt --upgrade
|
||||
|
||||
python -m pip install -e lollms_core --upgrade
|
||||
|
||||
python -m pip install -e utilities/safe_store --upgrade
|
||||
|
||||
if [[ -e "../macos_run.sh" ]]; then
|
||||
echo "Macos run found"
|
||||
|
@ -1,159 +0,0 @@
|
||||
@echo off
|
||||
set environment_path=%cd%/lollms-webui/env
|
||||
|
||||
echo \u001b[34m
|
||||
echo " ___ ___ ___ ___ ___ ___ "
|
||||
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
|
||||
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
|
||||
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
|
||||
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
|
||||
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
|
||||
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
|
||||
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
|
||||
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
|
||||
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
|
||||
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
|
||||
echo By ParisNeo
|
||||
echo \u001b[0m
|
||||
|
||||
echo Testing internet connection
|
||||
ping -n 1 google.com >nul
|
||||
if %errorlevel% equ 0 (
|
||||
echo Internet Connection working fine
|
||||
|
||||
REM Install Git
|
||||
echo Checking for Git...
|
||||
where git >nul 2>nul
|
||||
if %errorlevel% equ 0 (
|
||||
echo Git is installed
|
||||
) else (
|
||||
set /p choice=Git is not installed. Would you like to install Git? [Y/N]
|
||||
if /i "%choice%"=="Y" (
|
||||
echo Installing Git...
|
||||
REM Replace the following two lines with appropriate Git installation commands for Windows
|
||||
echo Please install Git and try again.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Check if repository exists
|
||||
if exist .git (
|
||||
echo Pulling latest changes
|
||||
git pull
|
||||
) else (
|
||||
if exist lollms-webui (
|
||||
cd ./lollms-webui
|
||||
) else (
|
||||
echo Cloning repository...
|
||||
git clone https://github.com/ParisNeo/lollms-webui.git ./lollms-webui
|
||||
cd ./lollms-webui
|
||||
echo Cloned successfully
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
echo Pulling latest version...
|
||||
git pull
|
||||
|
||||
REM Install Conda
|
||||
echo Checking for Conda...
|
||||
where conda >nul 2>nul
|
||||
if %errorlevel% equ 0 (
|
||||
echo Conda is installed
|
||||
) else (
|
||||
set /p choice="Conda is not installed. Would you like to install Conda? [Y/N]:"
|
||||
if /i "%choice%"=="Y" (
|
||||
echo Installing Conda...
|
||||
set "miniconda_installer_url=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe"
|
||||
set "miniconda_installer=miniconda_installer_filename.exe"
|
||||
rem Download the Miniconda installer using curl.
|
||||
curl -o "%miniconda_installer%" "%miniconda_installer_url%"
|
||||
if exist "%miniconda_installer%" (
|
||||
echo Miniconda installer downloaded successfully.
|
||||
echo Installing Miniconda...
|
||||
echo.
|
||||
|
||||
rem Run the Miniconda installer.
|
||||
"%miniconda_installer%" /InstallationType=JustMe /AddToPath=yes /RegisterPython=0 /S /D="%USERPROFILE%\Miniconda"
|
||||
|
||||
if %errorlevel% equ 0 (
|
||||
echo Miniconda has been installed successfully in "%USERPROFILE%\Miniconda".
|
||||
) else (
|
||||
echo Failed to install Miniconda.
|
||||
)
|
||||
|
||||
rem Clean up the Miniconda installer file.
|
||||
del "%miniconda_installer%"
|
||||
|
||||
rem Activate Miniconda.
|
||||
call "%USERPROFILE%\Miniconda\Scripts\activate"
|
||||
|
||||
) else (
|
||||
echo Failed to download the Miniconda installer.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
)
|
||||
echo Deactivating any activated environment
|
||||
conda deactivate
|
||||
|
||||
echo checking %environment_path% existance
|
||||
|
||||
rem Check the error level to determine if the file exists
|
||||
if not exist "%environment_path%" (
|
||||
REM Create a new Conda environment
|
||||
echo Creating Conda environment...
|
||||
conda create --prefix ./env python=3.10
|
||||
conda activate ./env
|
||||
pip install --upgrade pip setuptools wheel
|
||||
conda install -c conda-forge cudatoolkit-dev
|
||||
) else (
|
||||
echo Environment already exists. Skipping environment creation.
|
||||
conda activate ./env
|
||||
)
|
||||
|
||||
echo Activating environment
|
||||
conda activate ./env
|
||||
echo Conda environment is created
|
||||
REM Install the required packages
|
||||
echo Installing requirements using pip...
|
||||
pip install -r requirements.txt
|
||||
|
||||
if %errorlevel% neq 0 (
|
||||
echo Failed to install required packages. Please check your internet connection and try again.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Cleanup
|
||||
REM Cleanup
|
||||
if exist "./tmp" (
|
||||
echo Cleaning tmp folder
|
||||
rmdir /s /q "./tmp"
|
||||
echo Done
|
||||
)
|
||||
echo Ready
|
||||
echo launching app
|
||||
REM Launch the Python application
|
||||
python app.py %*
|
||||
set app_result=%errorlevel%
|
||||
|
||||
pause >nul
|
||||
exit /b 0
|
||||
|
||||
) else (
|
||||
REM Go to webui folder
|
||||
cd lollms-webui
|
||||
|
||||
REM Activate environment
|
||||
conda activate ./env
|
||||
|
||||
echo launching app
|
||||
REM Launch the Python application
|
||||
python app.py %*
|
||||
set app_result=%errorlevel%
|
||||
|
||||
pause >nul
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
@echo off
|
||||
@echo off
|
||||
set filename=../models/%1
|
||||
set newname=../models/%1.original
|
||||
|
||||
echo %modelPath%
|
||||
echo Converting the model to the new format...
|
||||
if not exist tmp\llama.cpp git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp
|
||||
cd tmp\llama.cpp
|
||||
cd ../..
|
||||
move /y "%filename%" "%newname%"
|
||||
echo Converting ...
|
||||
python tmp\llama.cpp\convert.py "%newname%" --outfile "%filename%"
|
@ -1,12 +0,0 @@
|
||||
@echo off
|
||||
REM put the model to ../models/alpaca as well as the tokenizer
|
||||
set filename=../models/alpaca
|
||||
set tokenizer=../models/alpaca/alpaca_tokenizer.model
|
||||
echo %modelPath%
|
||||
echo Converting the model to the new format...
|
||||
if not exist tmp\llama.cpp git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp
|
||||
cd tmp\llama.cpp
|
||||
git checkout 6c248707f51c8a50f7792e7f7787ec481881db88
|
||||
cd ../..
|
||||
echo Converting ...
|
||||
python tmp\llama.cpp\convert-lollms-to-ggml.py "%filename%" "%tokenizer%"
|
@ -1,13 +0,0 @@
|
||||
@echo off
|
||||
@echo off
|
||||
set filename=../models/%1
|
||||
set newname=../models/%1.original
|
||||
|
||||
echo %modelPath%
|
||||
echo Converting the model to the new format...
|
||||
if not exist tmp\llama.cpp git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp
|
||||
cd tmp\llama.cpp
|
||||
cd ../..
|
||||
move /y "%filename%" "%newname%"
|
||||
echo Converting ...
|
||||
python tmp\llama.cpp\convert.py "%newname%" --outfile "%filename%" --vocab-dir %2
|
@ -140,6 +140,14 @@ cd ../models_zoo
|
||||
git checkout main
|
||||
|
||||
cd ../..
|
||||
cd ../lollms_core
|
||||
git checkout main
|
||||
|
||||
cd ../utilities/safe_store
|
||||
git checkout main
|
||||
|
||||
cd ../..
|
||||
|
||||
|
||||
@rem Loop through each "git+" requirement and uninstall it workaround for inconsistent git package updating
|
||||
for /F "delims=" %%a in (requirements.txt) do echo "%%a"| findstr /C:"git+" >nul&& for /F "tokens=4 delims=/" %%b in ("%%a") do for /F "delims=@" %%c in ("%%b") do python -m pip uninstall -y %%c
|
||||
@ -147,6 +155,13 @@ for /F "delims=" %%a in (requirements.txt) do echo "%%a"| findstr /C:"git+" >nul
|
||||
@rem install the pip requirements
|
||||
call python -m pip install -r requirements.txt --upgrade
|
||||
|
||||
@rem install the pip requirements
|
||||
call python -m pip install -e lollms_core --upgrade
|
||||
|
||||
@rem install the pip requirements
|
||||
call python -m pip install -e utilities/safe_store --upgrade
|
||||
|
||||
|
||||
@rem create launcher
|
||||
if exist ..\win_run.bat (
|
||||
echo Win run found
|
||||
|
1
utilities/safe_store
Submodule
1
utilities/safe_store
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit d7e54b2404595d4f6314cdd42e399c5fe6c9af1e
|
@ -485,6 +485,7 @@ export default {
|
||||
onUnmountFun(comp) {
|
||||
console.log('Unmounting personality')
|
||||
this.$refs.mountedPers.constructor()
|
||||
|
||||
},
|
||||
onRemount(comp){
|
||||
console.log('Remounting chat')
|
||||
|
@ -38,14 +38,14 @@ const markdownIt = new MarkdownIt('commonmark', {
|
||||
let discussion_id = 0
|
||||
let message_id = 0
|
||||
|
||||
let btn_exec_txt = (lang=='python' || lang=='bash') ?'<button class="px-2 py-1 ml-10 mb-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">' +
|
||||
let btn_exec_txt = (lang=='python' || lang=='bash' || lang=='shell' || lang=='cmd' || lang=='powershell') ?'<button class="px-2 py-1 ml-10 mb-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">' +
|
||||
'<span class="mr-1" id="exec-btn_' +
|
||||
id +
|
||||
'" onclick="executeCode(' +
|
||||
id + ',' + discussion_id + ',' + message_id + ',`' + lang +
|
||||
'`)">Execute</span>'+
|
||||
'</button>':''
|
||||
let btn_open_in_vs_code_txt = (lang=='python' || lang=='bash') ?'<button class="px-2 py-1 ml-10 mb-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">' +
|
||||
let btn_open_in_vs_code_txt = (lang!='shell' && lang!='cmd' && lang!='powershell') ?'<button class="px-2 py-1 ml-10 mb-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">' +
|
||||
'<span class="mr-1" id="exec-btn_' +
|
||||
id + '5' +
|
||||
'" onclick="openInVsCode(' +
|
||||
@ -53,7 +53,7 @@ const markdownIt = new MarkdownIt('commonmark', {
|
||||
'`)">Show in vs code</span>'+
|
||||
'</button>':''
|
||||
|
||||
let btn_open_folder_txt = (lang=='python' || lang=='bash') ?'<button class="px-2 py-1 ml-10 mb-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">' +
|
||||
let btn_open_folder_txt = (lang=='python') ?'<button class="px-2 py-1 ml-10 mb-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">' +
|
||||
'<span class="mr-1" id="exec-btn_' +
|
||||
id + '6' +
|
||||
'" onclick="openFolder(' +
|
||||
@ -85,7 +85,7 @@ const markdownIt = new MarkdownIt('commonmark', {
|
||||
'</button>' +
|
||||
btn_exec_txt +
|
||||
btn_open_in_vs_code_txt +
|
||||
|
||||
btn_open_folder_txt+
|
||||
'<pre class="hljs p-1 rounded-md break-all grid grid-cols-1">' +
|
||||
'<code id="code_' +
|
||||
id +
|
||||
@ -131,6 +131,8 @@ const markdownIt = new MarkdownIt('commonmark', {
|
||||
|
||||
btn_open_in_vs_code_txt +
|
||||
|
||||
btn_open_folder_txt +
|
||||
|
||||
'<pre class="hljs p-1 rounded-md break-all grid grid-cols-1">' +
|
||||
'<code id="code_' +
|
||||
id +
|
||||
|
257
webui.bat
257
webui.bat
@ -1,257 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo \u001b[34m
|
||||
echo " ___ ___ ___ ___ ___ ___ "
|
||||
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
|
||||
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
|
||||
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
|
||||
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
|
||||
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
|
||||
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
|
||||
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
|
||||
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
|
||||
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
|
||||
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
|
||||
echo By ParisNeo
|
||||
echo \u001b[0m
|
||||
echo Checking internet connection
|
||||
|
||||
ping google.com -n 1 >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Internet connection not available
|
||||
goto NO_INTERNET
|
||||
) else (
|
||||
goto INTERNET_OK
|
||||
)
|
||||
:NO_INTERNET
|
||||
|
||||
if exist lollms-webui (
|
||||
echo lollms-webui folder found
|
||||
cd lollms-webui
|
||||
set /p="Activating virtual environment ..." <nul
|
||||
call env\Scripts\activate.bat
|
||||
)
|
||||
goto END
|
||||
|
||||
:INTERNET_OK
|
||||
echo \e[32mInternet connection working fine
|
||||
|
||||
REM Check if Git is installed
|
||||
echo "Checking for git..."
|
||||
where git >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
goto GIT_CHECKED
|
||||
) else (
|
||||
goto GIT_INSTALL
|
||||
)
|
||||
:GIT_FINISH
|
||||
|
||||
REM Check if Git is installed
|
||||
:GIT_CHECKED
|
||||
echo "Git is installed."
|
||||
goto GIT_SKIP
|
||||
|
||||
:GIT_INSTALL
|
||||
echo.
|
||||
choice /C YN /M "Do you want to download and install Git?"
|
||||
if errorlevel 2 goto GIT_CANCEL
|
||||
if errorlevel 1 goto GIT_INSTALL_2
|
||||
|
||||
:GIT_INSTALL_2
|
||||
echo "Git is not installed. Installing Git..."
|
||||
powershell.exe -Command "Start-Process https://git-scm.com/download/win -Wait"
|
||||
goto GIT_SKIP
|
||||
|
||||
:GIT_CANCEL
|
||||
echo.
|
||||
echo Git download cancelled.
|
||||
echo Please install Git and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:GIT_SKIP
|
||||
|
||||
REM Check if repository exists
|
||||
echo checking git repository
|
||||
if exist ".git" (
|
||||
goto :PULL_CHANGES
|
||||
) else (
|
||||
goto :CLONE_REPO
|
||||
)
|
||||
|
||||
:PULL_CHANGES
|
||||
echo Pulling latest changes
|
||||
git pull
|
||||
goto :CHECK_PYTHON_INSTALL
|
||||
|
||||
:CLONE_REPO
|
||||
REM Check if repository exists
|
||||
if exist lollms-webui (
|
||||
echo lollms-webui folder found
|
||||
cd lollms-webui
|
||||
echo Pulling latest changes
|
||||
git pull
|
||||
) else (
|
||||
echo Cloning repository...
|
||||
rem Clone the Git repository into a temporary directory
|
||||
git clone https://github.com/ParisNeo/lollms-webui.git ./lollms-webui
|
||||
cd lollms-webui
|
||||
echo Pulling latest changes
|
||||
git pull
|
||||
)
|
||||
|
||||
:CHECK_PYTHON_INSTALL
|
||||
REM Check if Python is installed
|
||||
set /p="Checking for python..." <nul
|
||||
where python >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
goto PYTHON_CHECKED
|
||||
) else (
|
||||
goto PYTHON_INSTALL
|
||||
)
|
||||
:PYTHON_CHECKED
|
||||
echo "Python is installed."
|
||||
goto PYTHON_SKIP
|
||||
|
||||
:PYTHON_INSTALL
|
||||
echo.
|
||||
choice /C YN /M "Do you want to download and install python?"
|
||||
if errorlevel 2 goto PYTHON_CANCEL
|
||||
if errorlevel 1 goto PYTHON_INSTALL_2
|
||||
|
||||
:PYTHON_INSTALL_2
|
||||
REM Download Python installer
|
||||
if not exist "./tmp" mkdir "./tmp"
|
||||
echo Downloading Python installer...
|
||||
powershell -Command "Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe' -OutFile 'tmp/python.exe'"
|
||||
REM Install Python
|
||||
echo Installing Python...
|
||||
tmp/python.exe /quiet /norestart
|
||||
|
||||
:PYTHON_CANCEL
|
||||
echo Please install python and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:PYTHON_SKIP
|
||||
|
||||
REM Check if pip is installed
|
||||
set /p="Checking for pip..." <nul
|
||||
python -m pip >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
goto PIP_CHECKED
|
||||
) else (
|
||||
goto PIP_INSTALL
|
||||
)
|
||||
:PIP_CHECKED
|
||||
echo "Pip is installed."
|
||||
goto PIP_SKIP
|
||||
|
||||
:PIP_INSTALL
|
||||
echo.
|
||||
choice /C YN /M "Do you want to download and install pip?"
|
||||
if errorlevel 2 goto PIP_CANCEL
|
||||
if errorlevel 1 goto PIP_INSTALL_2
|
||||
|
||||
:PIP_INSTALL_2
|
||||
REM Download get-pip.py
|
||||
echo Downloading get-pip.py...
|
||||
powershell -Command "Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'tmp/get-pip.py'"
|
||||
REM Install pip
|
||||
echo Installing pip...
|
||||
python tmp/get-pip.py
|
||||
REM Upgrading pip setuptools and wheel
|
||||
echo Updating pip setuptools and wheel
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
goto PIP_SKIP
|
||||
:PIP_CANCEL
|
||||
echo Please install pip and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:PIP_SKIP
|
||||
|
||||
REM Check if pip is installed
|
||||
set /p="Checking for virtual environment..." <nul
|
||||
python -c "import venv" >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
goto VENV_CHECKED
|
||||
) else (
|
||||
goto VENV_INSTALL
|
||||
)
|
||||
:VENV_CHECKED
|
||||
echo "Virtual environment is installed."
|
||||
goto VENV_SKIP
|
||||
|
||||
:VENV_INSTALL
|
||||
echo.
|
||||
choice /C YN /M "Do you want to download and install venv?"
|
||||
if errorlevel 2 goto VENV_CANCEL
|
||||
if errorlevel 1 goto VENV_INSTALL_2
|
||||
|
||||
:VENV_INSTALL_2
|
||||
REM Installinv venv
|
||||
echo installing venv...
|
||||
pip install virtualenv
|
||||
|
||||
:VENV_CANCEL
|
||||
echo Please install venv and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:VENV_SKIP
|
||||
|
||||
echo Checking virtual environment.
|
||||
if exist ./env (
|
||||
echo Virtual environment already exists.
|
||||
goto VENV_CREATED
|
||||
)
|
||||
|
||||
REM Create a new virtual environment
|
||||
set /p="Creating virtual environment ..." <nul
|
||||
python -m venv env >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
goto VENV_CREATED
|
||||
) else (
|
||||
echo Failed to create virtual environment. Please check your Python installation and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
:VENV_CREATED
|
||||
|
||||
|
||||
REM Activate the virtual environment
|
||||
set /p="Activating virtual environment ..." <nul
|
||||
call env\Scripts\activate.bat
|
||||
echo OK
|
||||
REM Install the required packages
|
||||
echo Installing requirements ...
|
||||
python -m pip install pip --upgrade
|
||||
python -m pip install --upgrade -r requirements.txt --ignore-installed
|
||||
if %ERRORLEVEL% neq 0 (
|
||||
echo Failed to install required packages. Please check your internet connection and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Checking models...
|
||||
if not exist \models (
|
||||
md \models
|
||||
)
|
||||
|
||||
:END
|
||||
if exist "./tmp" (
|
||||
echo Cleaning tmp folder
|
||||
rd /s /q "./tmp"
|
||||
)
|
||||
|
||||
echo Virtual environment created and packages installed successfully.
|
||||
echo Launching application...
|
||||
|
||||
REM Run the Python app
|
||||
|
||||
python app.py %*
|
||||
set app_result=%errorlevel%
|
||||
|
||||
pause >nul
|
||||
exit /b 0
|
Loading…
Reference in New Issue
Block a user