From 642f6cee75248136a0a7b6a61d846c6b5589d51d Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 11 Jul 2024 19:55:01 +0200 Subject: [PATCH] feat(webui): show also models without a config in the welcome page (#2772) Signed-off-by: Ettore Di Giacinto --- core/http/endpoints/localai/welcome.go | 10 +++++- core/http/views/index.html | 44 +++++++++++++++++++++----- pkg/model/loader.go | 2 ++ 3 files changed, 47 insertions(+), 9 deletions(-) diff --git a/core/http/endpoints/localai/welcome.go b/core/http/endpoints/localai/welcome.go index b9c7a573..5d217173 100644 --- a/core/http/endpoints/localai/welcome.go +++ b/core/http/endpoints/localai/welcome.go @@ -29,10 +29,18 @@ func WelcomeEndpoint(appConfig *config.ApplicationConfig, // Get model statuses to display in the UI the operation in progress processingModels, taskTypes := modelStatus() + modelsWithoutConfig := []string{} + + for _, m := range models { + if _, ok := galleryConfigs[m]; !ok { + modelsWithoutConfig = append(modelsWithoutConfig, m) + } + } + summary := fiber.Map{ "Title": "LocalAI API - " + internal.PrintableVersion(), "Version": internal.PrintableVersion(), - "Models": models, + "Models": modelsWithoutConfig, "ModelsConfig": backendConfigs, "GalleryConfig": galleryConfigs, "IsP2PEnabled": p2p.IsP2PEnabled(), diff --git a/core/http/views/index.html b/core/http/views/index.html index e2cbfe03..26cc056a 100644 --- a/core/http/views/index.html +++ b/core/http/views/index.html @@ -17,15 +17,26 @@
- {{template "views/partials/inprogress" .}} - {{ if eq (len .ModelsConfig) 0 }} -

Ouch! seems you don't have any models installed!

+

Ouch! seems you don't have any models installed from the LocalAI gallery!

..install something from the 🖼️ Gallery or check the Getting started documentation

+ + {{ if ne (len .Models) 0 }} +
+

+ However, It seems you have installed some models installed without a configuration file: +

+ {{ range .Models }} +
+

{{.}}

+
+ {{end}} + {{end}} {{ else }} -

Installed models

-

We have {{len .ModelsConfig}} pre-loaded models available.

+ {{ $modelsN := len .ModelsConfig}} + {{ $modelsN = add $modelsN (len .Models)}} +

{{$modelsN}} Installed model(s)

@@ -76,12 +87,29 @@ data-twe-ripple-color="light" data-twe-ripple-init="" hx-confirm="Are you sure you wish to delete the model?" hx-post="/browse/delete/model/{{.Name}}" hx-swap="outerHTML">Delete {{ end }} + {{ range .Models }} + + + + + + + {{end}}
+ + +

{{.}}

+
+ + auto + + + + No Configuration + +
{{ end }} - - -
diff --git a/pkg/model/loader.go b/pkg/model/loader.go index 6acc19f6..c7159f7e 100644 --- a/pkg/model/loader.go +++ b/pkg/model/loader.go @@ -100,6 +100,8 @@ var knownModelsNameSuffixToSkip []string = []string{ ".json", ".DS_Store", ".", + ".partial", + ".tar.gz", } func (ml *ModelLoader) ListFilesInModelPath() ([]string, error) {