fix(asr): 修复 Windows 本地长语音只识别前段#769
Merged
Merged
Conversation
Contributor
PR Reviewer Guide 🔍(Review updated until commit 251c8a5)Here are some key observations to aid the review process:
|
Contributor
|
Persistent review updated to latest commit 3f2c6a4 |
H-Chris233
previously approved these changes
Jul 12, 2026
Contributor
|
Persistent review updated to latest commit 251c8a5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
摘要
修复 Windows 本地 ASR 在长语音场景下可能只识别前一段的问题。
主要原因是
foundry-local-whisper使用 Whisper 系模型,单次解码窗口约 30 秒;当录音超过这个窗口时,单次把整段 WAV 交给 Foundry SDK 可能只返回前段结果。这个 PR 将 Foundry Local Whisper 的 PCM 输入按 30 秒分片转写,再合并分片文本;同时把 Windows 本地 ASR 的转写超时从固定 30 秒改为按音频时长动态增长。未关联 issue。
修复 / 新增 / 改进
foundry-local-whisper录音结束后按 30 秒 PCM chunk 分片,逐段生成临时 WAV 并调用 Foundry SDK。buffer_duration_ms(),coordinator 可按实际录音长度计算 timeout。max(30s, ceil(audio_s) + 20s),避免长音频撞固定 30 秒超时。兼容
不包含:
对现有用户 / 本地环境 / 构建流程的影响:
foundry-local-whisper下会拆成多段本地识别,整体耗时会随音频长度增加,但可以覆盖完整录音。sherpa-onnx-local仅调整 timeout 预算,不改变识别输入和模型调用方式。测试计划
命令:
cargo test结果:本地 Rust 单测通过,
546 passed; 0 failed证据路径:本地终端运行结果
命令:fork 上的 GitHub Actions CI
结果:通过
证据路径:https://github.com/Duyi-Wang/openless/actions/runs/28922670487
命令:fork 上的桌面安装包构建
Release Tauri (cross-platform)结果:通过
证据路径:https://github.com/Duyi-Wang/openless/actions/runs/28922670561
命令:fork 上的 Android APK 构建
结果:通过
证据路径:https://github.com/Duyi-Wang/openless/actions/runs/28922670488
PR Type
Bug fix, Enhancement, Tests
Description
Chunk Foundry Local Whisper PCM into 30s windows for transcription
Dynamically compute transcription timeout based on audio length
Align native runtime versions and implement atomic replacement
Add buffer_duration_ms and remaining-timeout helpers with tests
File Walkthrough
2 files
Add runtime version manifest and atomic replace logicAdd buffer_duration_ms method to Sherpa provider5 files
Implement PCM chunking and per-chunk transcriptionExpose chunk-split and join functions for reuseUnify Windows local ASR dynamic timeout calculationUse dynamic timeout for Foundry/Sherpa in dictationUse dynamic timeout for Foundry/Sherpa in QA sessions1 files
Pin foundry-local-sdk to version 1.2.1