feat(asr): 火山引擎说话人分离,过滤非主要说话人 - #760
Merged
Merged
Conversation
Open volcengine streaming ASR's `enable_speaker_info` flag so each returned utterance carries a speaker label. Then in the result assembly, group utterances by speaker, pick the one with the longest total speaking time as the "primary speaker", and only concatenate their text — dropping utterances from other speakers (e.g. a colleague interjecting while you dictate). This is a heuristic quick-win for the "only transcribe my voice" request; it does not yet do enrolled voiceprint verification. If no speaker labels are present, behavior is unchanged (all utterances concatenated). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Collaborator
|
@claude 帮我审核一下这个更改和改动,实际的改动是否正确、会不会有影响,以及这个 PR 的质量如何?对于其他模型和其他平台会有影响吗? |
Collaborator
|
! 谁又改我 @ 逻辑了?我要跟他爆了,你信不信? |
Collaborator
|
@jiangmuran |
Collaborator
hhh,我来审一遍吧 |
H-Chris233
requested changes
Jul 5, 2026
H-Chris233
left a comment
Collaborator
There was a problem hiding this comment.
我已完成审核,以下是我的两点建议:
只有 speaker >=2 时才启用过滤。(防止把逻辑搞坏)
主要 speaker 必须占比超过 60%~70%,否则不开启过滤(防止在声音极度混乱情况下造成丢失)
Collaborator
|
@appergb 我要跟你爆了💢我刚审查完请求更改的,你怎么直接合并了? |
Contributor
Author
|
我草这么暴躁是AI吧? |
Collaborator
睁大你眼睛看看我@谁呢? |
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
摘要
开启火山引擎流式 ASR 的
enable_speaker_info选项,让返回的每个 utterance 带说话人标签。然后按说话人分组,取说话时长最长的作为「主要说话人」,只拼接其文本,丢弃其他人(比如听写时旁边同事插话)的片段。这是「只识别我自己的声音」需求的 Quick Win,不是真正的声纹注册验证——后者需要本地 embedding 模型,后续另做。
改动(仅
volcengine.rs,无前端 / IPC / 配置改动)build_first_frame_payload:请求参数加enable_speaker_info: truespeaker的end_time - start_time总和 → 取最大者为主要说话人 → 只拼接该 speaker 的 utterance 文本[asr] speaker filter: primary=..., kept=..., filtered=...,过滤生效时可见不做什么
RawTranscript结构(过滤后的 text 直接体现在 text 字段,无需新增字段)测试
cargo check+tauri build,既有 101 warnings,无新增错误)局限
speaker_0/speaker_1),不等于「已注册用户」PR Type
Enhancement
Description
Enable speaker diarization for Volcengine streaming ASR
Filter utterances to keep only the primary speaker (longest speaking time)
Fall back to all utterances if no speaker labels present
Add logging for speaker filter statistics
Diagram Walkthrough
File Walkthrough
volcengine.rs
Add speaker diarization filtering logicopenless-all/app/src-tauri/src/asr/volcengine.rs
enable_speaker_info: trueto first frame payload