From d792cf115b2e11cacffaa19707a0e3f42e5e85f8 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 1 Aug 2024 17:27:40 +0200 Subject: [PATCH] fix(ui): do not show duplicate entries if not installed by gallery (#3107) Signed-off-by: Ettore Di Giacinto --- core/http/endpoints/localai/welcome.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/http/endpoints/localai/welcome.go b/core/http/endpoints/localai/welcome.go index 5d217173c3e5..396c4084b5e2 100644 --- a/core/http/endpoints/localai/welcome.go +++ b/core/http/endpoints/localai/welcome.go @@ -17,7 +17,10 @@ func WelcomeEndpoint(appConfig *config.ApplicationConfig, backendConfigs := cl.GetAllBackendConfigs() galleryConfigs := map[string]*gallery.Config{} + modelsWithBackendConfig := map[string]interface{}{} + for _, m := range backendConfigs { + modelsWithBackendConfig[m.Name] = nil cfg, err := gallery.GetLocalModelConfiguration(ml.ModelPath, m.Name) if err != nil { @@ -32,7 +35,7 @@ func WelcomeEndpoint(appConfig *config.ApplicationConfig, modelsWithoutConfig := []string{} for _, m := range models { - if _, ok := galleryConfigs[m]; !ok { + if _, ok := modelsWithBackendConfig[m]; !ok { modelsWithoutConfig = append(modelsWithoutConfig, m) } }