重构了火山TTS的适配器与配置逻辑,移除了格式、采样率、model等可配置项,固定使用wav/24000Hz参数,简化请求流程并删除冗余的格式转换、WAV头拼装逻辑,同时更新文档与环境变量配置。
42 lines
987 B
Go
42 lines
987 B
Go
package dto
|
|
|
|
import "time"
|
|
|
|
type OpenAITTSRequest struct {
|
|
Model string `json:"model"`
|
|
Input string `json:"input"`
|
|
Voice string `json:"voice"`
|
|
ResponseFormat string `json:"response_format,omitempty"`
|
|
Speed float64 `json:"speed,omitempty"`
|
|
}
|
|
|
|
type V3TTSResponse struct {
|
|
ReqID string `json:"reqid"`
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
Event string `json:"event"`
|
|
Sequence int `json:"sequence"`
|
|
Data string `json:"data"`
|
|
Sentence string `json:"sentence,omitempty"`
|
|
IsFinal bool `json:"is_final"`
|
|
Usage *V3Usage `json:"usage,omitempty"`
|
|
}
|
|
|
|
type V3Usage struct {
|
|
TextWords int `json:"text_words"`
|
|
}
|
|
|
|
type ByteDanceTTSConfig struct {
|
|
ApiKey string
|
|
ResourceId string
|
|
Speaker string
|
|
URL string
|
|
Timeout time.Duration
|
|
}
|
|
|
|
type SynthesisResult struct {
|
|
AudioData []byte
|
|
ReqID string
|
|
Format string // 实际输出格式,用于设置 Content-Type
|
|
}
|