From eb7ebecfc07b7dd822d16cfe0a98e7ff88bc19c9 Mon Sep 17 00:00:00 2001 From: cfy666 <3087823110@qq.com> Date: Sun, 14 Jun 2026 11:12:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E8=AF=AD=E9=9F=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/cmd/server/main.go | 2 +- backend/config.yaml | 2 +- backend/internal/config/config.go | 2 +- backend/internal/orchestrator/pipeline.go | 10 ++++++++-- 4 files changed, 11 insertions(+), 5 deletions(-) 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, })