Ollama-based Self-Hostable AI Chatbot for Discord
Step 0. Make sure Ollama is set up, running, and working.
Step 1. Set up and Enable the Python Venv. The start.sh and start.bat expect the venv to be in python-venv, so run python -m venv ./python-venv/ to create the venv
Step 2. run pip install discord.py aiohttp python-dotenv tzdata to get needed packages. You will also need to enable the venv. This is shown in start.sh and start.bat for Windows and *nix systems
Step 3. create a .env file containing BOT_TOKEN=[Insert Token here, without brackets]
Step 4 (Optional). Edit config.json to configure your custom AI bot. If Ollama is changed to use another port, this step is not Optional.
Step 5. Run the bot using start.sh or start.bat
-
MODEL_API_URL
This is where you set up the API where Ollama runs -
MODEL_NAME
This is where you set the Main AI Model for the bot to use -
BOT_NAME
This is where you set up the name of your Chatbot. -
ACTIVITY_TEXT
This is where you set the status of it, such as "Baking Bread" or "use qt!help" -
PROMPT_MAIN
This is the main prompt for the bot to follow -
KNOWLEDGE
Extra info for the bot to know -
LIKES
Things the bot likes -
DISLIKES
Things the bot doesnt like -
APPEARANCE
What the bot looks like -
ENGINE_SETUP
Here is where you specify how the bot is to type -
ERROR_RESPONSE
This is the message the bot sends if there's an error contacting the LLM -
STM_CONTEXT_LENGTH
Roughly How many messages the bot takes into context -
PREFIX
The Prefix used for text commands -
MULTIMODAL_MODE
Image handling. Has 3 Modes:none, for no image handling (faster);simulated, for image handling reguardless of Main AI Model (slowest, bot remembers description of image); andnative, the image is fed directly to the main LLM (faster than simulated but slower than none) -
MULTIMODAL_MODEL
Selects the Model for describing the image in simulated mode -
TIMEZONE
Sets the bot's timezone. LeaveNoneto not let the bot know the current time -
SUMMARIZE_CHANCE
Chance the bot generates an LTM automatically. 1.0 will constantly generate LTMs every message, 0.0 will stop natural LTM generation completely. LTM generation is slower -
MAX_REPLY_DEPTH
Max Amount of replies the bot can follow. allows for coherent conversations, even with low STM Context Lengh