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:
Blizzard
2026-07-22 10:42:36 +08:00
parent c5397438d4
commit d6c1a787f4
6 changed files with 16 additions and 26 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ import (
)
// 火山引擎 V3 大模型流式语音识别(SeedASR / SAUC)客户端。协议见 voice/frame.go 与 voice-jarvis 记忆。
// 端点固定;鉴权走**新版 API Key**X-Api-Access-Key + 固定 App Key + App ID,见 frame.go)。
// 端点固定;鉴权走**新版控制台 API Key**单个 X-Api-Key,见 frame.go)。
const asrEndpoint = "wss://openspeech.bytedance.com/api/v3/sauc/bigmodel"
@@ -91,7 +91,7 @@ func StartASR(ctx context.Context, cfg Config, uid string) (*ASRSession, error)
return nil, fmt.Errorf("ASR 未配置")
}
hdr := http.Header{}
setVolcAuthHeaders(hdr, cfg.APIKey, cfg.AppID, cfg.ASRResourceID)
setVolcAuthHeaders(hdr, cfg.APIKey, cfg.ASRResourceID)
dialer := websocket.Dialer{HandshakeTimeout: 10 * time.Second}
conn, resp, err := dialer.DialContext(ctx, asrEndpoint, hdr)