mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-14 06:20:27 +00:00
feat: /v1/models now only return available models
This commit is contained in:
@@ -115,7 +115,8 @@ func TokenAuth() func(c *gin.Context) {
|
||||
}
|
||||
c.Set("request_model", requestModel)
|
||||
if token.Models != nil && *token.Models != "" {
|
||||
if !isModelInList(requestModel, *token.Models) {
|
||||
c.Set("available_models", *token.Models)
|
||||
if requestModel != "" && !isModelInList(requestModel, *token.Models) {
|
||||
abortWithMessage(c, http.StatusForbidden, fmt.Sprintf("该令牌无权使用模型:%s", requestModel))
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user