mirror of
https://git.squeakyrat.moe/faggot-chan/
synced 2026-11-04 18:35:45 +01:00
fixed vibewritten readme a bit because claude is a bit dumb
This commit is contained in:
1 parent
090fb736e5
commit
387331d1af
1 file changed
+35
-49
@@ -8,108 +8,93 @@ pick your distro. all of them use a venv because python doesn't let you `pip ins
|
||||
|
||||
### ubuntu
|
||||
```console
|
||||
$ sudo apt install python3 python3-venv curl zstd
|
||||
$ curl -fsSL https://ollama.com/install.sh | sh
|
||||
sudo apt install python3 python3-venv curl zstd
|
||||
curl -fsSL https://ollama.com/install.sh | sh
|
||||
```
|
||||
### arch
|
||||
```console
|
||||
$ sudo pacman -S python ollama
|
||||
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
|
||||
sudo emerge --ask dev-lang/python sci-ml/ollama-bin
|
||||
#ollama-bin is from guru iirc you know how to do that you use gentoo
|
||||
```
|
||||
|
||||
(skip the ollama part if you're using the gemini api)
|
||||
|
||||
then your python dependencies are
|
||||
```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
|
||||
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, you don't need ollama if so
|
||||
pip install google-genai
|
||||
```
|
||||
|
||||
# once you install your dependencies
|
||||
you need ollama running (not needed for gemini)
|
||||
```console
|
||||
#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>
|
||||
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 / use tmux or screen
|
||||
ollama serve &
|
||||
ollama pull <your model>
|
||||
ollama pull <your embedding model>
|
||||
#those two are in main.py
|
||||
#test it with
|
||||
$ ollama run <your model>
|
||||
ollama run <your model>
|
||||
```
|
||||
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
|
||||
- run the wizard, it writes all the config files for you
|
||||
- run the wizard, it writes all the config files for you using your input
|
||||
```console
|
||||
$ python3 setup_wizard.py
|
||||
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
|
||||
- run main first, then the bot
|
||||
```console
|
||||
$ python3 main.py #or gemini.py
|
||||
$ python3 bot.py
|
||||
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
|
||||
|
||||
# fallback
|
||||
if you're using gemini you can have a local ollama `main.py` take over when gemini says you're out of quota. the wizard asks about it (it's the third line of `./files/config/connection.txt`), it needs to run on another port so run it as
|
||||
```console
|
||||
$ PORT=8766 python3 main.py
|
||||
PORT=8766 python3 main.py
|
||||
```
|
||||
the bot goes back to trying gemini after an hour. if there's no fallback (or it's down) she just says "usage limit reached, see you in a month"
|
||||
|
||||
# admin
|
||||
`admin.py` is the admin panel, it only edits files on the box so nobody on discord can touch it. the bot re-reads everything on every message, no restart needed
|
||||
```console
|
||||
$ python3 admin.py list
|
||||
$ python3 admin.py edit <blocked|prompt|settings|reactions|params> #opens $EDITOR, vim if you don't have one
|
||||
$ python3 admin.py block <user id>
|
||||
$ python3 admin.py unblock <user id>
|
||||
```
|
||||
`reactions.json` is where the stickers / emojis / media she can send live, the bot adds new ones with an empty description and you fill them in. media with no description never gets offered
|
||||
|
||||
# fallback
|
||||
if you're using gemini you can have a local ollama `main.py` take over when gemini says you're out of quota. the wizard asks about it (it's the third line of `./files/config/connection.txt`), it needs to run on another port so run it as
|
||||
```console
|
||||
$ PORT=8766 python3 main.py
|
||||
```
|
||||
the bot goes back to trying gemini after an hour. if there's no fallback (or it's down) she just says "usage limit reached, see you in a month"
|
||||
|
||||
# admin
|
||||
`admin.py` is the admin panel, it only edits files on the box so nobody on discord can touch it. the bot re-reads everything on every message, no restart needed
|
||||
```console
|
||||
$ python3 admin.py list
|
||||
$ python3 admin.py edit <blocked|prompt|settings|reactions|params> #opens $EDITOR, vim if you don't have one
|
||||
$ python3 admin.py block <user id>
|
||||
$ python3 admin.py unblock <user id>
|
||||
python3 admin.py list
|
||||
python3 admin.py edit <blocked|prompt|settings|reactions|params> #opens $EDITOR, vim if you don't have one
|
||||
python3 admin.py block <user id>
|
||||
python3 admin.py unblock <user id>
|
||||
```
|
||||
`reactions.json` is where the stickers / emojis / media she can send live, the bot adds new ones with an empty description and you fill them in. media with no description never gets offered
|
||||
|
||||
you can let the local gemma-4 write the descriptions for you, it needs `pip install pillow` (and ffmpeg for videos), ollama running, and the model has to be able to see images
|
||||
```console
|
||||
$ python3 describe.py #only the empty ones, --all redoes everything, --model <name> to use another model, --gemini to use the gemini api instead
|
||||
python3 describe.py
|
||||
#only the empty ones, --all redoes everything, --model <name> to use another model
|
||||
python3 --gemini uses the gemini api instead so you don't need ollama
|
||||
```
|
||||
|
||||
# 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
|
||||
if your pc can't run the model you can host `main.py` on colab (or a vps with a gpu), run `setup_wizard.py` on both sides and say yes to the colab question
|
||||
```console
|
||||
#on colab
|
||||
$ python3 colab_setup.py
|
||||
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
|
||||
this script assumes collab but it probably works with any ubuntu vps. it's not reccomended to run it on anything that's not google colab
|
||||
|
||||
# IF IT FAILS
|
||||
- check `./files/log/errorlog.txt`
|
||||
@@ -117,3 +102,4 @@ it prints a wss:// address and a token, paste those into the wizard on the bot.p
|
||||
- on colab main.py logs to `main.log` next to colab_setup.py
|
||||
|
||||
# have fun
|
||||
don't ask me why the bot is female she just is
|
||||
Reference in new issue
Block a user