AUDIO
Listen to this page
Chapters
Agent and answer language
AI providers
The Agent layer maps a request to {tool, args, reply}. Configured in the
dashboard (AI provider screen), stored in the settings store:
- mock matcher (default of a fresh instance) — deterministic keyword matching, no network; primary tool for local development and CI tests.
- local Ollama — the ollama plugin's own container or an external Ollama / Llama.cpp endpoint; see plugins/ollama.
- cloud LLM — OpenAI / Anthropic / OpenRouter. Keys are entered directly in the AI provider screen (masked after saving). Several providers can be kept at once — each with its own model, base URL and key; the selected one is the default that answers requests, the fallback uses its own saved entry. OpenRouter is OpenAI-compatible — default base URL https://openrouter.ai/api/v1, model ids look like "openai/gpt-4o-mini". An INLINE mention is one-shot: "question … For the answer use openrouter" uses the named provider for THIS request only — the directive is stripped from the question and nothing is stored; unconfigured providers are ignored.
- dynamic per-user override — the spoken command "for response use openrouter" switches WHICH provider answers for THIS user until "use the default provider" clears it; the dashboard default stays untouched. The target provider must be configured in the AI provider screen (an unconfigured one is declined, localized); the confirmation is spoken in the current language.
- fallback provider — used when the primary is unreachable.
The agent only receives the tools the current user's role allows (see architecture → enforcement flow).
The chat fallback
A plugin may export chat(text, ctx) — the FIRST enabled plugin doing so
becomes the conversational fallback: it answers every request that fits no
tool (and every case where the configured LLM provider failed). The ollama
plugin is the reference implementation. Return {reply, model?} or null
to decline. A REAL provider's own successful replies are never replaced —
the fallback only fills the gap. If the fallback model is also down, the
localized "no matching tool" phrase stays as the last line of defense.
Answer language (i18n)
Every text the core RETURNS to a person — the agent reply, service phrases
("Done", "Sorry: …") and the spoken audio — comes in the language of the
question (server/src/core/i18n.js):
- the request may carry an explicit
language(BCP-47, "de"); otherwise the language is detected from the question text itself (script heuristics: cyrillic→ru; spanish/german/polish diacritics and stopword hints; en default) — a Russian text question needs NO language parameter to be answered in Russian with the russian-match piper voice; t(lang, key, vars)— language catalog → "en" catalog → the key itself. Shipped keys:DID_NOT_UNDERSTAND,NO_TOOL,DONE,SORRY_ERROR,TOOL_FAILED(en, ru, es, de, pl, fr, nl — a new language is added as one new catalog block;server/tests/i18n.jsguards detection + fallbacks);- the voice for the answer follows the SAME detected language (speech settings language mapping);
- LLM-provider free replies stay in whatever the model answers with (usually the user's language).
Conversation context (repeat/continue questions)
The decide step always runs with the recent dialogue as prior messages, so "repeat the last message" / "what did you say about the boiler?" keep their context, in both the text and the voice pipelines:
/chatclients ride their own history along ({mine, text}— the last ~20 turns; client history wins);/voiceclients send only audio — the core keeps a small rolling memory per user (last 12 exchanges, 6 h, in RAM) and remembers every exchange itself; the decision prompt explicitly tells the model the prior messages are present so small local models stop claiming they have no history;- the flattened dialogue makes weak local models repeat answers verbatim — a follow-up question ("what is the humidity there?") continues the same tool conversation.
The "change language" command (session language)
A spoken command changes the CURRENT pipeline language for the user:
"change language to English/Russian/…"; "switch to …" forms, bare
names/codes and "auto" (back to per-recording detection) are accepted. Trigger matching
lives in src/core/langCommand.js (tested).
- Effect: the preference is persisted in the database (per user id) — the user can switch any number of times. Every following chat/voice request of that user uses it as the pipeline language: STT gets the language HINT (accurate transcript), spoken strings and the TTS voice follow it.
- Priority: explicit request
languagefield > user session language > text detection > STT auto guess. - The confirmation is spoken in the NEW language ("From now on I answer
in English.");
speech.languageevents go to the clients. Unknown language name → the localized "did not recognize" phrase, nothing changes. - Recommendation for one-main-language households: pin the STT language in the speech settings instead ("change language" is best for households that actually mix languages).
Dashboard i18n
The admin UI ships the same language set (en, ru, es, de, pl, fr, nl). Strings live
in one file, dashboard/src/lib/i18n.ts; language auto-detects from the
browser locale, an override selector sits at the bottom of the sidebar and
persists in localStorage 'holai_lang'; missing keys fall back to English.
dashboard/tests/i18n-keys.mjs guarantees every language covers the SAME
key set. Plugin pages embed the shared loader src/plugin-ui-i18n.js —
details for plugin authors: plugins-api.
Last updated: November 2026