功能: - 基于 ONNX 的语音识别引擎 - 多语言支持(中文、英文、日语、韩语) - 模型加载器(支持 SenseVoice/Whisper/Paraformer) - 音频采集和处理模块(VAD、重采样、归一化) - 文本输出模块(剪贴板) - CLI 命令行工具 - Electron GUI 界面 - Windows x64 打包配置 文档: - PRD 产品需求文档 - README 项目说明 - 开发指南 - Windows 构建指南 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
123 lines
2.6 KiB
Markdown
123 lines
2.6 KiB
Markdown
# Windows 构建指南
|
||
|
||
## 构建说明
|
||
|
||
由于网络问题,在 Linux 环境下构建 Windows 版本可能需要多次尝试。建议在 Windows 系统上直接构建,或使用以下方法。
|
||
|
||
## 方法一:在 Windows 上构建(推荐)
|
||
|
||
### 1. 环境准备
|
||
|
||
```powerslhell
|
||
# 安装 Node.js 20+
|
||
# 从 https://nodejs.org 下载安装
|
||
|
||
# 克隆项目
|
||
git clone <repository-url>
|
||
cd impress-asr-input
|
||
|
||
# 安装依赖
|
||
npm install
|
||
```
|
||
|
||
### 2. 放入模型文件
|
||
|
||
将 ONNX 模型放入 `models/` 目录:
|
||
- `sensevoice.onnx`
|
||
- `whisper.onnx`
|
||
- `paraformer.onnx`
|
||
|
||
### 3. 构建
|
||
|
||
```powershell
|
||
# 构建 ZIP 包(无需签名)
|
||
npm run build:win:zip
|
||
|
||
# 构建 NSIS 安装程序
|
||
npm run build:win
|
||
```
|
||
|
||
输出目录:`release/`
|
||
|
||
## 方法二:在 Linux 上构建(需要良好网络)
|
||
|
||
```bash
|
||
# 设置 Electron 镜像
|
||
export ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
|
||
|
||
# 构建解压目录版本(用于测试)
|
||
npm run build:win:dir
|
||
|
||
# 构建 ZIP 包
|
||
npm run build:win:zip
|
||
```
|
||
|
||
## 构建输出
|
||
|
||
```
|
||
release/
|
||
├── win-unpacked/ # 未打包版本(用于测试)
|
||
│ ├── Impress ASR Input.exe
|
||
│ ├── resources/
|
||
│ └── ...
|
||
├── Impress ASR Input-0.1.0-win-x64.zip # ZIP 压缩包
|
||
└── Impress ASR Input-0.1.0-win-x64-setup.exe # NSIS 安装程序
|
||
```
|
||
|
||
## 常见问题
|
||
|
||
### 1. Electron 下载失败
|
||
|
||
```bash
|
||
# 使用国内镜像
|
||
export ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
|
||
export npm_config_electron_mirror="https://npmmirror.com/mirrors/electron/"
|
||
```
|
||
|
||
### 2. winCodeSign 下载失败
|
||
|
||
这是 electron-builder 依赖的签名工具,可以:
|
||
- 添加 `"sign": null` 到 `package.json` 的 `build` 字段禁用签名
|
||
- 或手动下载:https://github.com/electron-userland/electron-builder-binaries/releases
|
||
|
||
### 3. 图标文件缺失
|
||
|
||
构建时会使用默认图标,如需自定义:
|
||
1. 准备 `icon.ico` (256x256)
|
||
2. 放入 `build/` 目录
|
||
3. 在 `package.json` 中添加 `"icon": "build/icon.ico"`
|
||
|
||
## 手动分发(无打包工具)
|
||
|
||
如果 electron-builder 无法使用,可以手动创建分发包:
|
||
|
||
```bash
|
||
# 1. 编译 TypeScript
|
||
npm run build
|
||
|
||
# 2. 复制 Electron 和资源文件
|
||
cp -r dist/ release/my-app/
|
||
cp -r node_modules/ release/my-app/node_modules/
|
||
cp -r src/ui/ release/my-app/src/ui/
|
||
cp -r models/ release/my-app/models/
|
||
|
||
# 3. 下载 Electron 并放入
|
||
# https://npmmirror.com/mirrors/electron/
|
||
|
||
# 4. 压缩
|
||
cd release/
|
||
zip -r impress-asr-input-win-x64.zip my-app/
|
||
```
|
||
|
||
## 运行应用
|
||
|
||
解压后运行:
|
||
```
|
||
Impress ASR Input.exe
|
||
```
|
||
|
||
或命令行模式:
|
||
```
|
||
node dist/main.js start
|
||
```
|