feat(realtime): bind versioned ASR/TTS profiles to turns - #247
Draft
jinyu918 wants to merge 11 commits into
Draft
Conversation
Go coverage
Base branch: dev · Commit: 01347f1 · Test workflow run |
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.
背景
为支持按语言对选择固定的 ASR/TTS Profile,实时服务需要将 Provider 选择从进程级默认配置下沉为会话级 binding,并在 Turn 开始时冻结该选择。
本 PR 实现方案中的阶段 3 运行时边界:默认语言对的 binding 准备、按语言配置版本获取 Turn 快照,以及 ASR/TTS/Voice 对该快照的使用。
本次改动
新增
BindingCoordinator,以会话和语言配置版本为维度管理TurnSpeechBinding。RouteResolver解析语言对路由。ProviderRegistry按 Profile ID 获取已构造的 ASR/TTS Adapter。AcquireForTurn只接受与当前 Turn 语言配置版本完全一致的 binding,不会回退到旧 Profile。在注入 speech binding coordinator 时,
runtime.Manager.Start会在打开音频输入前:扩展
TurnContext,在 Turn 打开时获取不可变的 ASR/TTS binding,并在 ASR、翻译、TTS 和播放完成后释放 lease。将 Pipeline 切换为使用 Turn binding:
扩展内部
FinalTurnEvent,可选携带asr_profile_id与tts_profile_id。VoiceTurn与 OpenAPI schema 不暴露内部 Profile ID。行为保证
不在本 PR 范围
BindingCoordinator。language.config.changedOutbox/Valkey 事件,以及语言切换后的异步 binding 准备与 CAS 提升。验证
cd services/realtime-audio && go test ./...cd packages/contracts && go test ./...git diff --check 80e4f86..HEAD覆盖了版本冲突与迟到结果、pending preparation、会话关闭、启动失败关闭、Turn 使用绑定的 ASR/TTS/Voice、FinalTurn Profile ID 以及公开 schema 隔离。
前置 PR
相关issue