ainqa-voice-assistant
v1.0.1
Published
Generic voice control layer for any web or Electron application
Readme
ainqa-voice-assistant
Generic voice control layer for any web or Electron application. Framework-agnostic field matching via LLM. Supports Web Speech API and Whisper (DeepInfra) as STT backends.
Install
npm install ainqa-voice-assistantQuick Start
import {
VoiceProvider,
VoiceAssistantBar,
useVoice
} from 'ainqa-voice-assistant';
// 1. Wrap your app with the provider
<VoiceProvider config={{
sttMode: 'webspeech',
onDataExtracted: (matches) => {
matches.forEach(m => console.log(m.fieldId, m.value));
},
onCommandDetected: (cmd) => {
if (cmd === 'continue') goToNextStep();
}
}}>
<YourApp />
<VoiceAssistantBar />
</VoiceProvider>
// 2. Register fields in any component
function YourForm() {
const { registerFields } = useVoice();
useEffect(() => {
registerFields([
{ fieldId: 'age', label: 'Patient Age', type: 'input' },
{ fieldId: 'diabetes', label: 'Diabetes', type: 'boolean' },
{
fieldId: 'priority',
label: 'Priority',
type: 'single_select',
options: [
{ label: 'Routine', value: 'routine' },
{ label: 'Urgent', value: 'urgent' },
]
}
]);
}, []);
}STT Modes
| Mode | Privacy | Latency | Arabic |
|------|---------|---------|--------|
| webspeech | Google servers | ~0ms | Limited |
| whisper | DeepInfra API | ~700ms | Strong |
Supported Commands
| Voice | Command fired |
|-------|--------------|
| "next" / "continue" / "proceed" | continue |
| "stop" / "pause" | stop |
| "add order" / "add lab order" | add_order |
| "confirm" / "save" | confirm |
| "cancel" / "discard" | cancel |
