dependencies(grpcio): bump to fix CI issues (#2362)

feat(grpcio): bump to fix CI issues

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2024-05-21 14:33:47 +02:00 committed by GitHub
parent a58ff00ab1
commit 1a3dedece0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 159 additions and 47 deletions

View file

@ -2,6 +2,8 @@ package config
import (
"os"
"regexp"
"strings"
"github.com/go-skynet/LocalAI/core/schema"
"github.com/go-skynet/LocalAI/pkg/downloader"
@ -356,3 +358,25 @@ func (cfg *BackendConfig) SetDefaults(opts ...ConfigLoaderOption) {
cfg.Debug = &trueV
}
}
func (c *BackendConfig) Validate() bool {
// Simple validation to make sure the model can be correctly loaded
for _, n := range []string{c.Backend, c.Model} {
if strings.HasPrefix(n, string(os.PathSeparator)) ||
strings.Contains(n, "..") {
return false
}
}
if c.Name == "" {
return false
}
if c.Backend != "" {
// a regex that checks that is a string name with no special characters, except '-' and '_'
re := regexp.MustCompile(`^[a-zA-Z0-9-_]+$`)
return re.MatchString(c.Backend)
}
return true
}