upgraded visual installer

This commit is contained in:
Saifeddine ALOUI 2024-10-08 00:33:55 +02:00
parent 3619a1b8fe
commit caef178820
4 changed files with 124 additions and 59 deletions

View File

@ -13,6 +13,25 @@ cd /D "%~dp0"
echo %CD%
REM Check if Git is installed
where git >nul 2>nul
if %errorlevel% neq 0 (
echo Git is not installed. Downloading and installing Git...
REM Download Git for Windows
powershell -Command "Invoke-WebRequest -Uri 'https://github.com/git-for-windows/git/releases/download/v2.37.1.windows.1/Git-2.37.1-64-bit.exe' -OutFile 'GitInstaller.exe'"
REM Install Git silently
start /wait GitInstaller.exe /VERYSILENT /NORESTART
REM Clean up the installer
del GitInstaller.exe
echo Git has been installed.
) else (
echo Git is already installed.
)
set LOLLMSENV_DIR=%CD%\lollmsenv
set REPO_URL=https://github.com/ParisNeo/lollms-webui.git
@ -80,7 +99,6 @@ if %errorlevel% equ 0 (
echo No NVIDIA GPU detected or nvidia-smi is not available.
)
REM Ask user about CUDA installation
set /p INSTALL_CUDA="Do you want to install CUDA? (Only for NVIDIA GPUs if your version is lower than 12.1 or if it wasn't already installed, recommended for local AI) [Y/N]: "
if /i "%INSTALL_CUDA%"=="Y" (
@ -98,19 +116,15 @@ if /i "%INSTALL_VSCODE%"=="Y" (
cd %ORIGINAL_PATH%
echo %CD%
REM Install Python and create environment
:: echo --- installing python
:: call "%LOLLMSENV_DIR%\bin\lollmsenv.bat" install-python 3.11.9
echo --- creating environment
call "%LOLLMSENV_DIR%\bin\lollmsenv.bat" create-env lollms_env
echo --- activating environment
REM Activate environment
call "%LOLLMSENV_DIR%\envs\lollms_env\Scripts\activate.bat"
REM venv activate lollms_env
echo %ORIGINAL_PATH%
cd "%ORIGINAL_PATH%"
echo --- cloning lollmw_webui
echo --- cloning lollmw_webui
REM Clone or update repository
if exist lollms-webui\ (
@ -132,7 +146,6 @@ call "%LOLLMSENV_DIR%\envs\lollms_env\Scripts\python.exe" -m pip install -r requ
call "%LOLLMSENV_DIR%\envs\lollms_env\Scripts\python.exe" -m pip install -e lollms_core
cd ..
REM Create launcher scripts
echo @echo off > lollms.bat
echo call "%LOLLMSENV_DIR%\envs\lollms_env\Scripts\activate.bat" >> lollms.bat
@ -145,7 +158,9 @@ echo call "%LOLLMSENV_DIR%\envs\lollms_env\Scripts\activate.bat" >> lollms_cmd.b
echo cd lollms-webui >> lollms_cmd.bat
echo cmd /k >> lollms_cmd.bat
cd lollms_webui
cd lollms-webui
echo --- current folder !cd!
REM Binding selection menu
echo Select the default binding to be installed:
echo 1) None (install the binding later)

View File

@ -1,9 +1,5 @@
; InnoSetup Script for LOLLMS Installer
; Created by ParisNeo
; Licensed under Apache 2.0
#define MyAppName "LOLLMS"
#define MyAppVersion "V13 Feather"
#define MyAppVersion "13.0"
#define MyAppPublisher "ParisNeo"
#define MyAppURL "https://github.com/ParisNeo/lollms-webui"
@ -15,41 +11,39 @@ AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={userdocs}\LOLLMS
DefaultDirName={userpf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=LICENSE.txt
OutputDir=.
OutputBaseFilename=LOLLMS_Installer
OutputBaseFilename=lollms_setup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
PrivilegesRequired=lowest
DisableProgramGroupPage=auto
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "https://github.com/ParisNeo/LollmsEnv/releases/download/V1.3.2/lollmsenv_installer.bat"; DestDir: "{tmp}"; Flags: external
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Dirs]
Name: "{app}\lollms-webui"
[Files]
Source: "lollmsenv_installer.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\lollms.bat"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\lollms.bat"; Tasks: desktopicon
[Run]
; Download and run LollmsEnv installer
Filename: "{tmp}\lollmsenv_installer.bat"; Parameters: "--dir ""{app}\lollmsenv"" -y"; StatusMsg: "Installing LollmsEnv..."; Flags: runhidden
; Clone lollms-webui repository
Filename: "git"; Parameters: "clone --depth 1 --recurse-submodules https://github.com/ParisNeo/lollms-webui.git ""{app}\lollms-webui"""; StatusMsg: "Cloning lollms-webui repository..."; Flags: runhidden
; Create and activate virtual environment
Filename: "{app}\lollmsenv\bin\lollmsenv.bat"; Parameters: "create-env lollms_env"; WorkingDir: "{app}"; StatusMsg: "Creating virtual environment..."; Flags: runhidden
Filename: "{app}\lollmsenv\envs\lollms_env\Scripts\activate.bat"; WorkingDir: "{app}"; StatusMsg: "Activating virtual environment..."; Flags: runhidden
; Install requirements
Filename: "{app}\lollmsenv\envs\lollms_env\Scripts\python.exe"; Parameters: "-m pip install -r requirements.txt"; WorkingDir: "{app}\lollms-webui"; StatusMsg: "Installing requirements..."; Flags: runhidden
Filename: "{app}\lollmsenv\envs\lollms_env\Scripts\python.exe"; Parameters: "-m pip install -e lollms_core"; WorkingDir: "{app}\lollms-webui"; StatusMsg: "Installing lollms_core..."; Flags: runhidden
Filename: "{app}\lollmsenv_installer.bat"; Parameters: "--dir ""{app}\lollmsenv"" -y"; StatusMsg: "Installing LollmsEnv..."; Flags: runhidden
Filename: "{app}\lollmsenv\bin\lollmsenv.bat"; Parameters: "create-env lollms_env"; StatusMsg: "Creating Python environment..."; Flags: runhidden
Filename: "{app}\lollmsenv\envs\lollms_env\Scripts\activate.bat"; StatusMsg: "Activating Python environment..."; Flags: runhidden
Filename: "git"; Parameters: "clone --depth 1 --recurse-submodules https://github.com/ParisNeo/lollms-webui.git ""{app}\lollms-webui"""; StatusMsg: "Cloning LOLLMS repository..."; Flags: runhidden
Filename: "{app}\lollmsenv\envs\lollms_env\Scripts\python.exe"; Parameters: "-m pip install -r ""{app}\lollms-webui\requirements.txt"""; StatusMsg: "Installing Python requirements..."; Flags: runhidden
Filename: "{app}\lollmsenv\envs\lollms_env\Scripts\python.exe"; Parameters: "-m pip install -e ""{app}\lollms-webui\lollms_core"""; StatusMsg: "Installing LOLLMS core..."; Flags: runhidden
[Code]
var
@ -58,8 +52,8 @@ var
procedure InitializeWizard;
begin
BindingPage := CreateInputOptionPage(wpSelectDir,
'Select Default Binding', 'Choose the default binding to be installed',
'Please select one of the following options:',
'Select Binding', 'Choose the default binding to install',
'Please select one of the following bindings:',
True, False);
BindingPage.Add('None (install the binding later)');
BindingPage.Add('Local binding - ollama');
@ -74,15 +68,15 @@ begin
BindingPage.Add('Remote binding - xAI');
BindingPage.Add('Remote binding - elf');
BindingPage.Add('Remote binding - remote lollms');
BindingPage.SelectedValueIndex := 0;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
BindingScript: string;
begin
Result := True;
if CurPageID = BindingPage.ID then
if CurStep = ssPostInstall then
begin
case BindingPage.SelectedValueIndex of
1: BindingScript := 'ollama';
@ -103,26 +97,22 @@ begin
if BindingScript <> '' then
begin
if not Exec(ExpandConstant('{app}\lollmsenv\envs\lollms_env\Scripts\python.exe'),
ExpandConstant('zoos/bindings_zoo/' + BindingScript + '/__init__.py'),
ExpandConstant('{app}\lollms-webui'),
SW_HIDE,
ewWaitUntilTerminated,
ResultCode) then
begin
MsgBox('Error installing binding: ' + SysErrorMessage(ResultCode), mbError, MB_OK);
end;
Exec(ExpandConstant('{app}\lollmsenv\envs\lollms_env\Scripts\python.exe'),
ExpandConstant('"{app}\lollms-webui\zoos\bindings_zoo\' + BindingScript + '\__init__.py"'),
'', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
SaveStringToFile(ExpandConstant('{app}\lollms.bat'),
'@echo off' + #13#10 +
'call "' + ExpandConstant('{app}') + '\lollmsenv\envs\lollms_env\Scripts\activate.bat"' + #13#10 +
'cd "' + ExpandConstant('{app}') + '\lollms-webui"' + #13#10 +
'python app.py %*' + #13#10 +
'pause', False);
SaveStringToFile(ExpandConstant('{app}\lollms_cmd.bat'),
'@echo off' + #13#10 +
'call "' + ExpandConstant('{app}') + '\lollmsenv\envs\lollms_env\Scripts\activate.bat"' + #13#10 +
'cd "' + ExpandConstant('{app}') + '\lollms-webui"' + #13#10 +
'cmd /k', False);
end;
end;
[Icons]
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\lollms.bat"; Tasks: desktopicon
Name: "{group}\{#MyAppName}"; Filename: "{app}\lollms.bat"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Tasks]
Name: desktopicon; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[UninstallDelete]
Type: filesandordirs; Name: "{app}"

Binary file not shown.

View File

@ -0,0 +1,60 @@
@echo off
setlocal enabledelayedexpansion
:: Version number
set VERSION=1.3.2
set USE_MASTER=false
:: Check for --use-master option
for %%a in (%*) do (
if "%%a"=="--use-master" set USE_MASTER=true
)
:: Temporary directory for downloading and extraction
set TEMP_DIR=.\lollmsenv_install
:: Create temporary directory
if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%"
if "%USE_MASTER%"=="true" (
echo Cloning LollmsEnv master branch...
git clone https://github.com/ParisNeo/LollmsEnv.git "%TEMP_DIR%"
cd /d "%TEMP_DIR%"
) else (
:: URL of the latest release
set RELEASE_URL=https://github.com/ParisNeo/LollmsEnv/archive/refs/tags/V%VERSION%.zip
:: Download the latest release
echo Downloading LollmsEnv version %VERSION%...
echo !RELEASE_URL!
echo '%TEMP_DIR%'
pause
powershell -Command "Invoke-WebRequest -Uri '!RELEASE_URL!' -OutFile '%TEMP_DIR%\lollmsenv.zip'"
if %errorlevel% neq 0 (
echo Error downloading LollmsEnv: %errorlevel%
exit /b 1
)
:: Extract the archive
echo Extracting files...
powershell -Command "Expand-Archive -Path '%TEMP_DIR%\lollmsenv.zip' -DestinationPath '%TEMP_DIR%' -Force"
:: Change to the extracted directory
cd /d "%TEMP_DIR%\LollmsEnv-%VERSION%"
)
:: Remove --use-master from arguments
set ARGS=%*
set ARGS=%ARGS:--use-master=%
:: Run the install script with forwarded parameters
echo Running installation...
call install.bat %ARGS%
:: Clean up
echo Cleaning up...
cd /d ..
rmdir /s /q "%TEMP_DIR%"
echo Installation of LollmsEnv complete.
endlocal