package voice // DashScope 的线格式类型(请求体 / 响应 envelope)。它们只描述 JSON 形状, // 不含任何逻辑,因此与适配器行为分开成文件。 // dashscopeSTTResponse 是 DashScope ASR 响应 envelope。 type dashscopeSTTResponse struct { Output struct { Output struct { Sentence struct { Text string `json:"text"` } `json:"sentence"` Text string `json:"text"` } `json:"output"` Text string `json:"text"` Choices []struct { Message struct { Content []struct { Text string `json:"text"` } `json:"content"` } `json:"message"` } `json:"choices"` } `json:"output"` Text string `json:"text"` } // dashscopeTTSResponse 是 DashScope TTS 响应 envelope。 type dashscopeTTSResponse struct { Output struct { Audio struct { URL string `json:"url"` Data string `json:"data"` } `json:"audio"` } `json:"output"` } // dashscopeSTTRequest 是 ASR 请求体。 type dashscopeSTTRequest struct { Model string `json:"model"` Input dashscopeSTTInput `json:"input"` Parameters dashscopeSTTParameters `json:"parameters"` } // dashscopeSTTInput 承载多模态消息列表。 type dashscopeSTTInput struct { Messages []dashscopeSTTMessage `json:"messages"` } // dashscopeSTTMessage 是一个 ASR 用户回合。 type dashscopeSTTMessage struct { Role string `json:"role"` Content []dashscopeSTTContent `json:"content"` } // dashscopeSTTContent 是一个音频内容块。 type dashscopeSTTContent struct { Type string `json:"type"` InputAudio dashscopeInputAudio `json:"input_audio"` } // dashscopeInputAudio 承载 base64 data: URI 音频。 type dashscopeInputAudio struct { Data string `json:"data"` } // dashscopeSTTParameters 调整 ASR 请求。 type dashscopeSTTParameters struct { Format string `json:"format"` SampleRate int `json:"sample_rate"` LanguageHints []string `json:"language_hints,omitempty"` } // dashscopeTTSRequest 是 TTS 请求体。 type dashscopeTTSRequest struct { Model string `json:"model"` Input dashscopeTTSInput `json:"input"` } // dashscopeTTSInput 承载文字 + 音色 + 输出格式。 type dashscopeTTSInput struct { Text string `json:"text"` Voice string `json:"voice"` Format string `json:"format"` SampleRate int `json:"sample_rate"` // Instruction 是 CosyVoice 的情绪/语气 instruction;omitempty 使 // 系统音色(必须使用固定 instruction)不携带自由形式的 instruction。 Instruction string `json:"instruction,omitempty"` } // dashscopeCloneRequest 是音色注册 create_voice 请求体。 type dashscopeCloneRequest struct { Model string `json:"model"` Input dashscopeCloneInput `json:"input"` } // dashscopeCloneInput 承载 create_voice 动作参数。 type dashscopeCloneInput struct { Action string `json:"action"` TargetModel string `json:"target_model"` Prefix string `json:"prefix"` URL string `json:"url"` } // dashscopeCloneResponse 是音色注册响应 envelope。顶层 // message 表示模型级错误——即使 HTTP 200 也会暴露。 type dashscopeCloneResponse struct { Output struct { VoiceID string `json:"voice_id"` } `json:"output"` Message string `json:"message"` }