aandrew-me / tgpt

AI Chatbots in terminal without needing API keys
GNU General Public License v3.0
1.99k stars 168 forks source link

Why can't we have pip installation <EOM> #214

Closed opensource-elearning closed 8 months ago

aandrew-me commented 8 months ago

Pip is for python projects

opensource-elearning commented 8 months ago

Can we use batch script for windows which may looks like below

:: TGPT Installation/Update Script for Windows with Terminal Display

:: Define variables
set TGPT_VERSION=2.6.1
set TGPT_URL=https://github.com/aandrew-me/tgpt
set TGPT_DOWNLOAD_URL=%TGPT_URL%\releases/download/v%TGPT_VERSION%
set TGPT_BIN=tgpt-%TGPT_VERSION%-win64.exe
set TGPT_INSTALL_DIR=C:\Program Files\tgpt

:: Check if TGPT is already installed
echo Checking if TGPT is already installed...
if exist "%TGPT_INSTALL_DIR%\bin\tgpt.exe" (
    echo TGPT is already installed.
    echo Checking for updates...

    :: Check for updates
    set TGPT_LATEST_VERSION=%TGPT_URL%/releases/latest
    curl -s %TGPT_LATEST_VERSION% | grep -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+' > latest_version.txt
    set /p LATEST_VERSION=<latest_version.txt
    del latest_version.txt

    if %LATEST_VERSION% GTR %TGPT_VERSION% (
        echo A new version of TGPT is available (%LATEST_VERSION%).
        echo Updating TGPT...

        :: Download TGPT executable
        echo Downloading TGPT executable...
        cd /d %TGPT_INSTALL_DIR%\bin
        curl -O %TGPT_DOWNLOAD_URL%/%TGPT_BIN%

        :: Move TGPT executable to the bin directory
        echo Moving TGPT executable to the bin directory...
        move %TGPT_BIN% %TGPT_INSTALL_DIR%\bin

        echo TGPT has been updated successfully to version %LATEST_VERSION%.
    ) else (
        echo TGPT is up to date.
    )
) else (
    echo TGPT is not installed.
    echo Installing TGPT...

    :: Create TGPT installation directory
    echo Creating TGPT installation directory...
    mkdir %TGPT_INSTALL_DIR%

    :: Download TGPT executable
    echo Downloading TGPT executable...
    cd /d %TGPT_INSTALL_DIR%
    curl -O %TGPT_DOWNLOAD_URL%/%TGPT_BIN%

    :: Move TGPT executable to the bin directory
    echo Moving TGPT executable to the bin directory...
    move %TGPT_BIN% %TGPT_INSTALL_DIR%\bin

    :: Add TGPT to the PATH environment variable
    echo Adding TGPT to the PATH environment variable...
    setx PATH "%TGPT_INSTALL_DIR%\bin;%PATH%"

    echo TGPT %TGPT_VERSION% has been installed successfully!
)

:: Display usage instructions
echo Usage:
echo tgpt [Flags] [Prompt]

echo Flags:
echo -s, --shell                                        Generate and Execute shell commands. (Experimental)
echo -c, --code                                         Generate Code. (Experimental)
echo -q, --quiet                                        Gives response back without loading animation
echo -w, --whole                                        Gives response back as a whole text
echo -img, --image                                      Generate images from text
echo --provider                                         Set Provider. Detailed information has been provided below

echo Some additional options can be set. However not all options are supported by all providers. Not supported options will just be ignored.
echo --model                                            Set Model
echo --key                                              Set API Key
echo --temperature                                      Set temperature
echo --top_p                                            Set top_p
echo --max_length                                       Set max response length

echo Options:
echo -v, --version                                      Print version
echo -h, --help                                         Print help message
echo -i, --interactive                                  Start normal interactive mode
echo -m, --multiline                                    Start multi-line interactive mode
echo -cl, --changelog                                   See changelog of versions
echo -u, --update                                       Update program

echo Providers:
echo The default provider is opengpts which uses 'GPT-3.5-turbo' model.
echo Available providers to use: openai, opengpts, koboldai, phind, llama2

echo Provider: openai
echo Needs API key to work and supports various models

echo Provider: opengpts
echo Uses gpt-3.5-turbo only. Do not use with sensitive data

echo Provider: koboldai
echo Uses koboldcpp/HF_SPACE_Tiefighter-13B only, answers from novels

echo Provider: phind
echo Uses Phind Model. Great for developers

echo Provider: llama2
echo Llama 2 is an open source large language model (LLM) developed by Meta AI. Uses llama2-70b by default. Supports other models.

echo Examples:
echo tgpt "What is internet?"
echo tgpt -m
echo tgpt -s "How to update my system?"
echo tgpt --provider opengpts "What is 1+1"
echo tgpt --provider openai --key "sk-xxxx" --model "gpt-3.5-turbo" "What is 1+1"
echo cat install.sh | tgpt "Explain the code"

:: Pause the script
echo Press any key to exit...
pause

To install TGPT from the install.bat file in the GitHub repo, you can use the following steps:

curl -O https://raw.githubusercontent.com/aandrew-me/tgpt/main/install.bat && .\install.bat

This command will download the install.bat file from the GitHub repo and then immediately run it.

You can also use the following command to download and install TGPT in a specific directory:

curl -O https://raw.githubusercontent.com/aandrew-me/tgpt/main/install.bat && move install.bat "C:\Program Files\tgpt" && cd "C:\Program Files\tgpt" && .\install.bat

This command will download the install.bat file to your current directory, move it to the C:\Program Files\tgpt directory, and then run the installation wizard.

Once the installation is complete, you can start using TGPT by opening a command prompt and typing tgpt.

Note: The install.bat file is only available in the development branch of the TGPT repository. If you want to use the latest stable release, you can use the curl or wget commands that I provided in my previous response.

can we have something like above to avoid intermediator scoop related stuff and directly install TGPT.?

all of above is content is generated using the online LLM platform which requires validation.

aandrew-me commented 8 months ago

The LLM certainly didn't give any useful result.

The binaries for all platforms are in Releases, you can download from there and execute

There was an installation script added with the following instructions:

Invoke-WebRequest https://raw.githubusercontent.com/aandrew-me/tgpt/main/install-win.ps1 -OutFile "$PWD\install-win.ps1";  .\install-win.ps1

If you receive an error stating "execution of scripts is disabled on this system," run this command instead (and confirm with a "

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned; Invoke-WebRequest https://raw.githubusercontent.com/aandrew-me/tgpt/main/install-win.ps1 -OutFile "$PWD\install-win.ps1";  .\install-win.ps1

However I commented it out because someone was facing problems and I personally don't use Windows so I couldn't test properly.