fix(voice): 改用火山「新版控制台」API Key 鉴权(ASR 握手真机验通✅)
一直误用旧版 5 头方案(X-Api-App-Key+Access-Key+App-ID),火山始终 401 grant not found。 用户提供官方文档「新版本控制台」证实:新版只需**单个 X-Api-Key** 头。改对后真机联调: - frame.go setVolcAuthHeaders: X-Api-Key + X-Api-Resource-Id + X-Api-Request-Id + X-Api-Sequence:-1 (删旧 App-Key/Access-Key/App-ID/Connect-Id;去 appID 参数) - asr/tts 调用点同步;config.go 删 Config.AppID;voicecheck/voiceconfig 删 VOLC_APP_ID - 删临时诊断工具 voiceprobe 真机结果:ASR 握手✅(volc.bigasr.sauc.duration 有效);TTS 用 seed-tts-2.0 会话正常建立 (不再 resource mismatch),但暂无音频返回→双向 TTS 事件/payload 待调(下一步)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// 火山「双向流式 TTS V3」客户端(seed-tts-2.0)。边推文字边收音频,配 LLM token 流做连续朗读。
|
||||
// 帧协议见 tts_frame.go;鉴权走**新版 API Key**(X-Api-Access-Key + 固定 App Key + App ID,见 frame.go)。
|
||||
// 帧协议见 tts_frame.go;鉴权走**新版控制台 API Key**(单个 X-Api-Key,见 frame.go)。
|
||||
//
|
||||
// 一轮朗读的生命周期:StartTTS(连接+StartSession) → Speak(逐句推文字/事件200) → Finish(FinishSession)
|
||||
// → 客户端 range Audio() 收音频直到 channel 关闭 → Close()。一个 TTSSession = 一次 Agent 回答。
|
||||
@@ -58,7 +58,7 @@ func StartTTS(ctx context.Context, cfg Config) (*TTSSession, error) {
|
||||
return nil, fmt.Errorf("TTS 未配置")
|
||||
}
|
||||
hdr := http.Header{}
|
||||
setVolcAuthHeaders(hdr, cfg.APIKey, cfg.AppID, cfg.TTSResourceID)
|
||||
setVolcAuthHeaders(hdr, cfg.APIKey, cfg.TTSResourceID)
|
||||
|
||||
dialer := websocket.Dialer{HandshakeTimeout: 10 * time.Second}
|
||||
conn, resp, err := dialer.DialContext(ctx, ttsEndpoint, hdr)
|
||||
|
||||
Reference in New Issue
Block a user