feat(ui): detect model usage and display link (#4864)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2025-02-18 19:27:07 +01:00 committed by GitHub
parent 28fb8e607a
commit 5b19af99ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 2 deletions

View File

@ -400,6 +400,15 @@ func (cfg *BackendConfig) SetDefaults(opts ...ConfigLoaderOption) {
cfg.Debug = &trueV
}
if len(cfg.KnownUsecaseStrings) == 0 {
// Infer use case if not provided
for k, usecase := range GetAllBackendConfigUsecases() {
if cfg.HasUsecases(usecase) {
cfg.KnownUsecaseStrings = append(cfg.KnownUsecaseStrings, k)
}
}
}
guessDefaultsFromFile(cfg, lo.modelPath)
}

View File

@ -29,7 +29,7 @@
</h3>
{{ range .Models }}
<div class="bg-gray-800 border-b border-gray-700 p-4 mt-4">
<h4 class="text-md font-bold text-gray-200">{{.}}</h4>
<h4 class="text-md font-bold text-gray-200">{{.Name}}</h4>
</div>
{{end}}
{{end}}
@ -66,7 +66,18 @@
{{ end }}
</td>
<td class="px-4 py-3 font-bold">
<p class="font-bold text-white flex items-center"><a href="browse?term={{.Name}}">{{.Name}}</a> <a href="chat/{{.Name}}"><i class="fas fa-comments"></i></a></p>
<p class="font-bold text-white flex items-center">{{.Name}} <a href="browse?term={{.Name}}" class="ml-2 text-blue-400 hover:text-blue-600"><i class="fas fa-search"></i></a></p>
{{ range .KnownUsecaseStrings }}
{{ if eq . "FLAG_CHAT" }}
<a href="chat/{{$cfg.Name}}" class="ml-2 bg-blue-500 text-white py-1 px-3 rounded-lg shadow transition duration-300 ease-in-out hover:bg-blue-700 hover:shadow-lg"><i class="fas fa-comments pr-1"></i>Chat</a>
{{ end }}
{{ if eq . "FLAG_IMAGE" }}
<a href="text2image/{{$cfg.Name}}" class="ml-2 bg-green-500 text-white py-1 px-3 rounded-lg shadow transition duration-300 ease-in-out hover:bg-green-700 hover:shadow-lg"><i class="fas fa-image pr-1"></i>Image</a>
{{ end }}
{{ if eq . "FLAG_TTS" }}
<a href="tts/{{$cfg.Name}}" class="ml-2 bg-purple-500 text-white py-1 px-3 rounded-lg shadow transition duration-300 ease-in-out hover:bg-purple-700 hover:shadow-lg"><i class="fas fa-microphone pr-1"></i>TTS</a>
{{ end }}
{{ end }}
</td>
<td class="px-4 py-3 font-bold">
{{ if .Backend }}