Skip to content

fix(ime): 繁中用户语音输入始终输出繁体 / enforce 简繁 script on output (#643)#729

Merged
jiangmuran merged 1 commit into
betafrom
fix/issue-643-traditional-chinese-output
Jun 21, 2026
Merged

fix(ime): 繁中用户语音输入始终输出繁体 / enforce 简繁 script on output (#643)#729
jiangmuran merged 1 commit into
betafrom
fix/issue-643-traditional-chinese-output

Conversation

@jiangmuran

@jiangmuran jiangmuran commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

User description

问题 / Problem

繁體中文使用者每次语音输入都得到简体输出(issue #643)。设置里选了「繁體中文」也没用 —— 这是确认过的已知 bug。

根因 / Root cause

coordinator/dictation.rs::finalize_polished_text 只在 Raw 模式 / polish 失败 时才跑确定性的 OpenCC 简↔繁转换(apply_chinese_script_preference)。polish 成功的模式(light/structured/formal)把字形交给 LLM —— 而中文 LLM 默认输出简体,繁中提示并不可靠。流式插入路径already_streamed)则完全跳过转换。

chineseScriptPreference 默认是 Auto,所以这个 bug 只影响显式选了简/繁的用户。

改动 / Fix

  • finalize_polished_text:非翻译听写始终调用 apply_chinese_script_preferenceAuto 时内部是 no-op(默认用户零影响);Simplified/Traditional 时确定性保证输出字形,不再赌 LLM。
  • streaming_insert_eligible:加入字形偏好参数,非 Auto 时关掉流式插入(流式边出边落字、没有成品可后处理),走一次性路径让 OpenCC 转换生效。
  • 翻译路径不动(目标可能是英/日/韩,OpenCC 会破坏)。

测试 / Tests

  • polish_output_honors_chinese_script_preference:polish 成功路径下,繁体偏好真的把「学习」转成不含简体字、Auto 不转换。
  • streaming_disabled_for_non_auto_script_so_opencc_runs:非 Auto 关流式、Auto 不受影响。
  • 本地 cargo test --lib 470 通过

Closes #643


PR Type

Bug fix, Tests


Description

  • Always enforce Chinese script preference on dictation output

  • Disable streaming insert for non-Auto script preferences

  • Add tests verifying script conversion and streaming eligibility


Diagram Walkthrough

flowchart LR
  A["User dictation"] --> B["LLM polish (may output Simplified)"]
  B -- "Without fix" --> C["Simplified output (bug)"]
  B -- "With fix: OpenCC always runs" --> D["Deterministic Traditional output"]
  A --> E["Streaming insert path"]
  E -- "Non-Auto script? (fix)" --> F["Disabled, go one-shot"]
  F --> D
  E -- "Auto script (default)" --> G["Streaming allowed"]
Loading

File Walkthrough

Relevant files
Bug fix
dictation.rs
Enforce script preference and disable streaming for non-Auto

openless-all/app/src-tauri/src/coordinator/dictation.rs

  • Changed finalize_polished_text to always apply OpenCC script
    conversion for non-translation dictation (previously only on raw mode
    or polish failure)
  • Modified streaming_insert_eligible to disable streaming when script
    preference is non-Auto, ensuring one-shot path runs OpenCC conversion
  • Added tests: polish_output_honors_chinese_script_preference and
    streaming_disabled_for_non_auto_script_so_opencc_runs
+74/-2   

)

Traditional-Chinese users got Simplified output. finalize_polished_text only ran
the deterministic OpenCC conversion for Raw mode / polish failures, leaving
successful polish modes to the LLM — which defaults to Simplified for Chinese.
The streaming-insert path bypassed the conversion entirely.

- finalize_polished_text: for non-translation dictation, always apply
  apply_chinese_script_preference. It is a no-op for ChineseScriptPreference::Auto
  (the default), so zero impact on users who didn't pick a script; for Simplified/
  Traditional it now guarantees the output script instead of trusting the LLM.
- streaming_insert_eligible: gains the script preference and disables streaming
  insert when it is non-Auto, so the one-shot path runs (streaming types live and
  has no finished text to post-process).

Tests: polish_output_honors_chinese_script_preference (S2t actually converts;
Auto is a no-op) + streaming_disabled_for_non_auto_script_so_opencc_runs. 470 lib
tests pass.

Closes #643
@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

643 - Fully compliant

Compliant requirements:

  • Always enforce Chinese script preference on dictation output via OpenCC when not Auto.
  • Disable streaming insert for non-Auto script preferences so that conversion runs.
  • Tests verify both script conversion and streaming disable.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@jiangmuran jiangmuran merged commit 95920a6 into beta Jun 21, 2026
5 checks passed
@jiangmuran jiangmuran deleted the fix/issue-643-traditional-chinese-output branch June 21, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[area] 我是繁體中文使用者,每次使用輸入法時都會跳到簡體輸入法。

1 participant