diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index 0b1e8d8..01a9b8e 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -80,7 +80,7 @@ func main() { } // 初始化 Orchestrator - orch := orchestrator.New(sttService, llmService, ttsService, sessionMgr, cfg.AI.LLM.Model) + orch := orchestrator.New(sttService, llmService, ttsService, sessionMgr, cfg.AI.LLM.Model, cfg.AI.TTS.Voice, cfg.AI.TTS.Speed) // Gin 模式 if cfg.App.Env == "prod" { diff --git a/backend/config.yaml b/backend/config.yaml index d61dc4b..6e427d1 100644 --- a/backend/config.yaml +++ b/backend/config.yaml @@ -28,7 +28,7 @@ ai: tts: provider: mimo model: mimo-v2.5-tts - voice: 冰糖 + voice: mimo_default speed: 1.0 endpoint: "https://token-plan-cn.xiaomimimo.com/v1" api_key: "tp-c9e7scwfx94qvqyhpnahnw8uaiya01za2qzvg4xe24rp3xiv" diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go index 1a5cac8..04f581a 100644 --- a/backend/internal/config/config.go +++ b/backend/internal/config/config.go @@ -109,7 +109,7 @@ func Load() (*Config, error) { v.SetDefault("ai.llm.timeout", 10) v.SetDefault("ai.tts.provider", "openai") v.SetDefault("ai.tts.model", "tts-1") - v.SetDefault("ai.tts.voice", "alloy") + v.SetDefault("ai.tts.voice", "mimo_default") v.SetDefault("ai.tts.speed", 1.0) v.SetDefault("ai.tts.endpoint", "https://api.openai.com/v1") v.SetDefault("ai.tts.timeout", 5) diff --git a/backend/internal/orchestrator/pipeline.go b/backend/internal/orchestrator/pipeline.go index d8d2823..fd84c68 100644 --- a/backend/internal/orchestrator/pipeline.go +++ b/backend/internal/orchestrator/pipeline.go @@ -23,6 +23,8 @@ type Pipeline struct { ttsService tts.Service sessionMgr session.Manager model string // LLM 模型名,用于 llm_done 上报 + ttsVoice string // TTS 音色 + ttsSpeed float64 // TTS 语速 } // New 创建 Pipeline 实例。 @@ -32,6 +34,8 @@ func New( ttsService tts.Service, sessionMgr session.Manager, model string, + ttsVoice string, + ttsSpeed float64, ) *Pipeline { return &Pipeline{ sttService: sttService, @@ -39,6 +43,8 @@ func New( ttsService: ttsService, sessionMgr: sessionMgr, model: model, + ttsVoice: ttsVoice, + ttsSpeed: ttsSpeed, } } @@ -306,8 +312,8 @@ func (p *Pipeline) synthesizeTTS( log := logger.Log ttsStream, err := p.ttsService.SynthesizeStream(ctx, sentenceCh, tts.Options{ - Voice: "alloy", - Speed: 1.0, + Voice: p.ttsVoice, + Speed: p.ttsSpeed, OutputFmt: "mp3", SampleRate: 24000, })