Integrate OpenWebUI bot with AI service

This commit is contained in:
Iyeoluwa Akinrinola
2025-05-20 02:18:46 +01:00
parent 730009ae87
commit 0a27103875
46 changed files with 1749 additions and 3012 deletions
+34 -4
View File
@@ -8,7 +8,7 @@ A backend service for OpenWebUI that provides OpenWebUI-compatible API endpoints
- Ollama API proxy
- Chat functionality with model switching
- Support for multiple LLM models (gemma3, llama3.3, llama3.1, mistral, deepseek)
- Team chat integration with OpenWebUI channels
- Team chat functionality
## Technology Stack
@@ -26,11 +26,13 @@ ai_service/
├── embeddings/ # Document processing for RAG
│ └── document_service.py
├── openwebui_api.py # OpenWebUI-compatible API endpoints
├── openwebui_channels.py # OpenWebUI channels integration
├── config.py # Configuration settings
├── api.py # FastAPI application
└── deploy.sh # Deployment script
openwebui-bot/ # OpenWebUI bot integration
run_ai_service.py # Script to run the service
run_openwebui_bot.py # Script to run the OpenWebUI bot
run_custom_bot.py # Script to run a custom OpenWebUI bot
deploy_ai_service.sh # Local deployment script
remote_deploy.sh # Remote deployment script
```
@@ -91,6 +93,34 @@ To configure OpenWebUI to use this service as its backend:
2. Restart OpenWebUI to apply the changes.
## Team Chat Feature
## OpenWebUI Bot Integration
The service now integrates with OpenWebUI's channels feature to provide team chat functionality. See [TEAM_CHAT_GUIDE.md](TEAM_CHAT_GUIDE.md) for detailed instructions on how to use team chats.
This project includes integration with the [Open WebUI bot](https://github.com/open-webui/bot) to provide AI responses in OpenWebUI channels. See [BOT_README.md](BOT_README.md) for detailed instructions on how to use the bot.
### Bot Integration
The bot is integrated with the AI service and starts automatically when the service starts (if `BOT_ENABLED=true` in the `.env` file). The bot connects to OpenWebUI 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.
### Bot API Endpoints
The AI service provides the following endpoints to manage the bot:
- `GET /bot/status`: Get the status of the bot (enabled and running)
- `POST /bot/start`: Start the bot if it's not already running
- `POST /bot/stop`: Stop the bot if it's running
You can also check the bot status in the configuration endpoint:
- `GET /config`: Get the current configuration, including bot status
### Running the Bot Separately
If you want to run the bot separately from the AI service, you can use the provided scripts:
```bash
# Run the original AI example
./run_openwebui_bot.py
# Or run our custom AI bot implementation
./run_custom_bot.py
```