mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 23:57:27 +00:00
Merge pull request #1995 from seefs001/fix/test-channel-1993
fix: test model #1993
This commit is contained in:
@@ -59,6 +59,21 @@ func testChannel(channel *model.Channel, testModel string, endpointType string)
|
|||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
c, _ := gin.CreateTestContext(w)
|
c, _ := gin.CreateTestContext(w)
|
||||||
|
|
||||||
|
testModel = strings.TrimSpace(testModel)
|
||||||
|
if testModel == "" {
|
||||||
|
if channel.TestModel != nil && *channel.TestModel != "" {
|
||||||
|
testModel = strings.TrimSpace(*channel.TestModel)
|
||||||
|
} else {
|
||||||
|
models := channel.GetModels()
|
||||||
|
if len(models) > 0 {
|
||||||
|
testModel = strings.TrimSpace(models[0])
|
||||||
|
}
|
||||||
|
if testModel == "" {
|
||||||
|
testModel = "gpt-4o-mini"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
requestPath := "/v1/chat/completions"
|
requestPath := "/v1/chat/completions"
|
||||||
|
|
||||||
// 如果指定了端点类型,使用指定的端点类型
|
// 如果指定了端点类型,使用指定的端点类型
|
||||||
@@ -90,18 +105,6 @@ func testChannel(channel *model.Channel, testModel string, endpointType string)
|
|||||||
Header: make(http.Header),
|
Header: make(http.Header),
|
||||||
}
|
}
|
||||||
|
|
||||||
if testModel == "" {
|
|
||||||
if channel.TestModel != nil && *channel.TestModel != "" {
|
|
||||||
testModel = *channel.TestModel
|
|
||||||
} else {
|
|
||||||
if len(channel.GetModels()) > 0 {
|
|
||||||
testModel = channel.GetModels()[0]
|
|
||||||
} else {
|
|
||||||
testModel = "gpt-4o-mini"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cache, err := model.GetUserCache(1)
|
cache, err := model.GetUserCache(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return testResult{
|
return testResult{
|
||||||
|
|||||||
Reference in New Issue
Block a user