fix: always use modelMapping in channel test

This commit is contained in:
zjjxwhh
2025-02-10 22:39:56 +08:00
parent 8418dbe7c4
commit 882c5970d9

View File

@@ -58,17 +58,17 @@ func testChannel(channel *model.Channel, testModel string) (err error, openAIErr
testModel = "gpt-3.5-turbo" testModel = "gpt-3.5-turbo"
} }
} }
} else { }
modelMapping := *channel.ModelMapping
if modelMapping != "" && modelMapping != "{}" { modelMapping := *channel.ModelMapping
modelMap := make(map[string]string) if modelMapping != "" && modelMapping != "{}" {
err := json.Unmarshal([]byte(modelMapping), &modelMap) modelMap := make(map[string]string)
if err != nil { err := json.Unmarshal([]byte(modelMapping), &modelMap)
return err, service.OpenAIErrorWrapperLocal(err, "unmarshal_model_mapping_failed", http.StatusInternalServerError) if err != nil {
} return err, service.OpenAIErrorWrapperLocal(err, "unmarshal_model_mapping_failed", http.StatusInternalServerError)
if modelMap[testModel] != "" { }
testModel = modelMap[testModel] if modelMap[testModel] != "" {
} testModel = modelMap[testModel]
} }
} }