lokesh341 commited on
Commit
0ebf5ef
·
verified ·
1 Parent(s): 8863e3e

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +12 -4
templates/index.html CHANGED
@@ -101,10 +101,18 @@
101
  recognition.start();
102
  recognition.onresult = function(event) {
103
  const transcript = event.results[0][0].transcript.trim();
104
- nameInput.value = transcript;
105
- recognition.stop();
106
- // Now, prompt for email
107
- speak("Tell me your email", startListeningForEmail);
 
 
 
 
 
 
 
 
108
  };
109
  }
110
 
 
101
  recognition.start();
102
  recognition.onresult = function(event) {
103
  const transcript = event.results[0][0].transcript.trim();
104
+
105
+ // Remove all spaces from the name
106
+ const cleanedName = transcript.replace(/\s+/g, '');
107
+
108
+ if (!isNameCaptured) {
109
+ // If name is not yet captured, capture name first
110
+ nameInput.value = cleanedName; // Set the cleaned name without spaces
111
+ status.textContent = 'Listening for your email...'; // Prompt for email
112
+ recognition.stop(); // Stop listening for name
113
+ isNameCaptured = true; // Mark name as captured
114
+ recognition.start(); // Start listening for email
115
+ }
116
  };
117
  }
118