Skip to content

Commit

Permalink
fix: using the first available model if default model is not found (c…
Browse files Browse the repository at this point in the history
…lose #1021)
  • Loading branch information
songquanpeng committed Mar 3, 2024
1 parent c6ace98 commit 95cfb8e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controller/channel-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"net/http/httptest"
"net/url"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 95cfb8e

Please sign in to comment.