MCPcopy Create free account
hub / github.com/MagicCube/agentara / handleResult

Function handleResult

web/src/components/ai-elements/speech-input.tsx:138–156  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

136 };
137
138 const handleResult = (event: Event) => {
139 const speechEvent = event as SpeechRecognitionEvent;
140 let finalTranscript = "";
141
142 for (
143 let i = speechEvent.resultIndex;
144 i < speechEvent.results.length;
145 i += 1
146 ) {
147 const result = speechEvent.results[i];
148 if (result.isFinal) {
149 finalTranscript += result[0]?.transcript ?? "";
150 }
151 }
152
153 if (finalTranscript) {
154 onTranscriptionChangeRef.current?.(finalTranscript);
155 }
156 };
157
158 const handleError = () => {
159 setIsListening(false);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected