feat: Add SearXNG for improved web search
- Add SearXNG service to docker-compose.yml (port 11112) - Add SEARXNG_SECRET_KEY to .env.example - Add searxng-data/settings.yml with FR engines (google, bing, ddg, qwant) - Add docs/SEARXNG-INTEGRATION.md with OpenWebUI tool setup
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
# SEARXNG - Integration OpenWebUI
|
||||
|
||||
## Configuration
|
||||
|
||||
SearXNG est maintenant intégré dans `docker-compose.yml` de Effi :
|
||||
- **Port** : 11112
|
||||
- **URL** : http://192.168.1.27:11112
|
||||
|
||||
## Tool web_search pour OpenWebUI
|
||||
|
||||
Dans **Admin Panel → Tools**, modifier ou créer le tool `web_search` :
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
def web_search(query):
|
||||
"""Recherche web via SearXNG auto-hébergé"""
|
||||
searxng_url = "http://192.168.1.27:11112"
|
||||
|
||||
try:
|
||||
response = requests.get(
|
||||
f"{searxng_url}/search",
|
||||
params={
|
||||
"q": query,
|
||||
"format": "json",
|
||||
"engines": "google,bing,duckduckgo,qwant",
|
||||
"language": "fr"
|
||||
},
|
||||
timeout=15
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
results = response.json()
|
||||
formatted = []
|
||||
|
||||
for r in results.get("results", [])[:10]:
|
||||
title = r.get("title", "Sans titre")
|
||||
url = r.get("url", "")
|
||||
snippet = r.get("content", "")[:200]
|
||||
formatted.append(f"**{title}**\n{snippet}\n🔗 {url}")
|
||||
|
||||
if formatted:
|
||||
return "## Résultats\n\n" + "\n\n".join(formatted)
|
||||
|
||||
return "Aucun résultat."
|
||||
|
||||
return f"Erreur {response.status_code}"
|
||||
|
||||
except Exception as e:
|
||||
return f"Erreur: {str(e)}"
|
||||
```
|
||||
|
||||
## Déploiement sur effi-server
|
||||
|
||||
```bash
|
||||
# Copier le dossier Effi sur effi-server
|
||||
scp -r /home/folzo/Documents/OpenCode/Projets/Effi user@192.168.1.27:~/effi
|
||||
|
||||
# Sur effi-server
|
||||
cd ~/effi
|
||||
cp .env.example .env
|
||||
# Éditer .env et ajouter SEARXNG_SECRET_KEY
|
||||
|
||||
# Lancer
|
||||
docker compose up -d
|
||||
|
||||
# Tester
|
||||
curl http://localhost:11112/search?q=test\&format=json
|
||||
```
|
||||
|
||||
## URLs
|
||||
|
||||
| Service | URL |
|
||||
|---------|-----|
|
||||
| SearXNG | http://192.168.1.27:11112 |
|
||||
| OpenWebUI | http://192.168.1.27:3000 |
|
||||
|
||||
## Engines configurées
|
||||
|
||||
- google (FR)
|
||||
- bing (FR-FR)
|
||||
- duckduckgo (FR-FR)
|
||||
- qwant (FR)
|
||||
- wikipedia (FR)
|
||||
Reference in New Issue
Block a user