fixed model mapping

This commit is contained in:
Yuwei Ba 2024-11-18 22:16:38 +11:00
parent 6ab87f8a08
commit 343aac6326

View File

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