| | |
| | | $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 |
| | |
| | | |
| | | 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" |