接入百炼 DashScope 实时 ASR#385
Merged
Merged
Conversation
百炼传统实时识别协议可以直接消费 OpenLess 已有的 16 kHz mono PCM,所以新增独立 ASR provider 并复用现有 DeferredAsrBridge / coordinator 会话状态机,而不是引入另一条录音链路。Settings 侧增加百炼选项、默认北京 endpoint、默认 fun-asr-realtime 模型,并允许填写可选 vocabulary_id 下发已创建的百炼热词表。 Constraint: issue Open-Less#384 要求接入百炼 DashScope 实时 ASR,并保持北京/新加坡 endpoint 可配置。 Constraint: 凭据仍必须走系统凭据库,新增 asr.vocabulary_id 只作为 active ASR provider 的可选 provider 设置。 Rejected: 同时实现 qwen3-asr-flash OpenAI Realtime 协议 | 协议和结果事件不同,超出最小更改范围。 Rejected: 自动从本地词汇表创建百炼热词表 | 需要远端资源生命周期和用户确认,不能静默替用户管理供应商资源。 Confidence: high Scope-risk: moderate Directive: 百炼 provider 当前走传统 /api-ws/v1/inference 协议;不要把 qwen realtime 事件格式混进同一实现。 Tested: cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml Tested: cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib Tested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml Tested: cd openless-all/app && npm run build Not-tested: 需要真实 DashScope API Key 和麦克风环境才能完成线上 macOS dictation 验证。 Related: Open-Less#384 Co-authored-by: OmX <omx@oh-my-codex.dev>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
PR Reviewer Guide 🔍(Review updated until commit 0a2b6bd)Here are some key observations to aid the review process:
|
Bailian startup stores the ASR instance before opening the remote session so recorder startup audio can be buffered. If the websocket setup then fails in the active startup path, the provider must be cancelled before the coordinator returns to idle. The partial-result fallback remains intentional and is now documented as matching the existing Volcengine no-loss behavior.\n\nConstraint: OpenLess ASR paths prefer not losing already recognized user speech.\nRejected: Treat every websocket close with partial text as failure | would diverge from Volcengine fallback semantics.\nConfidence: high\nScope-risk: narrow\nTested: cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml\nTested: cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib\nTested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Persistent review updated to latest commit 00f150a |
Bailian uses Notify::notify_waiters when the remote task starts. send_last_frame must register the Notified future before checking the started flag so a task-started event cannot land between the check and waiter registration.\n\nConstraint: DashScope stop should not falsely time out when task-started races with user stop.\nRejected: Replace Notify with polling | broader and less direct than the Tokio enable pattern.\nConfidence: high\nScope-risk: narrow\nTested: cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml\nTested: cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib asr::bailian::tests\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Persistent review updated to latest commit 0a2b6bd |
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
变更概览
wss://dashscope.aliyuncs.com/api-ws/v1/inference/,直接消费现有 16 kHz mono PCM。task-started后再补发缓存音频;结束时发送finish-task并等待最终结果。fun-asr-realtime,endpoint 可手动改为新加坡等地址。asr.vocabulary_id字段,用于下发已在百炼侧创建的热词表 ID;不自动创建/管理远端热词资源。取舍说明
qwen3-asr-flash-realtime的 OpenAI Realtime 协议;后者事件和音频提交格式不同,适合单独 provider。vocab-...ID。验证
cargo check --manifest-path openless-all/app/src-tauri/Cargo.tomlcargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --libcargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.tomlcd openless-all/app && npm run build未验证
Closes #384
PR Type
Enhancement, Tests
Description
Added new Bailian Realtime ASR provider (
bailian.rs) implementing DashScope WebSocket protocol.Integrated provider into coordinator dictation lifecycle with deferred audio bridging.
Extended credential schema and UI settings for endpoint, model, and optional vocabulary ID.
Added English, Japanese, Korean, Simplified/Traditional Chinese i18n labels.
Included unit tests for credentials normalization, message building, and audio chunking.
Diagram Walkthrough
File Walkthrough
8 files
Implement Bailian DashScope realtime ASR clientExpose Bailian module and public typesAdd bailian provider validation and model listingIntegrate bailian credential reading into coordinatorHandle dictation session lifecycle for bailian ASRCancel bailian ASR on active ASR cleanupMap bailian ASR provider in overview pageAdd bailian ASR preset and settings UI1 files
Persist vocabulary_id in credentials store5 files
English localization for bailian ASR UIJapanese localization for bailian ASR UIKorean localization for bailian ASR UISimplified Chinese localization for bailian ASR UITraditional Chinese localization for bailian ASR UI