AgentVoiceControl
Voice-input and text-to-speech widget for AI agents using Web Speech API.
Simple Build
Interactive Preview
Initialising Operative...
Architecture
Component Architecture
AgentVoiceControl/
Prop Usage
| Prop | Type | Default | Description |
|---|---|---|---|
onTranscript | (text: string) => void | — | Called with the recognised speech text. |
speakText | string | — | Text to read aloud via TTS when provided. |
lang | string | "en-US" | BCP-47 language tag for speech recognition. |
className | string | — | Additional classes. |
Usage
import { AgentVoiceControl } from '@/ui/features/AgentVoiceControl';
const [reply, setReply] = useState('');
<AgentVoiceControl
onTranscript={async (text) => {
const res = await fetch('/api/chat', { body: JSON.stringify({ message: text }) });
const data = await res.json();
setReply(data.reply);
}}
speakText={reply}
/>