2026-05-23 20:32:12 +08:00
|
|
|
|
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
|
2026-06-27 14:09:46 +08:00
|
|
|
|
Model string // v3 声音复刻/语音大模型 子模型版本,复刻音色必填
|
2026-05-23 20:32:12 +08:00
|
|
|
|
URL string
|
|
|
|
|
|
Timeout time.Duration
|
2026-06-27 23:28:35 +08:00
|
|
|
|
Format string // 音频编码格式: mp3/ogg_opus/pcm/wav(wav内部用pcm请求再封装header)
|
|
|
|
|
|
SampleRate int // 采样率: 8000/16000/22050/24000/32000/44100/48000
|
2026-05-23 20:32:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type SynthesisResult struct {
|
|
|
|
|
|
AudioData []byte
|
|
|
|
|
|
ReqID string
|
2026-06-27 23:28:35 +08:00
|
|
|
|
Format string // 实际输出格式,用于设置 Content-Type
|
2026-05-23 20:32:12 +08:00
|
|
|
|
}
|