feat(asr): 百炼 ASR 支持 fun-asr-flash 并统一三协议为单一入口#793
Open
bigsongeth wants to merge 1 commit into
Open
Conversation
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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
摘要
让阿里云百炼(DashScope)三种 ASR 协议都能用、并收成一个用户入口。
百炼同一厂商、同一把 key 下有三种互不兼容的线协议:
fun-asr-realtimeqwen3-asr-flash-realtimefun-asr-flash此前只有前两个,且各是独立 provider、独立 key;
fun-asr-flash是唯一的 HTTP 批量协议,现有两条 WS 通道都接不了 → 用不了。本 PR 补齐第三条通道,并把三条收成一个「阿里云百炼」入口、按模型名自动路由协议。修复 / 新增 / 改进
asr/dashscope_multimodal.rs:multimodal-generation 批量 ASR 客户端(攒 PCM → WAV → base64 → POST → 多路径兜底解析响应),复用 mimo 的分片/CJK 拼接。ActiveAsrProviderKind单一来源,preflight_credential/configured_fields等改为穷尽match(去掉静默 else 兜底),新增通道时编译器强制补齐各分发点,消除「装完才发现某处漏了」。resolve_effective_asr_provider(model)按模型名把 build / 验证 路由到对应协议,endpoint 按协议自动推导;模型框下加实时 / 录音文件协议提示。兼容
bailian(fun-asr-realtime)用户无感,默认仍走经典实时;bailian-qwen3-realtime保留为隐藏别名,老配置照常工作(下拉仅对已在用者显示);bailian-fun-asr-flash为本 PR 新增(此前无用户);split_pcm_by_duration/join_transcript_chunks提为pub(crate)供复用(零行为改动);无新增依赖。测试计划
cargo test --lib→ 结果:610 passed(对beta基线);新增resolve_effective_asr_provider/preflight_credential/configured_fields/ dashscope 客户端等单测。cargo check(macOS native)+ 前端tsc(npm run build)→ 均通过(对beta基线);跨平台 Android/Win/Linux 未加 cfg 分支,交 CI 确认。fun-asr-flash-2026-06-15multimodal-generation(URL 与 base64 两种输入)→ HTTP 200、转写正确、~600ms。PR Type
Enhancement, Tests
Description
Add
fun-asr-flashbatch ASR via multimodal-generation HTTP APIRefactor provider dispatch to
ActiveAsrProviderKindenum with exhaustive matchUnify three Bailian ASR protocols into a single UI entry with automatic model routing
Add i18n and model type hints for realtime vs recorded-file modes
Diagram Walkthrough
File Walkthrough
8 files
Add new HTTP batch ASR client for fun-asr-flashExport new DashScopeMultimodalASR moduleAdd validation and model listing for unified Bailian ASRAdd DashScopeMultimodal variant and model routing logicRoute session start for new batch ASR providerHandle DashScopeMultimodal in QA sessionsAdd cancel support for new ASR variantUnify three Bailian entries and add protocol hints5 files
Make split and join functions pub(crate) for reuseRefactor credentials check using ActiveAsrProviderKindRefactor build and credential check for new provider kindUse ASR_PRESETS for provider name mappingExtract ASR_PRESETS as single source of truth5 files
Add translation keys for unified Bailian ASRAdd Japanese translation for new ASR entryAdd Korean translation for new ASR entryAdd Chinese translation for unified Bailian ASRAdd Traditional Chinese translation for new ASR entry