兼容gpt-35-turbo

This commit is contained in:
quzard 2023-06-17 09:54:07 +08:00
parent 7c1a02d0dd
commit a5dbfe2676
2 changed files with 3 additions and 45 deletions

View File

@ -53,51 +53,6 @@ func init() {
}) })
// https://platform.openai.com/docs/models/model-endpoint-compatibility // https://platform.openai.com/docs/models/model-endpoint-compatibility
openAIModels = []OpenAIModels{ openAIModels = []OpenAIModels{
{
Id: "gpt-35-turbo",
Object: "model",
Created: 1677649963,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-35-turbo",
Parent: nil,
},
{
Id: "gpt-35-turbo-0301",
Object: "model",
Created: 1677649963,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-35-turbo-0301",
Parent: nil,
},
{
Id: "gpt-35-turbo-0613",
Object: "model",
Created: 1677649963,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-35-turbo-0613",
Parent: nil,
},
{
Id: "gpt-35-turbo-16k",
Object: "model",
Created: 1677649963,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-35-turbo-16k",
Parent: nil,
},
{
Id: "gpt-35-turbo-16k-0613",
Object: "model",
Created: 1677649963,
OwnedBy: "openai",
Permission: permission,
Root: "gpt-35-turbo-16k-0613",
Parent: nil,
},
{ {
Id: "gpt-3.5-turbo", Id: "gpt-3.5-turbo",
Object: "model", Object: "model",

View File

@ -73,6 +73,9 @@ func Distribute() func(c *gin.Context) {
modelRequest.Model = "text-moderation-stable" modelRequest.Model = "text-moderation-stable"
} }
} }
if strings.HasPrefix(modelRequest.Model, "gpt-35-turbo") {
modelRequest.Model = strings.Replace(modelRequest.Model, "gpt-35-turbo", "gpt-3.5-turbo", 1)
}
channel, err = model.GetRandomSatisfiedChannel(userGroup, modelRequest.Model) channel, err = model.GetRandomSatisfiedChannel(userGroup, modelRequest.Model)
if err != nil { if err != nil {
c.JSON(200, gin.H{ c.JSON(200, gin.H{