chore: update model mapping implementation for audio (#1932)

* fixed model mapping

* chore: update implementation

---------

Co-authored-by: JustSong <quanpengsong@gmail.com>
This commit is contained in:
Yuwei Ba 2024-12-22 22:33:11 +11:00 committed by GitHub
parent 95e8c16338
commit ff589b5e4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -110,16 +110,9 @@ func RelayAudioHelper(c *gin.Context, relayMode int) *relaymodel.ErrorWithStatus
}()
// map model name
modelMapping := c.GetString(ctxkey.ModelMapping)
if modelMapping != "" {
modelMap := make(map[string]string)
err := json.Unmarshal([]byte(modelMapping), &modelMap)
if err != nil {
return openai.ErrorWrapper(err, "unmarshal_model_mapping_failed", http.StatusInternalServerError)
}
if modelMap[audioModel] != "" {
audioModel = modelMap[audioModel]
}
modelMapping := c.GetStringMapString(ctxkey.ModelMapping)
if modelMapping != nil && modelMapping[audioModel] != "" {
audioModel = modelMapping[audioModel]
}
baseURL := channeltype.ChannelBaseURLs[channelType]