Ariver
2026-07-03 72b84399db9001a3b26ddad00c307438d940d8ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
set -euo pipefail
 
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
 
APP_VERSION="2.2.2"
APP_BUILD="20260703.0335"
ARCH="${1:-amd64}"
 
if [[ "$ARCH" != "amd64" ]]; then
  echo "Only amd64 is supported for the Windows preview build." >&2
  exit 2
fi
 
for tool in go npm x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++; do
  if ! command -v "$tool" >/dev/null 2>&1; then
    echo "Missing required tool: $tool" >&2
    exit 127
  fi
done
 
OUT_ROOT="$ROOT_DIR/build/windows-preview"
OUT_DIR="$OUT_ROOT/PrivateVoice-Dictation-${APP_VERSION}-build${APP_BUILD}-windows-${ARCH}-preview"
ZIP_PATH="$OUT_ROOT/PrivateVoice-Dictation-${APP_VERSION}-build${APP_BUILD}-windows-${ARCH}-preview.zip"
 
rm -rf "$OUT_DIR" "$ZIP_PATH"
mkdir -p "$OUT_DIR"
 
echo "Building frontend..."
npm --prefix frontend install
npm --prefix frontend run build
 
SHERPA_WINDOWS_DIR="$(go list -m -f '{{.Dir}}' github.com/k2-fsa/sherpa-onnx-go-windows)"
SHERPA_DLL_DIR="$SHERPA_WINDOWS_DIR/lib/x86_64-pc-windows-gnu"
for dll in onnxruntime.dll sherpa-onnx-c-api.dll sherpa-onnx-cxx-api.dll; do
  if [[ ! -f "$SHERPA_DLL_DIR/$dll" ]]; then
    echo "Missing sherpa runtime DLL: $SHERPA_DLL_DIR/$dll" >&2
    exit 3
  fi
done
 
echo "Building Windows executable..."
GOOS=windows \
GOARCH=amd64 \
CGO_ENABLED=1 \
CC=x86_64-w64-mingw32-gcc \
CXX=x86_64-w64-mingw32-g++ \
go build \
  -buildvcs=false \
  -ldflags="-H windowsgui" \
  -o "$OUT_DIR/PrivateVoice Dictation.exe" \
  .
 
cp "$SHERPA_DLL_DIR/onnxruntime.dll" "$OUT_DIR/"
cp "$SHERPA_DLL_DIR/sherpa-onnx-c-api.dll" "$OUT_DIR/"
cp "$SHERPA_DLL_DIR/sherpa-onnx-cxx-api.dll" "$OUT_DIR/"
cp "$ROOT_DIR/scripts/QA-WINDOWS-PREVIEW.ps1" "$OUT_DIR/"
cp "$ROOT_DIR/scripts/RUN-WINDOWS-QA.cmd" "$OUT_DIR/"
 
cat >"$OUT_DIR/README-WINDOWS-PREVIEW.txt" <<EOF
PrivateVoice Dictation Windows Preview
Version: ${APP_VERSION}
Build: ${APP_BUILD}
Architecture: Windows x64
 
Scope:
- Technical preview based on PrivateVoice Dictation ${APP_VERSION}.
- This Windows preview supports SenseVoice-based recognition, including Chinese and Cantonese.
- Non-SenseVoice models are visible but disabled in this preview build.
 
How to run:
1. Extract the whole folder.
2. Keep the EXE and DLL files in the same directory.
3. Double-click "RUN-WINDOWS-QA.cmd".
4. If Windows blocks the command file, right-click "QA-WINDOWS-PREVIEW.ps1" and choose "Run with PowerShell", or run this command from the extracted folder:
   powershell -ExecutionPolicy Bypass -File .\\QA-WINDOWS-PREVIEW.ps1
5. Follow the on-screen checklist. It will collect WebView2/audio preflight data, launch the app, open a Notepad target file, ask you to dictate once, and collect logs plus the saved target text.
6. You can also run "PrivateVoice Dictation.exe" directly after QA.
 
Known limitations:
- This is not a signed Windows installer.
- Real Windows audio, hotkey, paste, tray, and WebView2 behavior still need QA on Windows 10/11.
- If Windows Defender or SmartScreen blocks it, allow it only for local testing.
- The QA evidence zip may contain app logs and the saved Notepad target text. Review before sharing if needed.
EOF
 
(cd "$OUT_ROOT" && zip -qr "$(basename "$ZIP_PATH")" "$(basename "$OUT_DIR")")
 
echo "Built: $OUT_DIR"
echo "Zip:   $ZIP_PATH"