feat(voice): 阿里百炼 STT/TTS 主链路接通(base64 STT + cosyvoice TTS按voice_id + REST /audio/* + voice_input.deviceId)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- voice/dashscope.go 新建:DashscopeSTT(qwen-audio-3.0-asr-flash, base64 data URI→text) + DashscopeTTS(cosyvoice 按 voice_id, 取非流式 24h URL 下载字节)
- cloud.go newDashboardSTT/TTS 由空 endpoint stub 改为真实百炼 adapter
- chain.go gating 从 DashscopeAPIKey!="" 改为 voiceConfigured(cfg); silent 兜底保留
- config.VoiceConfig 扩展 DASHSCOPE_BASE_URL/VOICE_STT_*/VOICE_TTS_* 字段(必填 DASHSCOPE_API_KEY)
- gateway: POST /api/v1/audio/{transcribe,speech} (owner+审计+MaxBytesReader); voiceInputRequest 增 deviceId 并透传 runner.Run
- 实测: cosyvoice-v3.5-plus+longxiaochun 回 418(引擎拒绝), 改用 cosyvoice-v3-flash+longxiaochun_v3; TTS 你好我是昔涟->106124B wav -> STT 回 你好我是西联, 链返回真实字节/文本
- 单测: dashscope_test/config voice defaults/gateway audio_test; go build/vet/test 全绿
- 声音复刻(响昔涟音色)待公网参考音频; 不做 create_voice
This commit is contained in:
Aska committed 2026-09-08 06:06:02 +08:00
1 parent d8044763ac
commit 73dabb9dde
13 files changed
+1070 -15

No files matched your search

+5 -6
View File
@@ -201,16 +201,15 @@ func discardLogger() *slog.Logger {
return slog.New(slog.NewTextHandler(io.Discard, nil))
}
// newDashboardSTT returns the cloud STT for a config. The endpoint is an
// adaptation point and is empty until config gains a voice URL; a call then
// returns ErrNotConfigured and the chain degrades.
// newDashboardSTT returns the cloud STT adapter for a DashScope config. A call
// returns ErrNotConfigured when no API key is set so the chain degrades.
func newDashboardSTT(cfg config.VoiceConfig) STT {
return NewHTTPSTT("", cfg.DashscopeAPIKey)
return NewDashscopeSTT(cfg)
}
// newDashboardTTS returns the cloud TTS for a config.
// newDashboardTTS returns the cloud TTS adapter for a DashScope config.
func newDashboardTTS(cfg config.VoiceConfig) TTS {
return NewHTTPTTS("", cfg.DashscopeAPIKey)
return NewDashscopeTTS(cfg)
}
// newEdgeTTS returns the edge-tts adapter point (not yet implemented).