feat: 重构项目以符合 Go 规范,添加 OpenAI 接口适配,优化长文本朗读功能(切割后合并)
This commit is contained in:
16
internal/models/tts.go
Normal file
16
internal/models/tts.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
// TTSRequest 表示一个语音合成请求
|
||||
type TTSRequest struct {
|
||||
Text string `json:"text"` // 要转换的文本
|
||||
Voice string `json:"voice"` // 语音ID
|
||||
Rate string `json:"rate"` // 语速 (-100% 到 +100%)
|
||||
Pitch string `json:"pitch"` // 语调 (-100% 到 +100%)
|
||||
}
|
||||
|
||||
// TTSResponse 表示一个语音合成响应
|
||||
type TTSResponse struct {
|
||||
AudioContent []byte `json:"audio_content"` // 音频数据
|
||||
ContentType string `json:"content_type"` // MIME类型
|
||||
CacheHit bool `json:"cache_hit"` // 是否命中缓存
|
||||
}
|
||||
14
internal/models/voice.go
Normal file
14
internal/models/voice.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package models
|
||||
|
||||
// Voice 表示一个语音合成声音
|
||||
type Voice struct {
|
||||
Name string `json:"name"` // 语音唯一标识符
|
||||
DisplayName string `json:"display_name"` // 语音显示名称
|
||||
LocalName string `json:"local_name"` // 本地化名称
|
||||
ShortName string `json:"short_name"` // 简称,例如 zh-CN-XiaoxiaoNeural
|
||||
Gender string `json:"gender"` // 性别: Female, Male
|
||||
Locale string `json:"locale"` // 语言区域, 如 zh-CN
|
||||
LocaleName string `json:"locale_name"` // 语言区域显示名称,如 中文(中国)
|
||||
StyleList []string `json:"style_list,omitempty"` // 支持的说话风格列表
|
||||
SampleRateHertz string `json:"sample_rate_hertz"` // 采样率
|
||||
}
|
||||
Reference in New Issue
Block a user