2.3 KiB
OpenWebUI Bot for Channels Integration
This project integrates the Open WebUI bot to provide AI responses in OpenWebUI channels.
Overview
The OpenWebUI bot connects to your OpenWebUI instance via WebSocket and listens for messages in channels. When a message mentions the AI (using trigger words like @ai), the bot processes the message and sends a response back to the channel.
Running the Bot Locally
To run the bot locally:
- Make sure you have Python 3.7+ installed
- Install the required dependencies:
pip install python-socketio aiohttp python-dotenv - Configure the bot by creating a
.envfile in theopenwebui-botdirectory:WEBUI_URL=http://104.225.217.215:8080 TOKEN=GdCU4ieYDqHsLfH2 MODEL_ID=llama3.1 - Run the bot:
python run_openwebui_bot.py
Deploying the Bot on the Server
To deploy the bot on your server:
- Run the deployment script:
./deploy_bot.sh - Follow the instructions provided by the script to copy the deployment package to your server and run the deployment.
Bot Configuration
The bot is configured using environment variables in the .env file:
WEBUI_URL: URL of your OpenWebUI instance (e.g.,http://104.225.217.215:8080)TOKEN: API key for authenticationMODEL_ID: ID of the model to use (e.g.,llama3.1)
Additional configuration options can be added to the .env file:
SYSTEM_PROMPT="You are a helpful AI assistant."
TEMPERATURE=0.7
MAX_TOKENS=2048
TOP_P=0.9
TRIGGERS=@ai,@bot,@assistant,@chatbot
RESPOND_TO_ALL=false
Using the Bot
Once the bot is running, you can use it in OpenWebUI channels:
- Create a channel in OpenWebUI
- Send a message that mentions the bot (e.g.,
@ai What is the capital of France?) - The bot will process your message and send a response
Troubleshooting
If the bot is not responding to messages:
- Check that the bot is running and connected to OpenWebUI
- Verify that you're using one of the trigger words (e.g.,
@ai) - Check the logs for any errors
- Make sure your OpenWebUI URL and API key are correct
Logs
The bot logs to both the console and a file named bot_debug.log. You can check this file for detailed information about what the bot is doing and any errors it encounters.