From 95ac7c343b701f4752719586b4345987e8a97b69 Mon Sep 17 00:00:00 2001 From: Boo p3psi Date: Wed, 15 May 2024 23:20:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=A0=E9=81=93=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=B2=A1=E6=9C=89=E8=B5=B0=E6=A8=A1=E5=9E=8B=E6=98=A0?= =?UTF-8?q?=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/channel-test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/controller/channel-test.go b/controller/channel-test.go index 7474cb4..db03e75 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -64,7 +64,21 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr } else { testModel = adaptor.GetModelList()[0] } + } else { + modelMapping := *channel.ModelMapping + if modelMapping != "" && modelMapping != "{}" { + modelMap := make(map[string]string) + err := json.Unmarshal([]byte(modelMapping), &modelMap) + if err != nil { + openaiErr := service.OpenAIErrorWrapperLocal(err, "unmarshal_model_mapping_failed", http.StatusInternalServerError).Error + return err, &openaiErr + } + if modelMap[testModel] != "" { + testModel = modelMap[testModel] + } + } } + request := buildTestRequest() request.Model = testModel meta.UpstreamModelName = testModel