Skip to content

Commit

Permalink
chore: update model mapping implementation for audio (#1932)
Browse files Browse the repository at this point in the history
* fixed model mapping

* chore: update implementation

---------

Co-authored-by: JustSong <quanpengsong@gmail.com>
  • Loading branch information
ibigbug and songquanpeng authored Dec 22, 2024
1 parent 95e8c16 commit ff589b5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions relay/controller/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit ff589b5

Please sign in to comment.