fix: Skip JSON deserialization when accessing transcriptions and translations.
This commit is contained in:
parent
34d517cfa2
commit
4d251b08b0
@ -201,9 +201,9 @@ func Relay(c *gin.Context) {
|
|||||||
relayMode = RelayModeEdits
|
relayMode = RelayModeEdits
|
||||||
} else if strings.HasPrefix(c.Request.URL.Path, "/v1/audio/speech") {
|
} else if strings.HasPrefix(c.Request.URL.Path, "/v1/audio/speech") {
|
||||||
relayMode = RelayModeAudioSpeech
|
relayMode = RelayModeAudioSpeech
|
||||||
} else if strings.HasPrefix(c.Request.URL.Path, "/v1/audio/transcription") {
|
} else if strings.HasPrefix(c.Request.URL.Path, "/v1/audio/transcriptions") {
|
||||||
relayMode = RelayModeAudioTranscription
|
relayMode = RelayModeAudioTranscription
|
||||||
} else if strings.HasPrefix(c.Request.URL.Path, "/v1/audio/translation") {
|
} else if strings.HasPrefix(c.Request.URL.Path, "/v1/audio/translations") {
|
||||||
relayMode = RelayModeAudioTranslation
|
relayMode = RelayModeAudioTranslation
|
||||||
}
|
}
|
||||||
var err *OpenAIErrorWithStatusCode
|
var err *OpenAIErrorWithStatusCode
|
||||||
|
@ -40,7 +40,10 @@ func Distribute() func(c *gin.Context) {
|
|||||||
} else {
|
} else {
|
||||||
// Select a channel for the user
|
// Select a channel for the user
|
||||||
var modelRequest ModelRequest
|
var modelRequest ModelRequest
|
||||||
err := common.UnmarshalBodyReusable(c, &modelRequest)
|
var err error
|
||||||
|
if !strings.HasPrefix(c.Request.URL.Path, "/v1/audio/transcriptions") && !strings.HasPrefix(c.Request.URL.Path, "/v1/audio/translations") {
|
||||||
|
err = common.UnmarshalBodyReusable(c, &modelRequest)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
abortWithMessage(c, http.StatusBadRequest, "无效的请求")
|
abortWithMessage(c, http.StatusBadRequest, "无效的请求")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user