mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2025-09-15 04:17:22 +00:00
Refactor voice recognition to pass recognized text as a parameter
This commit is contained in:
parent
4de69b584c
commit
070d5c7e20
@ -206,13 +206,13 @@ function Start-VoiceRecognition {
|
|||||||
if ($script:SpeechRecognizer) {
|
if ($script:SpeechRecognizer) {
|
||||||
$script:SpeechRecognizer.SpeechRecognized += {
|
$script:SpeechRecognizer.SpeechRecognized += {
|
||||||
param($sender, $e)
|
param($sender, $e)
|
||||||
$command = $e.Result.Text
|
$recognizedText = $e.Result.Text
|
||||||
Write-Host "🎤 Recognized: $command" -ForegroundColor Cyan
|
Write-Host "🎤 Recognized: $recognizedText" -ForegroundColor Cyan
|
||||||
& $OnRecognized $command
|
& $OnRecognized -RecognizedCommand $recognizedText
|
||||||
}
|
}
|
||||||
|
|
||||||
$script:SpeechRecognizer.RecognizeAsync()
|
$script:SpeechRecognizer.RecognizeAsync()
|
||||||
Write-Host "🎤 Voice recognition started. Speak your command..." -ForegroundColor Green
|
Write-Host "🎤 Voice recognition started. Speak your commands..." -ForegroundColor Green
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user