From d433980265de4eccd343dcbfc92c3e7416057842 Mon Sep 17 00:00:00 2001 From: Malik Talha Date: Sun, 12 Nov 2023 04:03:26 +0500 Subject: Add sample command section to voice assistant app Add a section that allows to choose and execute sample commands and minor improvements to app UI. Bug-AGL: SPEC-4906 Signed-off-by: Malik Talha Change-Id: I1a279c6ecd1904c428b8403d3ce0750bc063da3b --- lib/grpc/voice_agent_client.dart | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib/grpc/voice_agent_client.dart') diff --git a/lib/grpc/voice_agent_client.dart b/lib/grpc/voice_agent_client.dart index f25f0d2..089d2a5 100644 --- a/lib/grpc/voice_agent_client.dart +++ b/lib/grpc/voice_agent_client.dart @@ -43,7 +43,7 @@ class VoiceAgentClient { } Future recognizeVoiceCommand( - Stream controlStream) async { + Stream controlStream) async { try { final response = await _client.recognizeVoiceCommand(controlStream); return response; @@ -54,9 +54,21 @@ class VoiceAgentClient { } } - Future executeVoiceCommand(ExecuteInput input) async { + Future recognizeTextCommand( + RecognizeTextControl controlInput) async { try { - final response = await _client.executeVoiceCommand(input); + final response = await _client.recognizeTextCommand(controlInput); + return response; + } catch (e) { + print('Error calling RecognizeTextCommand: $e'); + // Handle the error gracefully, such as returning a default RecognizeResult + return RecognizeResult()..status = RecognizeStatusType.REC_ERROR; + } + } + + Future executeCommand(ExecuteInput input) async { + try { + final response = await _client.executeCommand(input); return response; } catch (e) { print('Error calling ExecuteVoiceCommand: $e'); -- cgit