🐛 fix: ownedBy field must have a value
This commit is contained in:
parent
a20dee02a7
commit
3b46e4ca16
@ -13,6 +13,8 @@ import (
|
|||||||
|
|
||||||
// https://platform.openai.com/docs/api-reference/models/list
|
// https://platform.openai.com/docs/api-reference/models/list
|
||||||
|
|
||||||
|
var unknownOwnedBy = "未知"
|
||||||
|
|
||||||
type OpenAIModelPermission struct {
|
type OpenAIModelPermission struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Object string `json:"object"`
|
Object string `json:"object"`
|
||||||
@ -138,7 +140,7 @@ func ListModelsForAdmin(c *gin.Context) {
|
|||||||
func RetrieveModel(c *gin.Context) {
|
func RetrieveModel(c *gin.Context) {
|
||||||
modelId := c.Param("model")
|
modelId := c.Param("model")
|
||||||
ownedByName := getModelOwnedBy(modelId)
|
ownedByName := getModelOwnedBy(modelId)
|
||||||
if ownedByName != nil {
|
if *ownedByName != unknownOwnedBy {
|
||||||
c.JSON(200, OpenAIModels{
|
c.JSON(200, OpenAIModels{
|
||||||
Id: modelId,
|
Id: modelId,
|
||||||
Object: "model",
|
Object: "model",
|
||||||
@ -168,5 +170,5 @@ func getModelOwnedBy(modelId string) (ownedBy *string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return &unknownOwnedBy
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user