168
// Check for agent + slash command
169
if (options.usesAgents && startsWithAgent && !detectedAgent && !detectedSlashCommand && originalWords.length >= 4) {
170
>
const phrase = phrases.get(originalWords.slice(0, 4).map(word => this.normalizeWord(word)).join(' '));
voiceChatService.ts
171
>
if (phrase) {
172
>
transformedWords = [this.toText(phrase, PhraseTextType.AGENT_AND_COMMAND), ...originalWords.slice(4)];
173
>
174
>
waitingForInput = originalWords.length === 4;
175
>
176
>
if (e.status === SpeechToTextStatus.Recognized) {
177
>
detectedAgent = true;
178
>
detectedSlashCommand = true;
179
>
}
180
>
}
181
>
}
182
183
// Check for agent (if not done already)
184
if (options.usesAgents && startsWithAgent && !detectedAgent && !transformedWords && originalWords.length >= 2) {
185
>
const phrase = phrases.get(originalWords.slice(0, 2).map(word => this.normalizeWord(word)).join(' '));
voiceChatService.ts
186
>
if (phrase) {
187
>
transformedWords = [this.toText(phrase, PhraseTextType.AGENT), ...originalWords.slice(2)];
188
>
189
>
waitingForInput = originalWords.length === 2;
190
>
191
>
if (e.status === SpeechToTextStatus.Recognized) {
192
>
detectedAgent = true;
193
>
}
194
>
}
195
>
}
196
197
// Check for slash command (if not done already)