| # if conf does not exist, create it | |
| if [ ! -f "$HOME/.config/llama/llama-chat-ui.conf" ]; then | |
| mkdir -p "$HOME/.config/llama" | |
| cat <<EOF > "$HOME/.config/llama/llama-chat-ui.conf" | |
| CHAT_UI_LOG=$HOME/.local/var/llama-chat-ui.log | |
| EOF | |
| fi | |
| source "$HOME/.config/llama/llama-chat-ui.conf" | |
| # if arg1 is "stop" then pkill the chat-ui.py server | |
| if [[ $# -eq 1 ]] && [[ $1 == "stop" ]]; then | |
| echo "Stopping chat-ui server..." | |
| pkill -f "chat-ui/node_modules/.bin/vite" | |
| echo "ok" | |
| exit | |
| fi | |
| # start server and pipe stdout+stderr to log file | |
| cd ~/Work/chat-ui || exit | |
| npm run dev > "$CHAT_UI_LOG" 2>&1 & | |
| echo "Started chat-ui server" | |