Skip to content

Commit a4807a6

Browse files
committed
feat(webui): show also models without a config in the welcome page
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent b6b8ab6 commit a4807a6

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

core/http/endpoints/localai/welcome.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@ func WelcomeEndpoint(appConfig *config.ApplicationConfig,
2929
// Get model statuses to display in the UI the operation in progress
3030
processingModels, taskTypes := modelStatus()
3131

32+
modelsWithoutConfig := []string{}
33+
34+
for _, m := range models {
35+
if _, ok := galleryConfigs[m]; !ok {
36+
modelsWithoutConfig = append(modelsWithoutConfig, m)
37+
}
38+
}
39+
3240
summary := fiber.Map{
3341
"Title": "LocalAI API - " + internal.PrintableVersion(),
3442
"Version": internal.PrintableVersion(),
35-
"Models": models,
43+
"Models": modelsWithoutConfig,
3644
"ModelsConfig": backendConfigs,
3745
"GalleryConfig": galleryConfigs,
3846
"IsP2PEnabled": p2p.IsP2PEnabled(),

core/http/views/index.html

+36-8
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,26 @@ <h1 class="text-5xl font-bold text-gray-100">Welcome to <i>your</i> LocalAI inst
1717
</div>
1818

1919
<div class="models mt-4">
20-
2120
{{template "views/partials/inprogress" .}}
22-
2321
{{ if eq (len .ModelsConfig) 0 }}
24-
<h2 class="text-center text-3xl font-semibold text-gray-100"> <i class="text-yellow-200 ml-2 fa-solid fa-triangle-exclamation animate-pulse"></i> Ouch! seems you don't have any models installed!</h2>
22+
<h2 class="text-center text-3xl font-semibold text-gray-100"> <i class="text-yellow-200 ml-2 fa-solid fa-triangle-exclamation animate-pulse"></i> Ouch! seems you don't have any models installed from the LocalAI gallery!</h2>
2523
<p class="text-center mt-4 text-xl">..install something from the <a class="text-gray-400 hover:text-white ml-1 px-3 py-2 rounded" href="/browse">🖼️ Gallery</a> or check the <a href="https://localai.io/basics/getting_started/" class="text-gray-400 hover:text-white ml-1 px-3 py-2 rounded"> <i class="fa-solid fa-book"></i> Getting started documentation </a></p>
24+
25+
{{ if ne (len .Models) 0 }}
26+
<hr class="my-4">
27+
<h3 class="text-center text-xl font-semibold text-gray-100">
28+
However, It seems you have installed some models installed without a configuration file:
29+
</h3>
30+
{{ range .Models }}
31+
<div class="bg-gray-800 border-b border-gray-700 p-4 mt-4">
32+
<h4 class="text-md font-bold text-gray-200">{{.}}</h4>
33+
</div>
34+
{{end}}
35+
{{end}}
2636
{{ else }}
27-
<h2 class="text-center text-3xl font-semibold text-gray-100">Installed models</h2>
28-
<p class="text-center mt-4 text-xl">We have {{len .ModelsConfig}} pre-loaded models available.</p>
37+
{{ $modelsN := len .ModelsConfig}}
38+
{{ $modelsN = add $modelsN (len .Models)}}
39+
<h2 class="text-center text-3xl font-semibold text-gray-100">{{$modelsN}} Installed model(s)</h2>
2940
<table class="table-auto mt-4 w-full text-left text-gray-200">
3041
<thead class="text-xs text-gray-400 uppercase bg-gray-700">
3142
<tr>
@@ -76,12 +87,29 @@ <h2 class="text-center text-3xl font-semibold text-gray-100">Installed models</h
7687
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"><i class="fa-solid fa-cancel pr-2"></i>Delete</button>
7788
</td>
7889
{{ end }}
90+
{{ range .Models }}
91+
<tr class="bg-gray-800 border-b border-gray-700">
92+
<td class="px-4 py-3">
93+
<img src="{{$noicon}}" class="rounded-t-lg max-h-24 max-w-24 object-cover mt-3">
94+
</td>
95+
<td class="px-4 py-3 font-bold">
96+
<p class="font-bold text-white flex items-center"><i class="fas fa-brain pr-2"></i>{{.}}</p>
97+
</td>
98+
<td class="px-4 py-3 font-bold">
99+
<span class="inline-block bg-yellow-500 text-white py-1 px-3 rounded-full text-xs">
100+
auto
101+
</span>
102+
</td>
103+
104+
<td class="px-4 py-3">
105+
<span class="float-right inline-block bg-red-800 text-white py-1 px-3 rounded-full text-xs">
106+
No Configuration
107+
</span>
108+
</td>
109+
{{end}}
79110
</tbody>
80111
</table>
81112
{{ end }}
82-
83-
84-
85113
</div>
86114
</div>
87115

pkg/model/loader.go

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ var knownModelsNameSuffixToSkip []string = []string{
100100
".json",
101101
".DS_Store",
102102
".",
103+
".partial",
103104
}
104105

105106
func (ml *ModelLoader) ListFilesInModelPath() ([]string, error) {

0 commit comments

Comments
 (0)