Skip to content

fix(asr): 长录音分段上传,macOS 目标失效时保留转写 - #1416

Merged
H-Chris233 merged 4 commits into
Open-Less:betafrom
daviluisjs:fix/whisper-long-recording-upload
Nov 9, 2026
Merged

H-Chris233 merged 4 commits into
Open-Less:betafrom
daviluisjs:fix/whisper-long-recording-upload

Conversation

@daviluisjs

Copy link
Copy Markdown
Contributor

摘要

让 macOS 上的长录音不再丢失转写结果。未配置分段限制的 Whisper 兼容服务此前会把整段录音作为一个 WAV 上传;Groq 免费版上限 25 MB,约 13 分钟以上的录音会返回 413。另外,插入目标失效时,macOS 既不插入也不复制,转写结果只留在历史记录里。

修复 / 新增 / 改进

  • batch_asr_chunk_limit_ms:服务未配置限制时默认按 10 分钟分段(WAV 约 19.2 MB)。已有的 30 秒规则和用户配置的 chunkDurationMs 保持优先。
  • split_pcm_by_duration:在接近上限的范围内(最多 15 秒,且不超过分段时长的 10%)选择最安静的位置切分,避免切断单词。分段长度不超过上限,拼接后 PCM 不变;能量相同时取最接近上限的位置,原有的等长切分行为不变。
  • insert_final:macOS 上插入目标失效时改为复制到剪贴板,与该分支注释描述的「只复制」一致。

兼容

  • 不包含:mimo / dashscope 自带的分段逻辑;音频压缩;分段失败后的单段重试。
  • 对现有用户 / 本地环境 / 构建流程的影响:10 分钟以内的录音行为不变。超过 10 分钟的录音会发起多次请求。macOS 上目标失效时会覆盖剪贴板,历史记录状态为 CopiedFallback。

测试计划

  • 命令:cargo +1.99.0 test -p openless-core,cargo +1.99.0 check --manifest-path src-tauri/Cargo.toml,对改动的 core 文件运行 rustfmt --check
  • 结果:本地全部通过(基于 beta)。新增测试覆盖 pause 切分、无数据丢失、17 分钟录音的分段小于 25 MB,以及默认限制与用户配置的优先级。
  • 真实验证:在 macOS 上基于 v2.0.1-tauri 应用同样的改动并安装,对一段 17 分钟、此前返回 413 的录音执行历史记录的「重新转录」。Groq 约 4 秒返回完整转写,没有 413;之后的「重新润色」也正常。
  • 未验证:macOS 目标失效时的剪贴板回退只做了编译检查,没有手动复现;未运行 Windows / Linux 构建。
  • 证据路径:无(录音内容为私人数据,不附带)。

🤖 Generated with Claude Code

daviluisjs and others added 2 commits November 8, 2026 16:39
Whisper-compatible providers received the whole recording as one WAV unless
they were on a short allowlist. On Groq's free tier (25 MB) anything past
about 13 minutes failed with 413 and the transcript was lost.

Default to 10-minute chunks (19.2 MB as WAV) when a provider sets no limit,
and end each chunk at the quietest moment before the limit so a split does
not cut a word in two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
insert_final promised a copy-only fallback but only Windows implemented it.
On macOS the finished transcript reached neither the input nor the clipboard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T08:26:28.170559Z b7571d6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@H-Chris233 H-Chris233 self-assigned this Nov 9, 2026
@H-Chris233

Copy link
Copy Markdown
Collaborator

开始审查

Keep the custom OpenAI-compatible provider's zero/blank setting as
whole-clip transcription instead of applying the ten-minute fallback.
Add a regression test with eleven-minute PCM for unset, empty, zero
and null advanced configuration.
Use fixed-size sample chunks and repeat_n so the Linux and isolated iOS
Core lint checks pass with warnings treated as errors.
@H-Chris233
H-Chris233 force-pushed the fix/whisper-long-recording-upload branch from 4cdc449 to b7571d6 Compare November 9, 2026 08:22
@H-Chris233
H-Chris233 merged commit 1f05745 into Open-Less:beta Nov 9, 2026
15 checks passed
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.

2 participants