mirror of
https://github.com/open-webui/docs
synced 2025-06-16 11:28:36 +00:00
Update web_search.md
This commit is contained in:
parent
f6d0e57191
commit
8080720374
@ -4,20 +4,20 @@ title: "🌐 Web Search"
|
|||||||
---
|
---
|
||||||
|
|
||||||
:::warning
|
:::warning
|
||||||
This tutorial is a community contribution and is not supported by the OpenWebUI team. It serves only as a demonstration on how to customize OpenWebUI for your specific use case. Want to contribute? Check out the contributing tutorial.
|
This tutorial is a community contribution and is not supported by the Open WebUI team. It serves only as a demonstration on how to customize Open WebUI for your specific use case. Want to contribute? Check out the contributing tutorial.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## 🌐 Web Search
|
## 🌐 Web Search
|
||||||
|
|
||||||
This guide provides instructions on how to set up web search capabilities in Open WebUI using various search engines.
|
This guide provides instructions on how to set up web search capabilities in Open WebUI using various search engines.
|
||||||
|
|
||||||
### SearXNG (Docker)
|
## SearXNG (Docker)
|
||||||
|
|
||||||
> "**SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.**"
|
> "**SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.**"
|
||||||
|
|
||||||
### 1. SearXNG Configuration
|
## 1. SearXNG Configuration
|
||||||
|
|
||||||
If you want to modify the default configuration, follow these steps:
|
To configure SearXNG optimally for use with Open WebUI, follow these steps:
|
||||||
|
|
||||||
#### Create a New Directory `searxng-docker`
|
#### Create a New Directory `searxng-docker`
|
||||||
|
|
||||||
@ -47,26 +47,38 @@ Add the following to the `.env` file:
|
|||||||
# By default listen on https://localhost
|
# By default listen on https://localhost
|
||||||
# To change this:
|
# To change this:
|
||||||
# * uncomment SEARXNG_HOSTNAME, and replace <host> by the SearXNG hostname
|
# * uncomment SEARXNG_HOSTNAME, and replace <host> by the SearXNG hostname
|
||||||
# * uncomment LETSENCRYPT_EMAIL, and replace <email> by your email (required to create a Let's Encrypt certificate)
|
# * uncomment LETSENCRYPT_EMAIL, and replace <email> by your email (require to create a Let's Encrypt certificate)
|
||||||
|
|
||||||
|
SEARXNG_HOSTNAME=localhost:1337/
|
||||||
SEARXNG_HOSTNAME=example.locale
|
|
||||||
# LETSENCRYPT_EMAIL=<email>
|
# LETSENCRYPT_EMAIL=<email>
|
||||||
|
|
||||||
|
# Optional:
|
||||||
|
# If you run a very small or a very large instance, you might want to change the amount of used uwsgi workers and threads per worker
|
||||||
|
# More workers (= processes) means that more search requests can be handled at the same time, but it also causes more resource usage
|
||||||
|
|
||||||
|
# SEARXNG_UWSGI_WORKERS=4
|
||||||
|
# SEARXNG_UWSGI_THREADS=4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Step 3: Modify the `docker-compose.yaml` file**
|
||||||
|
|
||||||
3. Remove the `localhost` restriction and define a less used port by modifying the `docker-compose.yaml` file:
|
3. Remove the `localhost` restriction and define a less used port by modifying the `docker-compose.yaml` file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sed -i "s/127.0.0.1:8080/0.0.0.0:1337/" searxng-docker/docker-compose.yaml
|
sed -i "s/127.0.0.1:8080/0.0.0.0:1337/"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Step 4: Grant Necessary Permissions**
|
||||||
|
|
||||||
4. Allow the container to create new config files by running the following command in the root directory:
|
4. Allow the container to create new config files by running the following command in the root directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo chmod a+rwx searxng-docker/searxng
|
sudo chmod a+rwx searxng-docker/searxng
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Create a non-restrictive `searxng-docker/searxng/limiter.toml` config file:
|
**Step 5: Create a Less Restrictive `limiter.toml` File**
|
||||||
|
|
||||||
|
5. Create a non-restrictive `searxng-docker/searxng/limiter.toml` config file:
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>searxng-docker/searxng/limiter.toml</summary>
|
<summary>searxng-docker/searxng/limiter.toml</summary>
|
||||||
@ -89,25 +101,31 @@ EOF
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
**Step 6: Remove the Default `settings.yml` File**
|
||||||
|
|
||||||
6. Delete the default `searxng-docker/searxng/settings.yml` file if it exists, as it will be regenerated on the first launch of SearXNG:
|
6. Delete the default `searxng-docker/searxng/settings.yml` file if it exists, as it will be regenerated on the first launch of SearXNG:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
rm searxng-docker/searxng/settings.yml
|
rm searxng-docker/searxng/settings.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Step 7: Create a Fresh `settings.yml` File**
|
||||||
|
|
||||||
7. Bring up the container momentarily to generate a fresh settings.yml file:
|
7. Bring up the container momentarily to generate a fresh settings.yml file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose up searxng-docker -d ; sleep 10 ; docker compose down searxng-docker
|
docker compose up -d ; sleep 10 ; docker compose down
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Step 8: Add Formats and Update Port Number**
|
||||||
|
|
||||||
8. Add HTML and JSON formats to the `searxng-docker/searxng/settings.yml` file:
|
8. Add HTML and JSON formats to the `searxng-docker/searxng/settings.yml` file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sed -i 's/formats: \[\"html\"\/]/formats: [\"html\", \"json\"]/' searxng-docker/searxng/settings.yml
|
sed -i 's/formats: \[\"html\"\/]/formats: [\"html\", \"json\"]/' searxng-docker/searxng/settings.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
9. Update the port number in the `server` section to match the one you set earlier (in this case, `1337`):
|
Update the port number in the `server` section to match the one you set earlier (in this case, `1337`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sed -i 's/port: 8080/port: 1337/' searxng-docker/searxng/settings.yml
|
sed -i 's/port: 8080/port: 1337/' searxng-docker/searxng/settings.yml
|
||||||
@ -136,8 +154,8 @@ use_default_settings: true
|
|||||||
|
|
||||||
server:
|
server:
|
||||||
# base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml
|
# base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml
|
||||||
secret_key: "xxxxx" # change this!
|
secret_key: "ultrasecretkey" # change this!
|
||||||
limiter: false # can be disabled for a private instance
|
limiter: true # can be disabled for a private instance
|
||||||
image_proxy: true
|
image_proxy: true
|
||||||
port: 8080
|
port: 8080
|
||||||
bind_address: "0.0.0.0"
|
bind_address: "0.0.0.0"
|
||||||
@ -157,14 +175,16 @@ search:
|
|||||||
redis:
|
redis:
|
||||||
# URL to connect redis database. Is overwritten by ${SEARXNG_REDIS_URL}.
|
# URL to connect redis database. Is overwritten by ${SEARXNG_REDIS_URL}.
|
||||||
# https://docs.searxng.org/admin/settings/settings_redis.html#settings-redis
|
# https://docs.searxng.org/admin/settings/settings_redis.html#settings-redis
|
||||||
url: redis://redis:6379/2
|
url: redis://redis:6379/0
|
||||||
```
|
```
|
||||||
|
|
||||||
The port in the settings.yml file for SearXNG should match that of the port number in your docker-compose.yml file for SearXNG. So if you plan to use port `1337` for example, you'd set both to `1337`. If you want to use port `8080`, keep both on `8080`. Feel free to change the `bind_address` from `0.0.0.0` to `127.0.0.1` instead. Leaving it on `0.0.0.0` means that SearXNG can listen across all interfaces, while `127.0.0.1` just means that its listening on localhost.
|
The port in the settings.yml file for SearXNG should match that of the port number in your docker-compose.yml file for SearXNG. So if you plan to use port `1337` for example, you'd set both to `1337`. If you want to use port `8080`, keep both on `8080`. Feel free to change the `bind_address` from `0.0.0.0` to `127.0.0.1` instead. Leaving it on `0.0.0.0` means that SearXNG can listen across all interfaces, while `127.0.0.1` just means that its listening on localhost.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
10. Your `searxng-docker/searxng/uwsgi.ini` file for SearXNG should look like:
|
**Step 9: Update `uwsgi.ini` File**
|
||||||
|
|
||||||
|
9. Ensure your `searxng-docker/searxng/uwsgi.ini` file matches the following:
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>searxng-docker/searxng/uwsgi.ini</summary>
|
<summary>searxng-docker/searxng/uwsgi.ini</summary>
|
||||||
@ -224,9 +244,11 @@ offload-threads = 4
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
## 2. Alternative Configuration
|
||||||
|
|
||||||
Alternatively, if you don't want to modify the default configuration, you can simply create an empty `searxng-docker` folder and follow the rest of the setup instructions.
|
Alternatively, if you don't want to modify the default configuration, you can simply create an empty `searxng-docker` folder and follow the rest of the setup instructions.
|
||||||
|
|
||||||
### 2. Docker Compose Setup
|
### Docker Compose Setup
|
||||||
|
|
||||||
Add the following to your `docker-compose.yaml` file:
|
Add the following to your `docker-compose.yaml` file:
|
||||||
|
|
||||||
@ -276,13 +298,15 @@ Alternatively, you can run SearXNG directly using `docker run`:
|
|||||||
docker run --name searxng --env-file stack.env -v ./searxng:/etc/searxng:rw -p 1337:8080 --restart unless-stopped --cap-drop ALL --cap-add CHOWN --cap-add SETGID --cap-add SETUID --cap-add DAC_OVERRIDE --log-driver json-file --log-opt max-size=1m,max-file=1 searxng/searxng:latest
|
docker run --name searxng --env-file stack.env -v ./searxng:/etc/searxng:rw -p 1337:8080 --restart unless-stopped --cap-drop ALL --cap-add CHOWN --cap-add SETGID --cap-add SETUID --cap-add DAC_OVERRIDE --log-driver json-file --log-opt max-size=1m,max-file=1 searxng/searxng:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Confirm Connectivity**
|
||||||
|
|
||||||
Confirm connectivity from Open-WebUI container instance:
|
Confirm connectivity from Open-WebUI container instance:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker exec -it open-webui curl http://host.docker.internal:1337/search?q=this+is+a+test+query&format=json
|
docker exec -it open-webui curl http://host.docker.internal:1337/search?q=this+is+a+test+query&format=json
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. GUI Configuration
|
## 3. GUI Configuration
|
||||||
|
|
||||||
1. Navigate to: `Admin Panel` -> `Settings` -> `Web Search`
|
1. Navigate to: `Admin Panel` -> `Settings` -> `Web Search`
|
||||||
2. Toggle `Enable Web Search`
|
2. Toggle `Enable Web Search`
|
||||||
@ -293,7 +317,7 @@ docker exec -it open-webui curl http://host.docker.internal:1337/search?q=this+i
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 4. Using Web Search in a Chat
|
## 4. Using Web Search in a Chat
|
||||||
|
|
||||||
To access Web Search, Click on the + next to the message input field.
|
To access Web Search, Click on the + next to the message input field.
|
||||||
|
|
||||||
@ -301,6 +325,8 @@ Here you can toggle Web Search On/Off.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
By following these steps, you will have successfully set up SearXNG with Open WebUI, enabling you to perform web searches using the SearXNG engine.
|
||||||
|
|
||||||
#### Note
|
#### Note
|
||||||
|
|
||||||
You will have to explicitly toggle this On/Off in a chat.
|
You will have to explicitly toggle this On/Off in a chat.
|
||||||
|
Loading…
Reference in New Issue
Block a user