diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 83 |
1 files changed, 66 insertions, 17 deletions
@@ -1,31 +1,80 @@ # how to run ts bullshit -first you need ollama installed +two parts: `bot.py` talks to discord, `main.py` (ollama) or `gemini.py` (gemini api) is the brain. +`main.py` is stateless so it can live on another machine / colab and talk to `bot.py` through a websocket or tunnel, you never have to upload your files anywhere sketchy + +# installing +pick your distro. all of them use a venv because python doesn't let you `pip install` system wide anymore + +### ubuntu +```console +$ sudo apt install python3 python3-venv curl zstd +$ curl -fsSL https://ollama.com/install.sh | sh +``` +### arch ```console -$ pacman -S ollama -#or whatever packet manager you have -#alternatively, -$curl -fsSL https://ollama.com/install.sh | sh +$ sudo pacman -S python ollama +#ollama-cuda or ollama-rocm if you have a gpu ``` +### gentoo +```console +$ sudo emerge --ask dev-lang/python sci-ml/ollama +#sci-ml/ollama is ~amd64, so you need to keyword it first +$ echo "sci-ml/ollama ~amd64" | sudo tee /etc/portage/package.accept_keywords/ollama +#sci-ml/ollama-bin if you don't wanna compile it +``` +(skip the ollama part if you're using the gemini api) + then your python dependencies are -``` console -$ pip install ollama websockets discord +```console +$ python3 -m venv venv +$ source venv/bin/activate +$ pip install ollama websockets discord.py +#and this one only if you're using the gemini api +$ pip install google-genai ``` -# once you install your dependencies -you run this +# once you install your dependencies +you need ollama running (not needed for gemini) ```console -#i think ollama still needs to serve i'm not too sure -$ ollama serve & #or make it a service with systemd or whatever +#ollama needs to be serving, the packages above already ship a service +$ sudo systemctl enable --now ollama #ubuntu / arch / gentoo systemd +$ sudo rc-update add ollama default && sudo rc-service ollama start #gentoo openrc +#or just run it by hand +$ ollama serve & $ ollama pull <your model> $ ollama pull <your embedding model> #those two are in main.py -#test it with -$ ollama run <your model> +#test it with +$ ollama run <your model> ``` -if that runs fine then you can -- add your discord bot token and discord server id to your .env which is not .env but ./files/config/tokens +if that runs fine (or you have a gemini key) then you can +- go to the discord developer portal and turn on **message content intent** and **server members intent** for your bot or it won't start - add the bot to your server -- you'll probably want to change the system prompt which is found in bot.py +- run the wizard, it writes all the config files for you +```console +$ python3 setup_wizard.py +``` +- edit your system prompt in `./files/config/system_prompt.txt` (it makes a placeholder the first time bot.py runs) +- optional: `./config/params.json` has the ollama options (temperature and stuff), without it ollama just uses its defaults +- run the brain first, then the bot +```console +$ python3 main.py #or gemini.py +$ python3 bot.py +``` +she only reads `general` and `announcements`, and every dm gets its own memory in `./files/log/dm/` so it never leaks into the server + +# colab +if your pc can't run the model you can host `main.py` on colab, run `setup_wizard.py` on both sides and say yes to the colab question +```console +#on colab +$ python3 colab_setup.py +``` +it prints a wss:// address and a token, paste those into the wizard on the bot.py side. the address changes every time you restart the notebook + +# IF IT FAILS +- check `./files/log/errorlog.txt` +- `bad auth token` means the token in `./files/config/connection.txt` isn't the one main.py has in `./config/auth_token.txt` +- on colab main.py logs to `main.log` next to colab_setup.py -# have fun
\ No newline at end of file +# have fun |
