From 070d5c7e20bbb9b5589e669333323f4af8fb818f Mon Sep 17 00:00:00 2001 From: dopeuni444 Date: Thu, 31 Jul 2025 13:19:20 +0400 Subject: [PATCH] Refactor voice recognition to pass recognized text as a parameter --- PowerShell_AI_Agent/scripts/main.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PowerShell_AI_Agent/scripts/main.ps1 b/PowerShell_AI_Agent/scripts/main.ps1 index f55ebc1..6e7dd04 100644 --- a/PowerShell_AI_Agent/scripts/main.ps1 +++ b/PowerShell_AI_Agent/scripts/main.ps1 @@ -206,13 +206,13 @@ function Start-VoiceRecognition { if ($script:SpeechRecognizer) { $script:SpeechRecognizer.SpeechRecognized += { param($sender, $e) - $command = $e.Result.Text - Write-Host "🎤 Recognized: $command" -ForegroundColor Cyan - & $OnRecognized $command + $recognizedText = $e.Result.Text + Write-Host "🎤 Recognized: $recognizedText" -ForegroundColor Cyan + & $OnRecognized -RecognizedCommand $recognizedText } $script:SpeechRecognizer.RecognizeAsync() - Write-Host "🎤 Voice recognition started. Speak your command..." -ForegroundColor Green + Write-Host "🎤 Voice recognition started. Speak your commands..." -ForegroundColor Green } } catch {