Skip to content

Commit ff589b5

Browse files
chore: update model mapping implementation for audio (#1932)
* fixed model mapping * chore: update implementation --------- Co-authored-by: JustSong <quanpengsong@gmail.com>
1 parent 95e8c16 commit ff589b5

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

relay/controller/audio.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,9 @@ func RelayAudioHelper(c *gin.Context, relayMode int) *relaymodel.ErrorWithStatus
110110
}()
111111

112112
// map model name
113-
modelMapping := c.GetString(ctxkey.ModelMapping)
114-
if modelMapping != "" {
115-
modelMap := make(map[string]string)
116-
err := json.Unmarshal([]byte(modelMapping), &modelMap)
117-
if err != nil {
118-
return openai.ErrorWrapper(err, "unmarshal_model_mapping_failed", http.StatusInternalServerError)
119-
}
120-
if modelMap[audioModel] != "" {
121-
audioModel = modelMap[audioModel]
122-
}
113+
modelMapping := c.GetStringMapString(ctxkey.ModelMapping)
114+
if modelMapping != nil && modelMapping[audioModel] != "" {
115+
audioModel = modelMapping[audioModel]
123116
}
124117

125118
baseURL := channeltype.ChannelBaseURLs[channelType]

0 commit comments

Comments
 (0)