upgraded LAUNCHERS to remove annoying questions

This commit is contained in:
saloui 2023-04-28 10:07:58 +02:00
parent 46708e096f
commit 53b45573bc
2 changed files with 139 additions and 121 deletions

View File

@ -35,6 +35,18 @@ echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo Checking internet connection
ping google.com -n 1 >nul 2>&1
if errorlevel 1 (
echo Internet connection not available
set /p="Activating virtual environment ..." <nul
call env\Scripts\activate.bat
goto END
)
echo \e[32mInternet connection working fine
@ -242,13 +254,14 @@ if %ERRORLEVEL% neq 0 (
pause
exit /b 1
)
echo \033[32m Internet Connection working fine
echo Checking models...
if not exist \models (
md \models
)
if not exist ./models/llama_cpp/gpt4all-lora-quantized-ggml.bin (
dir "./models/llama_cpp/*.bin" /b >nul 2>&1
if errorlevel 1 (
echo.
choice /C YNB /M "The default model file (gpt4all-lora-quantized-ggml.bin) does not exist. Do you want to download it? Press B to download it with a browser (faster)."
if errorlevel 3 goto DOWNLOAD_WITH_BROWSER

243
webui.sh
View File

@ -33,86 +33,135 @@ echo "HHHHHHHHHHHH.HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
echo "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
echo "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
echo "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
# Install git
echo -n "Checking for Git..."
if command -v git > /dev/null 2>&1; then
echo "is installed"
else
read -p "Git is not installed. Would you like to install Git? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing Git..."
sudo apt update
sudo apt install -y git
else
echo "Please install Git and try again."
exit 1
fi
fi
# Check if repository exists
if [[ -d .git ]] ;then
echo Pulling latest changes
git pull origin main
else
if [[ -d GPT4All ]] ;then
cd GPT4All
else
echo Cloning repository...
rem Clone the Git repository into a temporary directory
git clone https://github.com/nomic-ai/gpt4all-ui.git ./GPT4All
cd GPT4All
fi
fi
echo Pulling latest version...
git pull
# Download latest personalities
if ! test -d ./tmp/personalities; then
git clone https://github.com/ParisNeo/GPT4All_Personalities.git ./tmp/personalities
fi
cp ./tmp/personalities/* ./personalities/
if ping -q -c 1 google.com >/dev/null 2>&1; then
echo -e "\e[32mInternet Connection working fine\e[0m"
# Install git
echo -n "Checking for Git..."
if command -v git > /dev/null 2>&1; then
echo "is installed"
else
read -p "Git is not installed. Would you like to install Git? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing Git..."
sudo apt update
sudo apt install -y git
else
echo "Please install Git and try again."
exit 1
fi
fi
# Install Python 3.10 and pip
echo -n "Checking for python3.10..."
if command -v python3.10 > /dev/null 2>&1; then
echo "is installed"
else
read -p "Python3.10 is not installed. Would you like to install Python3.10? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing Python3.10..."
sudo apt update
sudo apt install -y python3.10 python3.10-venv
else
echo "Please install Python3.10 and try again."
exit 1
fi
fi
# Check if repository exists
if [[ -d .git ]] ;then
echo Pulling latest changes
git pull origin main
else
if [[ -d GPT4All ]] ;then
cd GPT4All
else
echo Cloning repository...
rem Clone the Git repository into a temporary directory
git clone https://github.com/nomic-ai/gpt4all-ui.git ./GPT4All
cd GPT4All
fi
fi
echo Pulling latest version...
git pull
# Download latest personalities
if ! test -d ./tmp/personalities; then
git clone https://github.com/ParisNeo/GPT4All_Personalities.git ./tmp/personalities
fi
cp ./tmp/personalities/* ./personalities/
# Install venv module
echo -n "Checking for venv module..."
if python3.10 -m venv env > /dev/null 2>&1; then
echo "is installed"
else
read -p "venv module is not available. Would you like to install it? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing venv module..."
sudo apt update
sudo apt install -y python3.10-venv
else
echo "Please install venv module and try again."
exit 1
fi
fi
# Install Python 3.10 and pip
echo -n "Checking for python3.10..."
if command -v python3.10 > /dev/null 2>&1; then
echo "is installed"
else
read -p "Python3.10 is not installed. Would you like to install Python3.10? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing Python3.10..."
sudo apt update
sudo apt install -y python3.10 python3.10-venv
else
echo "Please install Python3.10 and try again."
exit 1
fi
fi
# Create a new virtual environment
echo -n "Creating virtual environment..."
python3.10 -m venv env
if [ $? -ne 0 ]; then
echo "Failed to create virtual environment. Please check your Python installation and try again."
exit 1
else
echo "is created"
fi
# Install venv module
echo -n "Checking for venv module..."
if python3.10 -m venv env > /dev/null 2>&1; then
echo "is installed"
else
read -p "venv module is not available. Would you like to install it? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing venv module..."
sudo apt update
sudo apt install -y python3.10-venv
else
echo "Please install venv module and try again."
exit 1
fi
fi
# Create a new virtual environment
echo -n "Creating virtual environment..."
python3.10 -m venv env
if [ $? -ne 0 ]; then
echo "Failed to create virtual environment. Please check your Python installation and try again."
exit 1
else
echo "is created"
fi
# Checking model
MODEL="./models/llama_cpp/gpt4all-lora-quantized-ggml.bin"
MODEL_URL="https://huggingface.co/ParisNeo/GPT4All/resolve/main/gpt4all-lora-quantized-ggml.bin"
if [ -f "$MODEL" ]; then
echo "File $MODEL already exists. Skipping download."
else
echo "File $MODEL does not exist."
echo "What would you like to do?"
select option in "Download" "Download using browser" "Skip"; do
case $option in
Download)
if [ -x "$(command -v wget)" ]; then
wget "$MODEL_URL" -P ./models/llama_cpp/
elif [ -x "$(command -v curl)" ]; then
curl -o "$MODEL" "$MODEL_URL"
else
echo "Error: neither wget nor curl is installed. Please install one of them and try again."
exit 1
fi
break
;;
"Download using browser")
if [ -x "$(command -v xdg-open)" ]; then
xdg-open "$MODEL_URL"
elif [ -x "$(command -v gnome-open)" ]; then
gnome-open "$MODEL_URL"
elif [ -x "$(command -v kde-open)" ]; then
kde-open "$MODEL_URL"
elif [ -x "$(command -v open)" ]; then
open "$MODEL_URL"
else
echo "Error: could not detect a default browser. Please open the link in your web browser manually and press any key to continue."
read -n 1 -s -r -p "Press any key to continue"$'\n'
fi
break
;;
Skip)
echo "Skipping downloading $MODEL"
break
;;
esac
done
fi
else
echo "Internet connection not available"
fi
# Activate the virtual environment
echo -n "Activating virtual environment..."
source env/bin/activate
@ -128,51 +177,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
# Checking model
MODEL="./models/llama_cpp/gpt4all-lora-quantized-ggml.bin"
MODEL_URL="https://huggingface.co/ParisNeo/GPT4All/resolve/main/gpt4all-lora-quantized-ggml.bin"
if [ -f "$MODEL" ]; then
echo "File $MODEL already exists. Skipping download."
else
echo "File $MODEL does not exist."
echo "What would you like to do?"
select option in "Download" "Download using browser" "Skip"; do
case $option in
Download)
if [ -x "$(command -v wget)" ]; then
wget "$MODEL_URL" -P ./models/llama_cpp/
elif [ -x "$(command -v curl)" ]; then
curl -o "$MODEL" "$MODEL_URL"
else
echo "Error: neither wget nor curl is installed. Please install one of them and try again."
exit 1
fi
break
;;
"Download using browser")
if [ -x "$(command -v xdg-open)" ]; then
xdg-open "$MODEL_URL"
elif [ -x "$(command -v gnome-open)" ]; then
gnome-open "$MODEL_URL"
elif [ -x "$(command -v kde-open)" ]; then
kde-open "$MODEL_URL"
elif [ -x "$(command -v open)" ]; then
open "$MODEL_URL"
else
echo "Error: could not detect a default browser. Please open the link in your web browser manually and press any key to continue."
read -n 1 -s -r -p "Press any key to continue"$'\n'
fi
break
;;
Skip)
echo "Skipping downloading $MODEL"
break
;;
esac
done
fi
# Cleanup