mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-28 17:18:49 -04:00
Add the add-on runtime to LocalAI: manifests, the host operation broker, admin gating by account role, the add-on UI bundle builder and the SDK for add-on pages. Move the navigation to Chat, Models, Add-ons and Settings, with pinned add-ons in the sidebar and an Add-ons drawer. Ship the first-party add-ons (voice, face, fine-tuning, quantization) as packages for linux/amd64, linux/arm64 and darwin/arm64. Intel macOS (darwin/amd64) is enabled in the platform files. Squashed from the review branch. The tree is unchanged; the pre-squash history is kept on a local backup branch. Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
20 lines
632 B
Go
20 lines
632 B
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// ModelNameTaken reports whether anything named name, or name with any
|
|
// extension (its config file included), already exists directly under dir.
|
|
// A model is written as a folder and a config file that share the name, so a
|
|
// folder or a file alone is enough to refuse it.
|
|
func ModelNameTaken(dir, name string) bool {
|
|
if _, err := os.Lstat(filepath.Join(dir, name)); err == nil {
|
|
return true
|
|
}
|
|
// A pattern that cannot be matched is not known to be free, so it is taken.
|
|
matches, err := filepath.Glob(filepath.Join(dir, name+".*"))
|
|
return err != nil || len(matches) > 0
|
|
}
|