Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Windows build & installer

on:
push:
branches: [master, main]
tags: ['v*']
pull_request:
branches: [master, main]
workflow_dispatch:

# `contents: write` is needed for the tag-driven release step (the default
# GITHUB_TOKEN has read-only contents permission and would 403 on POST
# /repos/:owner/:repo/releases).
permissions:
contents: write

# Cancel in-flight runs on the same ref when a new push lands.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: windows-latest
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.41.9'
channel: stable
cache: true

- name: Show Flutter version
run: flutter --version

- name: Enable Windows desktop
run: flutter config --enable-windows-desktop --no-analytics

- name: Install dependencies
run: flutter pub get

- name: Run code generation
run: dart run build_runner build --delete-conflicting-outputs

- name: Build Windows release
run: flutter build windows --release

# GitHub-hosted windows-latest runners ship with Inno Setup 6.
# Add it to PATH so we can call ISCC by name.
- name: Add Inno Setup to PATH
shell: pwsh
run: |
$iscc = "C:\Program Files (x86)\Inno Setup 6"
if (-not (Test-Path $iscc)) {
choco install innosetup --no-progress -y
}
Add-Content -Path $env:GITHUB_PATH -Value $iscc

- name: Read app version from pubspec
id: pubspec
shell: pwsh
run: |
$line = (Get-Content pubspec.yaml | Where-Object { $_ -match '^version:' })
$version = ($line -replace 'version:\s*','').Trim().Split('+')[0]
if ([string]::IsNullOrWhiteSpace($version)) { $version = '0.0.0' }
Write-Host "Version: $version"
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8

- name: Build installer
shell: pwsh
run: |
iscc.exe `
"/DMyAppVersion=${{ steps.pubspec.outputs.version }}" `
installer\zerotype.iss

- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: ZeroType-Setup-${{ steps.pubspec.outputs.version }}
path: installer/Output/*.exe
if-no-files-found: error
retention-days: 30

# On tag push (vX.Y.Z), publish a GitHub Release with the installer.
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: installer/Output/*.exe
draft: false
prerelease: false
generate_release_notes: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.claude/
.idea/
*.dmg
installer/Output/

### Dart ###
# See https://www.dartlang.org/guides/libraries/private-files
Expand Down
104 changes: 92 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@
## ✨ 功能特色

### 🎙️ 全局快捷鍵錄音
- 自訂全局快捷鍵(預設 `⌥ Option + Space`),在任何應用程式中觸發錄音
- 自訂全局快捷鍵(macOS 預設 `⌥ Option + Space`、Windows 預設 `Alt + Space`),在任何應用程式中觸發錄音
- 錄音中顯示浮動音波 Overlay,提供即時視覺回饋
- 按下 `Esc` 或點擊取消按鈕可中止錄音

### 🧠 AI 驅動的語音辨識
- 支援 **OpenAI**(`gpt-4o-transcribe`)與 **Google Gemini**(`gemini-*`)兩大語音辨識後端
- 辨識完成後,結果自動貼至游標所在位置(模擬 `⌘V`)
- 支援 **OpenAI**(`gpt-4o-transcribe`)、**Google Gemini**(`gemini-*`)、以及 **LiteLLM Proxy** 三大後端
- LiteLLM 模式會自動從 proxy 的 `/v1/models` 抓取可用模型清單,動態選用 Whisper / Gemini / Claude / GPT-4o-audio 等模型
- 辨識完成後,結果自動貼至游標所在位置(macOS 模擬 `⌘V`、Windows 模擬 `Ctrl+V`)
- 支援自訂 API Endpoint(可使用 OpenAI-compatible 的第三方服務)

### ✨ 文字優化(可選)
- 轉錄完成後,可選擇再丟給聊天模型(GPT / Claude / Gemini)做格式化、錯字修正、條列整理
- 優化的 provider / model / prompt 完全獨立,可以「便宜模型轉錄、聰明模型優化」
- 設定頁有獨立 toggle 控制是否啟用,預設關閉

### 🇹🇼 針對繁體中文深度優化的提示詞
內建的轉錄提示詞針對台灣使用情境做了以下優化:

Expand Down Expand Up @@ -48,40 +54,87 @@
## 🔧 使用前準備

### 系統需求
- macOS 11.0+
- **macOS 11.0+**,或 **Windows 10 / 11 (x64)**
- Flutter 3.x(如需自行 build)

### 必要系統授權
1. **麥克風** — 錄音所需
2. **輔助使用(Accessibility)** — 模擬鍵盤輸入(`⌘V` 貼上)所需
1. **麥克風** — 錄音所需(Windows 第一次按 Alt+Space 時會跳系統權限請求)
2. **輔助使用(Accessibility)** — macOS 模擬鍵盤輸入(`⌘V` 貼上)所需。**Windows 不需要此權限**,使用 SendInput API 直接送 Ctrl+V

### API Key
前往以下任一服務申請 API Key:
- [OpenAI](https://platform.openai.com/api-keys)(支援 Transcribe 語音辨識
前往以下任一服務申請 API Key(或使用你自己的 LiteLLM proxy)
- [OpenAI](https://platform.openai.com/api-keys)(支援 Transcribe / Whisper / GPT-4o-audio
- [Google AI Studio](https://aistudio.google.com/app/apikey)(支援 Gemini 多模態)
- 自架 [LiteLLM Proxy](https://github.com/BerriAI/litellm)(一個 endpoint 串接所有 LLM)

---

## 🚀 快速開始

### 方法一:直接下載(推薦)

1. 前往 [Releases](https://github.com/your-username/zerotype/releases) 頁面下載最新的 `.dmg`
#### macOS

1. 前往 [Releases](https://github.com/alarmz/ZeroType/releases) 頁面下載最新的 `.dmg`
2. 開啟 `.dmg` 並將 **ZeroType.app** 拖入 Applications 資料夾
3. 首次執行時,依照提示授予以下權限:
- **麥克風** — 語音輸入所需
- **輔助使用(Accessibility)** — 模擬鍵盤貼上所需
4. 在 App 內的「模型設定」填入你的 API Key,即可開始使用

#### Windows

1. 從 [Releases](https://github.com/alarmz/ZeroType/releases/latest) 下載 `ZeroTypeSetup-x.y.z.exe`
2. 雙擊執行安裝程式:
- **第一頁**會中英對照解釋兩種安裝模式(管理員 vs 一般使用者)
- 按下一步時 Windows 跳 UAC:
- 按「**是**」(管理員模式)→ 裝到 Program Files、自動允許麥克風存取、可勾選開機自動啟動
- 按「**否**」(一般使用者)→ 裝到 `%LOCALAPPDATA%\Programs\ZeroType`、不會自動寫入系統設定(你需要手動到 Windows Settings → Privacy → Microphone 允許)
3. 安裝完成後 ZeroType 會自動啟動
4. 在「模型」頁填入 API Key 與選擇模型,按 `Alt+Space` 即可開始

### 方法二:從原始碼 Build(進階)

```bash
git clone https://github.com/your-username/zerotype.git
cd zerotype
git clone https://github.com/alarmz/ZeroType.git
cd ZeroType
flutter pub get
dart run build_runner build --delete-conflicting-outputs

# macOS
flutter run -d macos

# Windows
flutter run -d windows
# 或產生 release exe:
flutter build windows --release
# 產出位置:build/windows/x64/runner/Release/zero_type.exe
```

> **Windows build 需求**:Flutter 3.41+、Visual Studio Build Tools 2022(含 C++ Desktop workload)、Windows 11 SDK、開啟 Developer Mode(symlink 支援)。

---

## 🔌 LiteLLM Proxy 設定

LiteLLM 提供一個 OpenAI-compatible 的代理端點,能統一接 Whisper / Gemini / Claude / OpenAI / Groq 等多家後端。ZeroType 對 LiteLLM 做了原生支援:

1. **「模型」頁** → Provider 選 **LiteLLM**
2. 填入你的 **Proxy Base URL**(例如 `https://litellm.example.com` 或 `http://192.168.x.x:4000`,**不要含 `/v1`**)
3. 填入 LiteLLM **virtual key** 並按儲存
4. 按「選擇模型」右側的 🔄 按鈕 → 程式自動從 `/v1/models` 抓取你 proxy 上所有可用模型
5. 從下拉選單選一個

### 模型支援度

ZeroType 會根據選擇的模型自動走不同 endpoint:

| 模型類型 | Endpoint | 範例 |
|---|---|---|
| 名稱含 `whisper` | `/v1/audio/transcriptions` | `whisper-1`、`groq-whisper-large` |
| 多模態(吃 audio)| `/v1/chat/completions` + `input_audio` | `gemini-2.5-flash-lite`、`claude-haiku-4-5`、`gpt-4o-audio-preview` |
| 純文字模型 | ❌ 不支援 | `gpt-4`、`gpt-5.5`、`claude-haiku-4-5-text` 等

---

## 🌍 語言支援 & 貢獻 (Localization & Contribution)
Expand All @@ -93,7 +146,34 @@ flutter run -d macos

## 📜 版本更新紀錄 (Release Notes)

### [v1.0.2] - 當前版本
### [v1.1.0] - 當前版本(Windows 首發)

**Windows 全平台支援** 🪟
- Windows 10 / 11 原生 desktop app,使用 SendInput 模擬 Ctrl+V 貼上
- 預設熱鍵 `Alt + Space`,UI 自動顯示 Win/Ctrl/Alt/Shift modifier
- 可拖曳的標題列 + min/max/close 視窗按鈕(多螢幕可正常移動)
- WAV 格式錄音(16 kHz mono PCM),相容 OpenAI / Whisper / Gemini / Claude

**LiteLLM Proxy 支援** 🔌
- 新增 LiteLLM provider,自動從 `/v1/models` 抓取模型清單並快取
- 智慧路由:whisper-* 走 `/v1/audio/transcriptions`、其他走 `/v1/chat/completions` 多模態
- 友善的錯誤訊息,當選到不支援 audio 的模型會直接列出可用替代

**文字優化** ✨
- 新增「文字優化」功能,轉錄後再過一層 chat LLM 做格式化/錯字修正
- 獨立的 provider / model / prompt 設定,可在「模型」頁與「提示詞」頁分別配置
- 設定頁 toggle 控制,預設關閉

**Windows installer + CI** 📦
- GitHub Actions 自動 build Windows release,每次 push 都產生 installer artifact
- Inno Setup 安裝程式:admin 模式自動寫麥克風白名單與開機啟動,一般模式則裝到 LocalAppData
- Tag-driven release:push `vX.Y.Z` tag 自動發 GitHub Release

**Logging** 🔎
- 新增檔案 logger 寫到 `%TEMP%\zero_type.log`(macOS: `/tmp/zero_type.log`)
- 浮動圓條顯示完整錯誤訊息(不只「錯誤」兩個字),含 HTTP status + 回應 body

### [v1.0.2]
- **新增歷史紀錄頁** 🎨
- 提供歷史產生逐字稿的紀錄語音檔,並可提供檢視。
- 新增總轉寫次數與總花費(USD)的持久化累計統計。
Expand Down
7 changes: 6 additions & 1 deletion assets/config/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"name": "Gemini 2.5 Flash"
}
]
},
{
"id": "litellm",
"name": "LiteLLM",
"models": []
}
]
}
}
41 changes: 41 additions & 0 deletions installer/install-mode-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
關於安裝模式
==========================================================

ZeroType 支援兩種安裝模式,請依需求選擇下一頁的權限選項:

[管理員模式](建議)
- 安裝到 C:\Program Files\ZeroType(系統範圍)
- 自動將 ZeroType 加入 Windows 麥克風權限白名單
- 自動設定 Windows 啟動時自動執行(如果你勾選該選項)
- 第一次按 Alt+Space 就能直接錄音,不需手動到 Settings 開權限

[一般使用者模式]
- 安裝到 %LOCALAPPDATA%\Programs\ZeroType(僅目前使用者)
- 不會自動寫入麥克風權限與開機啟動設定
- 第一次錄音時,請至「設定 → 隱私權與安全性 → 麥克風」
手動允許 ZeroType 存取麥克風
- 開機自動啟動可在 ZeroType 內的「設定」頁開啟

如何選擇:
- 點下一頁的「下一步」後,會出現 Windows 的權限詢問
(UAC,盾牌圖示):
- 按「是」 → 安裝程式以管理員模式執行(自動設定)
- 按「否」 → 安裝程式以一般使用者模式執行(你自己設定)

About installation modes
==========================================================

ZeroType supports two install modes — pick when prompted by Windows:

[Administrator mode] (recommended)
- Installs to C:\Program Files\ZeroType (system-wide)
- Automatically allow-lists ZeroType for microphone access
- Automatically registers Windows startup launch (if checked)
- Alt+Space works on first try with no extra setup

[Standard user mode]
- Installs to %LOCALAPPDATA%\Programs\ZeroType (this user only)
- Does NOT auto-configure microphone or startup launch
- You'll need to manually approve microphone access in
Settings → Privacy → Microphone the first time
- Launch-at-startup can be enabled inside ZeroType's Settings page
Loading