Skip to content

Commit

Permalink
update ollama-assist with custom models & shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
untypequicode committed Mar 17, 2024
1 parent 77834e1 commit 71e92f5
Show file tree
Hide file tree
Showing 6 changed files with 528 additions and 45 deletions.
82 changes: 76 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,79 @@ ollama-assist
## Commands

```
-h, --help: Show help
-v, --version: Show version
list: List all available assistants
init: Initialize an assistant
run: Run an assistant
```
-h, --help Show this help message and exit
-v, --version Show version information and exit
-l, --list List available models
-i, --init Config default model
-r, --run Run the argument model
-c, --custom Manage custom models:
-h, --help Show this help message and exit
-l, --list List available custom models
-a, --add Add a new custom model
-rm, --remove Remove a custom model
-e, --edit Edit a custom model
-rn, --rename Rename a custom model
-r, --run Run a custom model with options:
-c, --clipboard Copy the response to clipboard
-t, --terminal Display the response in the terminal
-sa, --shortcutadd Add a shortcut for a custom model
-sr, --shortcutremove Remove a shortcut for a custom model
```

### Custom Models

Ollama Assist supports custom models. You can manage custom models using the `-c` or `--custom` command.

```
ollama-assist -c --list
```

To add a new custom model, run the following command:

```
ollama-assist -c --add
```

To remove a custom model, run the following command:

```
ollama-assist -c --remove
```

To edit a custom model, run the following command:

```
ollama-assist -c --edit
```

To rename a custom model, run the following command:

```
ollama-assist -c --rename
```

To run a custom model, run the following command:

```
ollama-assist -c --run
```

You can use the `-c` or `--clipboard` option to copy the response to the clipboard, and the `-t` or `--terminal` option to display the response in the terminal.

### Shortcut

Ollama Assist also provides a desktop shortcut for easy access. During the installation process, you will be prompted to install the shortcut. Simply enter `y` to install the shortcut or `n` to skip it.

### Uninstall

To uninstall Ollama Assist, run the following command:

```
./uninstall.sh
```

---

Copyright ©2024 [untypequicode](https://github.com/untypequicode)

Licensed under the MIT License. See [LICENSE](LICENSE) for more information.
80 changes: 64 additions & 16 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,83 @@
#!/bin/bash

function help() {
echo "Usage: ollama-assist install manager [options]"
exit 0
}

function install() {
echo "Installing Ollama Assist..."
if [ "$1" ]; then
case $1 in
ollama) bash -c "curl -fsSL https://ollama.com/install.sh | sh" ;;
-o|--ollama) bash -c "curl -fsSL https://ollama.com/install.sh | sh" ;;
*) echo "fatal: unknown option '$1'"
exit 1 ;;
esac
fi

# Vérifier si les dépendances sont installées
if ! command -v jq >/dev/null 2>&1; then
echo "Installing jq..."
sudo apt-get install jq -y
fi

# Copier le script d'assistant Ollama dans le répertoire /opt/ollama-assist/bin/
sudo mkdir -p /opt/ollama-assist/bin
sudo cp src/ollama-assist /opt/ollama-assist/bin
# sudo chmod +x /opt/olla-assist/bin/ollama-assist
bash -c "echo 'export PATH=\$PATH:/opt/ollama-assist/bin' >> ~/.bashrc"
sudo chmod +x /opt/ollama-assist/bin/ollama-assist

# Vérifier si le répertoire /opt/ollama-assist/bin/ est déjà dans le PATH
if ! grep -q "/opt/ollama-assist/bin" ~/.bashrc; then
# Ajouter le répertoire /opt/ollama-assist/bin/ au PATH
bash -c "echo 'export PATH=\$PATH:/opt/ollama-assist/bin' >> ~/.bashrc"
else
echo "Skipping PATH"
fi

# Vérifier si le répertoire ~/.ollama-assist/ existe déjà et demander à l'utilisateur s'il souhaite le supprimer
if [ -d ~/.ollama-assist/ ]; then
bash -c 'rm -r ~/.ollama-assist/'
read -p "The directory ~/.ollama-assist/ already exists. Do you want to remove it? (y/n): " choice
if [ "$choice" == "y" ]; then
bash -c 'rm -r ~/.ollama-assist/'
else
echo "Skipping ~/.ollama-assist/"
fi
fi
bash -c "mkdir ~/.ollama-assist/"
bash -c 'touch ~/.ollama-assist/models_history'
echo "Ollama Assist has been installed successfully"
exit 0

# Créer le répertoire ~/.ollama-assist/ s'il n'existe pas
if [ ! -d ~/.ollama-assist/ ]; then
bash -c 'mkdir ~/.ollama-assist/'
fi

# Créer les fichiers ~/.ollama-assist/models_history et ~/.ollama-assist/models_custom s'ils n'existent pas
if [ ! -f ~/.ollama-assist/models_history ]; then
bash -c 'touch ~/.ollama-assist/models_history'
fi
if [ ! -f ~/.ollama-assist/models_custom ]; then
bash -c 'touch ~/.ollama-assist/models_custom'
fi

echo "Ollama Assist has been installed successfully"

# Demander à l'utilisateur s'il souhaite installer le raccourci
read -p "Do you authorize the installation of the Ollama Assist shortcut? (y/n): " choice
if [ "$choice" == "y" ]; then
bash -c 'echo "Installing Ollama Assist shortcut..."'
# Supprimer les anciens fichiers de raccourci si nécessaire
if [ -f ~/.local/share/icons/ollama-assist.svg ]; then
bash -c 'sudo rm /usr/share/icons/ollamaassist.svg'
fi
if [ -f ~/Desktop/ollama-assist.desktop ]; then
bash -c 'sudo rm ~/.local/share/applications/ollama-assist.desktop'
fi
# Copier le logo et le fichier de raccourci
bash -c 'echo "Copying the Ollama Assist logo..."'
sudo cp src/ollamaassist.svg /usr/share/icons/
bash -c 'echo "Copying the Ollama Assist desktop file..."'
cp src/ollama-assist.desktop ~/.local/share/applications/
echo "Ollama Assist shortcut has been installed successfully."
else
echo "Skipping Ollama Assist shortcut installation."
fi

exit 0
}

if [ "$1" ]; then
case $1 in
help|-h|--help) help ;;
ollama) install ollama ;;
*) echo "fatal: unknown option '$1'"
exit 1 ;;
Expand Down
Loading

0 comments on commit 71e92f5

Please sign in to comment.