Skip to content

Commit

Permalink
Merge pull request #746 from zjjxwhh/main
Browse files Browse the repository at this point in the history
fix: always use modelMapping in channel test
  • Loading branch information
Calcium-Ion authored Feb 11, 2025
2 parents 1b4fe86 + 882c597 commit 0e89939
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions controller/channel-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ func testChannel(channel *model.Channel, testModel string) (err error, openAIErr
testModel = "gpt-3.5-turbo"
}
}
} else {
modelMapping := *channel.ModelMapping
if modelMapping != "" && modelMapping != "{}" {
modelMap := make(map[string]string)
err := json.Unmarshal([]byte(modelMapping), &modelMap)
if err != nil {
return err, service.OpenAIErrorWrapperLocal(err, "unmarshal_model_mapping_failed", http.StatusInternalServerError)
}
if modelMap[testModel] != "" {
testModel = modelMap[testModel]
}
}

modelMapping := *channel.ModelMapping
if modelMapping != "" && modelMapping != "{}" {
modelMap := make(map[string]string)
err := json.Unmarshal([]byte(modelMapping), &modelMap)
if err != nil {
return err, service.OpenAIErrorWrapperLocal(err, "unmarshal_model_mapping_failed", http.StatusInternalServerError)
}
if modelMap[testModel] != "" {
testModel = modelMap[testModel]
}
}

Expand Down

0 comments on commit 0e89939

Please sign in to comment.