From ac31349b32d89b2798cd20224fcdede91d6bfe05 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Tue, 30 Jun 2026 03:30:51 +0800
Subject: [PATCH] Capture Windows QA target text

---
 privatevoice.src/scripts/QA-WINDOWS-PREVIEW.ps1 |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/privatevoice.src/scripts/QA-WINDOWS-PREVIEW.ps1 b/privatevoice.src/scripts/QA-WINDOWS-PREVIEW.ps1
index cf43713..b9c1581 100644
--- a/privatevoice.src/scripts/QA-WINDOWS-PREVIEW.ps1
+++ b/privatevoice.src/scripts/QA-WINDOWS-PREVIEW.ps1
@@ -38,6 +38,7 @@
 $LogPath = Join-Path $AppDataDir "app.log"
 $Timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
 $EvidenceDir = Join-Path $PackageDir "qa-evidence-$Timestamp"
+$TargetPath = Join-Path $EvidenceDir "qa-target.txt"
 $Results = [System.Collections.Generic.List[string]]::new()
 
 New-Item -ItemType Directory -Path $EvidenceDir -Force | Out-Null
@@ -84,12 +85,36 @@
 
 if (-not $CollectOnly) {
     Write-Step "Manual runtime check"
+    @(
+        "PrivateVoice Windows Preview QA Target",
+        "Click after the marker below, dictate one short Chinese sentence, then press Ctrl+S in Notepad.",
+        "DICTATION_RESULT:"
+    ) | Set-Content -Encoding UTF8 $TargetPath
+    try {
+        Start-Process -FilePath "notepad.exe" -ArgumentList "`"$TargetPath`"" | Out-Null
+        Add-Result $Results "Notepad target launched" $true $TargetPath
+    } catch {
+        Add-Result $Results "Notepad target launched" $false $_.Exception.Message
+    }
     Write-Host "1. Keep this PowerShell window open." -ForegroundColor White
     Write-Host "2. In PrivateVoice, make sure the SenseVoice model is installed and the engine is ready." -ForegroundColor White
-    Write-Host "3. Open Notepad or a browser text field." -ForegroundColor White
-    Write-Host "4. Use the configured hotkey and speak: 这是 Windows 预览版测试。" -ForegroundColor White
-    Write-Host "5. Confirm whether the text appears in the target input field." -ForegroundColor White
-    Read-Host "Press Enter after you complete one dictation attempt"
+    Write-Host "3. Use the Notepad window opened by this script as the target input field." -ForegroundColor White
+    Write-Host "4. Click after DICTATION_RESULT:, use the configured hotkey, and speak one short Chinese sentence." -ForegroundColor White
+    Write-Host "5. Confirm the recognized text appears in Notepad, press Ctrl+S in Notepad, then return here." -ForegroundColor White
+    Read-Host "Press Enter after you save the Notepad target file"
+}
+
+if (Test-Path $TargetPath) {
+    Copy-Item $TargetPath (Join-Path $EvidenceDir "qa-target-captured.txt") -Force
+    $targetText = Get-Content $TargetPath -Raw -ErrorAction SilentlyContinue
+    $marker = "DICTATION_RESULT:"
+    $markerIndex = $targetText.IndexOf($marker)
+    $dictationText = ""
+    if ($markerIndex -ge 0) {
+        $dictationText = $targetText.Substring($markerIndex + $marker.Length).Trim()
+    }
+    $dictationText | Set-Content -Encoding UTF8 (Join-Path $EvidenceDir "qa-target-dictation-text.txt")
+    Add-Result $Results "target file saved with dictation text" ($dictationText.Length -gt 0) "chars=$($dictationText.Length)"
 }
 
 Write-Step "Collecting logs"

--
Gitblit v1.9.3