feat: support audio response_format #580

This commit is contained in:
CalciumIon
2024-11-24 16:44:01 +08:00
parent e57788375e
commit 15842163be
2 changed files with 21 additions and 5 deletions

View File

@@ -33,15 +33,18 @@ func getAndValidAudioRequest(c *gin.Context, info *relaycommon.RelayInfo) (*dto.
}
}
default:
if audioRequest.Model == "" {
audioRequest.Model = c.PostForm("model")
err = c.Request.ParseForm()
if err != nil {
return nil, err
}
formData := c.Request.PostForm
if audioRequest.Model == "" {
audioRequest.Model = formData.Get("model")
}
if audioRequest.Model == "" {
return nil, errors.New("model is required")
}
if audioRequest.ResponseFormat == "" {
audioRequest.ResponseFormat = "json"
}
}
return audioRequest, nil
}