PWA, one send/stop button, audio in and out, web search as a tool
Four pieces of work.
**Installable.** A manifest carrying the instance name, PWA icons rasterised
from the existing mark at design time, a service worker and a themed offline
page. The worker caches the shell only and bails out on /api/, /auth/, /admin/
and anything accepting text/event-stream -- passing a reply stream through a
worker turns it into one delivery at the end, or nothing. It is served from
GET /sw.js rather than the static mount because a worker's scope is the path it
came from.
**Send and Stop are one button.** They were two, and the hidden one was never
hidden: `.btn` is display: inline-flex, which outranks the browser's own
`[hidden] { display: none }`, so Stop sat permanently beside Send. app.css now
forces the attribute to win -- every control toggled with `hidden` depended on
that -- and the composer renders one button carrying both icons, with ui.js
flipping data-composer-action and the type with it.
**Audio.** Speech to text and text to speech against any OpenAI-shaped
/v1/audio/* endpoint: dictate into the composer, have a reply read out.
Instance settings in Admin, per-reader overrides in Settings, with the voice
list discovered from the server where it offers one. Recorded audio is capped
and never written to disk -- it is not an attachment, it has no owner, and
nothing would ever sweep it.
**Web search, as a tool.** This is the tool loop PLAN.md described as the real
work: one reply is now a bounded sequence of requests rather than one. The model
asks, the tool runs, the result goes back and it is asked again, up to three
rounds. Providers are DuckDuckGo (no setup), SearXNG and Firecrawl.
Two decisions worth stating. Tools are only offered to models flagged `tools`,
because an endpoint without support rejects the whole request rather than
ignoring the array -- the same reason images only reach models flagged
`vision`. And tool results are not replayed as context on the next turn, for the
same reasons reasoning is not: the answer already contains what the model made
of them, and replaying stale results into every later request wastes the window
and reliably sends a small model into a search loop. The sources stay visible in
the transcript instead.
Search results are untrusted third-party text and are treated as such: escaped,
and only http/https URLs rendered as links.
338 tests, ruff clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,14 @@ runtime. Clone it, `pip install -e .`, run it.
|
||||
put in the prompt
|
||||
- **Folders** — arbitrarily nested, delete a folder without losing the chats
|
||||
inside it
|
||||
- **Web search** — offered to the model as a tool it calls when a question needs
|
||||
it. DuckDuckGo out of the box (no account, no key), or point it at your own
|
||||
SearXNG, or Firecrawl. The sources stay in the transcript
|
||||
- **Speech in and out** — dictate a message and have replies read aloud, against
|
||||
any OpenAI-compatible audio endpoint (whisper.cpp, Speaches, Kokoro…). Each
|
||||
person picks their own voice
|
||||
- **Installable** — add it to a phone home screen or a desktop launcher and it
|
||||
runs in its own window
|
||||
- **OpenAI connections** — point at OpenAI, LM Studio, vLLM, llama.cpp,
|
||||
llama-swap, Ollama or OpenRouter; models are discovered and cached
|
||||
- **Model settings** — searchable, filterable list with a page per model:
|
||||
@@ -64,8 +72,8 @@ runtime. Clone it, `pip install -e .`, run it.
|
||||
|
||||
**Planned**
|
||||
|
||||
Built-in tools with admin settings · custom tools and MCP servers · agentic
|
||||
execution (local and over SSH) · image generation · OCR for scanned PDFs.
|
||||
Custom tools and MCP servers · agentic execution (local and over SSH) · image
|
||||
generation · OCR for scanned PDFs.
|
||||
|
||||
See [PLAN.md](PLAN.md) for what is built, what is not, and why.
|
||||
|
||||
@@ -76,7 +84,7 @@ git clone https://git.houmeres.sk/Houmeres/LLeMbas.git
|
||||
cd LLeMbas
|
||||
|
||||
python -m venv .venv && . .venv/bin/activate
|
||||
pip install -e ".[dev]"
|
||||
pip install -e ".[dev,search]" # `search` adds DuckDuckGo; drop it if unwanted
|
||||
|
||||
cp .env.example .env
|
||||
lembas secret-key # paste the result into LEMBAS_SECRET_KEY
|
||||
@@ -93,6 +101,44 @@ and its models appear in the chat model picker.
|
||||
> access is needed to run. To re-fetch or bump them:
|
||||
> `python scripts/fetch_vendor.py --update`.
|
||||
|
||||
### Web search
|
||||
|
||||
**Admin → Web search.** DuckDuckGo needs nothing beyond the `search` extra
|
||||
above. SearXNG needs its JSON format enabled — add `- json` under
|
||||
`search.formats` in its `settings.yml`, or every search fails. Firecrawl needs
|
||||
an API key.
|
||||
|
||||
Search is offered to the model as a *tool*, so it decides when a question needs
|
||||
looking up. It is only offered to models marked **tools** under
|
||||
**Admin → Models**: an endpoint without tool support rejects the whole request
|
||||
rather than ignoring the extra field, so the flag is a real switch and not a
|
||||
hint.
|
||||
|
||||
### Audio
|
||||
|
||||
**Admin → Audio.** Two endpoints, because they are usually two servers:
|
||||
|
||||
| | Speaks | Example |
|
||||
|---|---|---|
|
||||
| Dictation | `POST /v1/audio/transcriptions` | whisper.cpp's `whisper-server`, Speaches, faster-whisper-server |
|
||||
| Read aloud | `POST /v1/audio/speech` | Kokoro-FastAPI, OpenAI |
|
||||
|
||||
If the speech endpoint also answers `GET /v1/audio/voices` the voice list is
|
||||
read from it, and each person can pick their own under **Settings → Audio**.
|
||||
Recorded audio is passed straight through and never written to disk.
|
||||
|
||||
> The microphone needs HTTPS or localhost. Browsers do not grant it over plain
|
||||
> HTTP, so a LAN install without TLS will not offer dictation.
|
||||
|
||||
### Installing as an app
|
||||
|
||||
Open it in a browser and use *Install* (Chromium) or *Share → Add to Home
|
||||
Screen* (iOS). This also needs HTTPS or localhost — service workers are
|
||||
unavailable over plain HTTP, and without one there is nothing to install.
|
||||
|
||||
There is no offline mode beyond a page saying so. Everything is rendered by your
|
||||
server, so a cached conversation would be a snapshot that silently went stale.
|
||||
|
||||
## Configuration
|
||||
|
||||
All variables are prefixed `LEMBAS_` and can live in `.env`. See
|
||||
|
||||
Reference in New Issue
Block a user