diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 0cdb47dc7..16dcb0d12 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -211,6 +211,9 @@ func DeleteModel(ctx *context.Context) { } func isCanDelete(ctx *context.Context, model *models.AiModelManage) bool { + if ctx.User == nil { + return false + } if ctx.User.IsAdmin || ctx.User.ID == model.UserId { return true }