#!/bin/bash

##OLLAMA
##DEPS/REQS
sudo apt install curl git snap python3 pip pipx docker.io
##REPO/PKG MANAGER INSTALL
#snap install ollama
#snap install ollama-webui
##MANUAL INSTALL
curl -fsSL https://ollama.com/install.sh | sh
ollama serve
#sudo systemctl status ollama
ollama run llama3.2
curl -LsSf https://astral.sh/uv/install.sh | sh

##OPEN-WEBUI
##PIP INSTALL
#pip install open-webui --break-system-packages
#open-webui serve
##UVX
curl -LsSf https://astral.sh/uv/install.sh | sh
#DATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve
##DOCKER INSTALL
#docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

##OPEN-TERMINAL
##PIP
#pip install open-terminal
#open-terminal run --host 0.0.0.0 --port 8000 --api-key open-terminal-api-key
##UVX
#uvx open-terminal run --host 0.0.0.0 --port 8000 --api-key open-terminal-api-key
##DOCKER
sudo docker run -d --name open-terminal --restart unless-stopped -p 8000:8000 -v open-terminal:/home -e OPEN_TERMINAL_MULTI_USER=false -e OPEN_TERMINAL_API_KEY=open-terminal-api-key ghcr.io/open-webui/open-terminal
##DOCKER MULTI-USER 
#sudo docker run -d --name open-terminal --restart unless-stopped -p 8000:8000 -v open-terminal:/home -e OPEN_TERMINAL_MULTI_USER=true -e OPEN_TERMINAL_API_KEY=open-terminal-api-key ghcr.io/open-webui/open-terminal
##DOCKER HOST
#sudo docker run -d --name open-terminal --restart unless-stopped -p 8000:8000 --network=host -v open-terminal:/home -e OPEN_TERMINAL_MULTI_USER=true -e OPEN_TERMINAL_API_KEY=open-terminal-api-key ghcr.io/open-webui/open-terminal

##OPEN-INTERPRETER
#pip install open-interpreter 

##INSTALL OL TO BIN
chmod +x ol; sudo cp ol /usr/local/bin/

##RUN
DATA_DIR=~/.open-webui .local/bin/uvx --python 3.11 open-webui@latest serve --port 8088
