Skip to content

API: ai/nlu-ui

@mosaicoo/svg-engine/ai/nlu-ui is the UI for the natural-language layer: a ready-made command box (text + voice) bound to the NLU engine, plus the browser Web Speech voice provider and an engine orchestrator. Depends on Angular Material.

import { SvgeNluInput } from '@mosaicoo/svg-engine/ai/nlu-ui';
ComponentSelectorWhat it is
SvgeNluInput<svge-nlu-input>A standalone Material command box: text field + mic button + a live preview of the top candidate (label, confidence, bar), a status line, a confirm button for destructive/low-confidence matches, and a clickable alternatives list.

Key bindings:

Input / OutputPurpose
confirmGate?Hook called before running a destructive or low-confidence intent.
voiceLanguage? / voiceEngine?Choose the recognition language (e.g. pt-BR) and engine (web-speech/whisper/auto).
nluService? / confirmDialog?Override the NLU service or the confirmation prompt.
resultExecutedEmits the NluExecuteResult after each run.
APIDescription
VoiceRecognitionServiceA VoiceProvider backed by the browser Web Speech API — privacy-first and free, no model download. isSupported/listening/lastError signals, listen(lang?, options?) → final transcript, stop().
VoiceEngineServiceAn orchestrator exposing the same VoiceProvider surface, so you can switch between Web Speech and the on-device Whisper provider transparently: setEngine('web-speech' | 'whisper' | 'auto'), engine/whisperAvailable/availableEngines signals. Persists the choice to localStorage.

Both support languages such as pt-BR, en-US and es-ES. auto mode tries Web Speech first and falls back to Whisper when it’s registered (see ai/nlu-voice-wasm).