Skip to content

Commit 687cb65

Browse files
committed
fix: using the first available model if default model is not found (close songquanpeng#1021)
1 parent b4bd6fd commit 687cb65

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

controller/channel-test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"net/http/httptest"
2020
"net/url"
2121
"strconv"
22+
"strings"
2223
"sync"
2324
"time"
2425

@@ -61,6 +62,12 @@ func testChannel(channel *model.Channel) (err error, openaiErr *relaymodel.Error
6162
}
6263
adaptor.Init(meta)
6364
modelName := adaptor.GetModelList()[0]
65+
if !strings.Contains(channel.Models, modelName) {
66+
modelNames := strings.Split(channel.Models, ",")
67+
if len(modelNames) > 0 {
68+
modelName = modelNames[0]
69+
}
70+
}
6471
request := buildTestRequest()
6572
request.Model = modelName
6673
meta.OriginModelName, meta.ActualModelName = modelName, modelName

0 commit comments

Comments
 (0)