Merge pull request #746 from zjjxwhh/main

fix: always use modelMapping in channel test
This commit is contained in:
Calcium-Ion
2025-02-11 12:21:06 +07:00
committed by GitHub

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]
} }
} }