# OpenWebUI Bot for Channels Integration This project integrates the [Open WebUI bot](https://github.com/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: 1. Make sure you have Python 3.7+ installed 2. Install the required dependencies: ```bash pip install python-socketio aiohttp python-dotenv ``` 3. Configure the bot by creating a `.env` file in the `openwebui-bot` directory: ``` WEBUI_URL=http://104.225.217.215:8080 TOKEN=GdCU4ieYDqHsLfH2 MODEL_ID=llama3.1 ``` 4. Run the bot: ```bash python run_openwebui_bot.py ``` ## Deploying the Bot on the Server To deploy the bot on your server: 1. Run the deployment script: ```bash ./deploy_bot.sh ``` 2. 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 authentication - `MODEL_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: 1. Create a channel in OpenWebUI 2. Send a message that mentions the bot (e.g., `@ai What is the capital of France?`) 3. The bot will process your message and send a response ## Troubleshooting If the bot is not responding to messages: 1. Check that the bot is running and connected to OpenWebUI 2. Verify that you're using one of the trigger words (e.g., `@ai`) 3. Check the logs for any errors 4. 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.