feat: 更新配置文档

This commit is contained in:
hhs
2026-06-13 19:57:35 +08:00
parent f764b3a7d8
commit 0d9d3db73b
12 changed files with 83 additions and 34 deletions

View File

@@ -15,6 +15,7 @@ import (
// OpenAIService 基于 OpenAI TTS API 的语音合成实现。
type OpenAIService struct {
apiKey string
model string
voice string
speed float64
endpoint string
@@ -24,7 +25,10 @@ type OpenAIService struct {
}
// NewOpenAIService 创建 OpenAI TTS 服务。
func NewOpenAIService(apiKey, voice, endpoint string, speed float64, timeoutSec int, logger *zap.SugaredLogger) *OpenAIService {
func NewOpenAIService(apiKey, model, voice, endpoint string, speed float64, timeoutSec int, logger *zap.SugaredLogger) *OpenAIService {
if model == "" {
model = "tts-1"
}
if voice == "" {
voice = "alloy"
}
@@ -40,6 +44,7 @@ func NewOpenAIService(apiKey, voice, endpoint string, speed float64, timeoutSec
}
return &OpenAIService{
apiKey: apiKey,
model: model,
voice: voice,
speed: speed,
endpoint: endpoint,
@@ -109,7 +114,7 @@ func (o *OpenAIService) synthesize(ctx context.Context, text, voice string, spee
defer cancel()
body := ttsRequest{
Model: "tts-1",
Model: o.model,
Input: text,
Voice: voice,
ResponseFormat: "mp3",