mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-05 22:03:42 +08:00
fix: channel default test model
This commit is contained in:
@@ -67,8 +67,8 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
|
|||||||
if channel.TestModel != nil && *channel.TestModel != "" {
|
if channel.TestModel != nil && *channel.TestModel != "" {
|
||||||
testModel = *channel.TestModel
|
testModel = *channel.TestModel
|
||||||
} else {
|
} else {
|
||||||
if len(adaptor.GetModelList()) > 0 {
|
if len(channel.GetModels()) > 0 {
|
||||||
testModel = adaptor.GetModelList()[0]
|
testModel = channel.GetModels()[0]
|
||||||
} else {
|
} else {
|
||||||
testModel = "gpt-3.5-turbo"
|
testModel = "gpt-3.5-turbo"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"one-api/common"
|
"one-api/common"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
@@ -33,6 +34,13 @@ type Channel struct {
|
|||||||
OtherInfo string `json:"other_info"`
|
OtherInfo string `json:"other_info"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (channel *Channel) GetModels() []string {
|
||||||
|
if channel.Models == "" {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
|
return strings.Split(strings.Trim(channel.Models, ","), ",")
|
||||||
|
}
|
||||||
|
|
||||||
func (channel *Channel) GetOtherInfo() map[string]interface{} {
|
func (channel *Channel) GetOtherInfo() map[string]interface{} {
|
||||||
otherInfo := make(map[string]interface{})
|
otherInfo := make(map[string]interface{})
|
||||||
if channel.OtherInfo != "" {
|
if channel.OtherInfo != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user