fix:修复了模型语音问题 #59
@@ -80,7 +80,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化 Orchestrator
|
// 初始化 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 模式
|
// Gin 模式
|
||||||
if cfg.App.Env == "prod" {
|
if cfg.App.Env == "prod" {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ ai:
|
|||||||
tts:
|
tts:
|
||||||
provider: mimo
|
provider: mimo
|
||||||
model: mimo-v2.5-tts
|
model: mimo-v2.5-tts
|
||||||
voice: 冰糖
|
voice: mimo_default
|
||||||
speed: 1.0
|
speed: 1.0
|
||||||
endpoint: "https://token-plan-cn.xiaomimimo.com/v1"
|
endpoint: "https://token-plan-cn.xiaomimimo.com/v1"
|
||||||
api_key: "tp-c9e7scwfx94qvqyhpnahnw8uaiya01za2qzvg4xe24rp3xiv"
|
api_key: "tp-c9e7scwfx94qvqyhpnahnw8uaiya01za2qzvg4xe24rp3xiv"
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func Load() (*Config, error) {
|
|||||||
v.SetDefault("ai.llm.timeout", 10)
|
v.SetDefault("ai.llm.timeout", 10)
|
||||||
v.SetDefault("ai.tts.provider", "openai")
|
v.SetDefault("ai.tts.provider", "openai")
|
||||||
v.SetDefault("ai.tts.model", "tts-1")
|
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.speed", 1.0)
|
||||||
v.SetDefault("ai.tts.endpoint", "https://api.openai.com/v1")
|
v.SetDefault("ai.tts.endpoint", "https://api.openai.com/v1")
|
||||||
v.SetDefault("ai.tts.timeout", 5)
|
v.SetDefault("ai.tts.timeout", 5)
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ type Pipeline struct {
|
|||||||
ttsService tts.Service
|
ttsService tts.Service
|
||||||
sessionMgr session.Manager
|
sessionMgr session.Manager
|
||||||
model string // LLM 模型名,用于 llm_done 上报
|
model string // LLM 模型名,用于 llm_done 上报
|
||||||
|
ttsVoice string // TTS 音色
|
||||||
|
ttsSpeed float64 // TTS 语速
|
||||||
}
|
}
|
||||||
|
|
||||||
// New 创建 Pipeline 实例。
|
// New 创建 Pipeline 实例。
|
||||||
@@ -32,6 +34,8 @@ func New(
|
|||||||
ttsService tts.Service,
|
ttsService tts.Service,
|
||||||
sessionMgr session.Manager,
|
sessionMgr session.Manager,
|
||||||
model string,
|
model string,
|
||||||
|
ttsVoice string,
|
||||||
|
ttsSpeed float64,
|
||||||
) *Pipeline {
|
) *Pipeline {
|
||||||
return &Pipeline{
|
return &Pipeline{
|
||||||
sttService: sttService,
|
sttService: sttService,
|
||||||
@@ -39,6 +43,8 @@ func New(
|
|||||||
ttsService: ttsService,
|
ttsService: ttsService,
|
||||||
sessionMgr: sessionMgr,
|
sessionMgr: sessionMgr,
|
||||||
model: model,
|
model: model,
|
||||||
|
ttsVoice: ttsVoice,
|
||||||
|
ttsSpeed: ttsSpeed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,8 +312,8 @@ func (p *Pipeline) synthesizeTTS(
|
|||||||
log := logger.Log
|
log := logger.Log
|
||||||
|
|
||||||
ttsStream, err := p.ttsService.SynthesizeStream(ctx, sentenceCh, tts.Options{
|
ttsStream, err := p.ttsService.SynthesizeStream(ctx, sentenceCh, tts.Options{
|
||||||
Voice: "alloy",
|
Voice: p.ttsVoice,
|
||||||
Speed: 1.0,
|
Speed: p.ttsSpeed,
|
||||||
OutputFmt: "mp3",
|
OutputFmt: "mp3",
|
||||||
SampleRate: 24000,
|
SampleRate: 24000,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user