105 lines
2.8 KiB
Markdown
105 lines
2.8 KiB
Markdown
# Setting Up OpenWebUI with Custom Backend
|
|
|
|
This guide explains how to configure OpenWebUI to use your custom AI service as its backend.
|
|
|
|
## Overview
|
|
|
|
OpenWebUI is designed to work with Ollama directly, but it can be configured to use a custom backend service instead. This allows you to add your own business logic, authentication, and other features while still using OpenWebUI's user-friendly interface.
|
|
|
|
## Prerequisites
|
|
|
|
1. OpenWebUI installed and running (at http://104.225.217.215:8080)
|
|
2. Your AI service deployed and running (at http://your-server-ip:5251)
|
|
|
|
## Configuration Steps
|
|
|
|
### 1. Locate OpenWebUI's Environment Configuration
|
|
|
|
If you're running OpenWebUI using Docker, you can modify the environment variables in your docker-compose.yml file or when running the container:
|
|
|
|
```yaml
|
|
version: '3'
|
|
services:
|
|
openwebui:
|
|
image: openwebui/openwebui:latest
|
|
environment:
|
|
- OLLAMA_API_BASE_URL=http://your-server-ip:5251/ollama
|
|
- OPENAI_API_BASE_URL=http://your-server-ip:5251/api
|
|
ports:
|
|
- "8080:8080"
|
|
```
|
|
|
|
If you're running OpenWebUI directly, you can modify the .env file in the OpenWebUI installation directory.
|
|
|
|
### 2. Set the API Base URLs
|
|
|
|
Add or modify the following environment variables:
|
|
|
|
```
|
|
OLLAMA_API_BASE_URL=http://your-server-ip:5251/ollama
|
|
OPENAI_API_BASE_URL=http://your-server-ip:5251/api
|
|
```
|
|
|
|
Replace `your-server-ip` with the IP address or hostname of the server where your AI service is running.
|
|
|
|
### 3. Restart OpenWebUI
|
|
|
|
After updating the environment variables, restart the OpenWebUI service to apply the changes.
|
|
|
|
If you're using Docker:
|
|
|
|
```bash
|
|
docker restart openwebui
|
|
```
|
|
|
|
If you're running OpenWebUI directly:
|
|
|
|
```bash
|
|
# Stop the current process
|
|
pkill -f "openwebui"
|
|
|
|
# Start OpenWebUI again
|
|
cd /path/to/openwebui
|
|
npm start
|
|
```
|
|
|
|
## Testing the Integration
|
|
|
|
To test if the integration is working correctly:
|
|
|
|
1. Open OpenWebUI in your browser (http://104.225.217.215:8080)
|
|
2. Try to create a new chat
|
|
3. Select one of the models (gemma3, llama3.3, llama3.1, mistral, or deepseek)
|
|
4. Send a message and check if you get a response
|
|
|
|
If everything is configured correctly, OpenWebUI will send requests to your AI service, which will then forward them to the Ollama API.
|
|
|
|
## Troubleshooting
|
|
|
|
If you encounter issues with the integration:
|
|
|
|
1. Check the logs of your AI service:
|
|
```bash
|
|
tail -f logs/ai_service.log
|
|
```
|
|
|
|
2. Check the logs of OpenWebUI:
|
|
```bash
|
|
docker logs openwebui
|
|
```
|
|
|
|
3. Verify that your AI service is running and accessible:
|
|
```bash
|
|
curl http://your-server-ip:5251/health
|
|
```
|
|
|
|
4. Verify that the OpenWebUI environment variables are set correctly:
|
|
```bash
|
|
docker exec openwebui env | grep URL
|
|
```
|
|
|
|
## Advanced Configuration
|
|
|
|
For advanced configuration options, refer to the OpenWebUI documentation:
|
|
https://docs.openwebui.com/getting-started/env-configuration
|