feat: 更新配置文档
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user