From 95cfb8e8c952d6795acf69e896f30d1ddea08248 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sun, 3 Mar 2024 22:58:41 +0800 Subject: [PATCH] fix: using the first available model if default model is not found (close #1021) --- controller/channel-test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controller/channel-test.go b/controller/channel-test.go index 485d7702..7007e205 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -19,6 +19,7 @@ import ( "net/http/httptest" "net/url" "strconv" + "strings" "sync" "time" @@ -61,6 +62,12 @@ func testChannel(channel *model.Channel) (err error, openaiErr *relaymodel.Error } adaptor.Init(meta) modelName := adaptor.GetModelList()[0] + if !strings.Contains(channel.Models, modelName) { + modelNames := strings.Split(channel.Models, ",") + if len(modelNames) > 0 { + modelName = modelNames[0] + } + } request := buildTestRequest() request.Model = modelName meta.OriginModelName, meta.ActualModelName = modelName, modelName