clean up repo and readme

This commit is contained in:
cra88y/pc
2026-01-14 10:34:31 -06:00
parent c21477dc14
commit f0b07067e9
3 changed files with 31 additions and 9 deletions
+29 -7
View File
@@ -1,25 +1,47 @@
# SearXNG Gemini & OpenRouter Stream # AI Answers for SearXNG
A SearXNG plugin that streams AI responses using search results as grounding context. Supports Google Gemini and OpenAI-compatible providers (OpenRouter, Ollama, etc.). A SearXNG plugin that streams AI responses using search results as grounding context. Supports Google Gemini and OpenAI-compatible providers (OpenRouter, Ollama, etc.).
## Installation
Place `ai_answers.py` into the `searx/plugins` directory of your instance (or mount it in a container) and enable it in `settings.yml`:
```yaml
plugins:
- name: ai_answers
active: true
```
## Configuration ## Configuration
Set the following environment variables: Set the following environment variables:
### General ### General
- `LLM_PROVIDER`: `openrouter` (default) or `gemini`. - `LLM_PROVIDER`: `openrouter` (default) or `gemini`.
- `GEMINI_MAX_TOKENS`: Defaults to `500`. - `GEMINI_MAX_TOKENS`: Defaults to `500`.
- `GEMINI_TEMPERATURE`: Defaults to `0.2`. - `GEMINI_TEMPERATURE`: Defaults to `0.2`.
### Google Gemini
- `GEMINI_API_KEY`: Your Google AI API key.
- `GEMINI_MODEL`: Defaults to `gemma-3-27b-it`.
### OpenRouter / OpenAI / Ollama ### OpenRouter / OpenAI / Ollama
- `OPENROUTER_API_KEY`: Your API key. - `OPENROUTER_API_KEY`: Your API key.
- `OPENROUTER_MODEL`: Defaults to `google/gemma-3-27b-it:free`. - `OPENROUTER_MODEL`: Defaults to `google/gemma-3-27b-it:free`.
- `OPENROUTER_BASE_URL`: Defaults to `openrouter.ai`. (Change to `localhost:11434` for Ollama). - `OPENROUTER_BASE_URL`: Defaults to `openrouter.ai`. (Change to `localhost:11434` for Ollama).
## Installation ### Google Gemini
Place `gemini_flash.py` into the `searx/plugins` directory of your instance (or mount it in a container) and enable it in `settings.yml` with a new plugin block setting it to active. - `GEMINI_API_KEY`: Your Google AI API key.
- `GEMINI_MODEL`: Defaults to `gemma-3-27b-it`.
## How It Works
After search completes, the plugin extracts the top 6 results as context. A client-side script calls the stream endpoint with a signed token. The LLM response streams back. Token by token rendering is soon.
## Ollama (Local)
```
LLM_PROVIDER=openrouter
OPENROUTER_API_KEY=ollama
OPENROUTER_MODEL=gemma3:27b
OPENROUTER_BASE_URL=localhost:11434
```
+1 -1
View File
@@ -12,7 +12,7 @@ TOKEN_EXPIRY_SEC = 60
CONNECTION_TIMEOUT_SEC = 30 CONNECTION_TIMEOUT_SEC = 30
class SXNGPlugin(Plugin): class SXNGPlugin(Plugin):
id = "gemini_flash" id = "ai_answers"
def __init__(self, plg_cfg): def __init__(self, plg_cfg):
super().__init__(plg_cfg) super().__init__(plg_cfg)
+1 -1
View File
@@ -37,7 +37,7 @@ sys.modules["searx"] = searx
sys.modules["searx.plugins"] = searx_plugins sys.modules["searx.plugins"] = searx_plugins
sys.modules["searx.result_types"] = searx_results sys.modules["searx.result_types"] = searx_results
from gemini_flash import SXNGPlugin from ai_answers import SXNGPlugin
from flask_babel import Babel from flask_babel import Babel
app = Flask(__name__) app = Flask(__name__)