// Package asr 流式识别 Provider 抽象:网关只依赖此接口,gummy / volcano / mock 可切换。 package asr import "context" type SessionConfig struct { SampleRate int // SessionID 仅用于日志关联 SessionID string } type Result struct { Text string IsFinal bool // EndTimeMs Provider 报告的本句结束时间(相对会话起点,毫秒);0=未提供。 // 网关用它与实收帧累计时长做计量交叉校验。 EndTimeMs int64 // Err 非空表示会话级错误,随后 Results 通道关闭 Err error } type Session interface { // SendAudio 推一帧 PCM(100ms / 3200B) SendAudio(pcm []byte) error // Results 识别结果通道;会话结束(Close 或上游完成)后关闭 Results() <-chan Result // Close 结束会话:要求上游 flush 尾部音频并下发最终 final 后关闭通道 Close() error } type Provider interface { Name() string StartSession(ctx context.Context, cfg SessionConfig) (Session, error) }