Files
team-api/relaykit/dto/audio.go
T
Qian 2ef5a40c26 新的调度方式 (#14)
重构模型渠道调度系统
2026-08-01 22:55:08 +08:00

54 lines
2.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import "encoding/json"
// AudioRequest TTS/STT/翻译统一请求结构
type AudioRequest struct {
Model string `json:"model"`
Input string `json:"input,omitempty"` // TTS 输入文本
Voice string `json:"voice,omitempty"` // TTS 语音(alloy/echo/fable/onyx/nova/shimmer)
Instructions string `json:"instructions,omitempty"` // TTS 指令
ResponseFormat string `json:"response_format,omitempty"` // TTS 输出格式(mp3/opus/aac/flac/wav/pcm)
Speed *float64 `json:"speed,omitempty"` // TTS 速度(0.25-4.0)
StreamFormat string `json:"stream_format,omitempty"` // 流式音频格式
Language string `json:"language,omitempty"` // STT 源语言(可选)
Prompt string `json:"prompt,omitempty"` // STT 提示词(可选)
TimestampGranularities []string `json:"timestamp_granities,omitempty"` // STT 时间戳粒度(word/segment)
Metadata json.RawMessage `json:"metadata,omitempty"` // 自定义元数据
}
// AudioResponse STT/翻译响应
type AudioResponse struct {
Text string `json:"text"`
Language string `json:"language,omitempty"`
Duration float64 `json:"duration,omitempty"`
Words []WordSegment `json:"words,omitempty"`
Segments []Segment `json:"segments,omitempty"`
}
// WordSegment 词级别时间戳
type WordSegment struct {
Word string `json:"word"`
Start float64 `json:"start"`
End float64 `json:"end"`
}
// Segment 片段级别时间戳
type Segment struct {
ID int `json:"id"`
Seek int `json:"seek"`
Start float64 `json:"start"`
End float64 `json:"end"`
Text string `json:"text"`
}
// WhisperVerboseJSONResponse STT 详细响应格式(verbose_json)
type WhisperVerboseJSONResponse struct {
Task string `json:"task"`
Language string `json:"language"`
Duration float64 `json:"duration"`
Text string `json:"text"`
Segments []Segment `json:"segments"`
Words []WordSegment `json:"words,omitempty"`
}