Skip to content

Commit 5b19af9

Browse files
authored
feat(ui): detect model usage and display link (#4864)
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 28fb8e6 commit 5b19af9

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

core/config/backend_config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,15 @@ func (cfg *BackendConfig) SetDefaults(opts ...ConfigLoaderOption) {
400400
cfg.Debug = &trueV
401401
}
402402

403+
if len(cfg.KnownUsecaseStrings) == 0 {
404+
// Infer use case if not provided
405+
for k, usecase := range GetAllBackendConfigUsecases() {
406+
if cfg.HasUsecases(usecase) {
407+
cfg.KnownUsecaseStrings = append(cfg.KnownUsecaseStrings, k)
408+
}
409+
}
410+
}
411+
403412
guessDefaultsFromFile(cfg, lo.modelPath)
404413
}
405414

core/http/views/index.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h3 class="text-center text-xl font-semibold text-gray-100">
2929
</h3>
3030
{{ range .Models }}
3131
<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>
32+
<h4 class="text-md font-bold text-gray-200">{{.Name}}</h4>
3333
</div>
3434
{{end}}
3535
{{end}}
@@ -66,7 +66,18 @@ <h2 class="text-center text-3xl font-semibold text-gray-100">{{$modelsN}} Instal
6666
{{ end }}
6767
</td>
6868
<td class="px-4 py-3 font-bold">
69-
<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>
69+
<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>
70+
{{ range .KnownUsecaseStrings }}
71+
{{ if eq . "FLAG_CHAT" }}
72+
<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>
73+
{{ end }}
74+
{{ if eq . "FLAG_IMAGE" }}
75+
<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>
76+
{{ end }}
77+
{{ if eq . "FLAG_TTS" }}
78+
<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>
79+
{{ end }}
80+
{{ end }}
7081
</td>
7182
<td class="px-4 py-3 font-bold">
7283
{{ if .Backend }}

0 commit comments

Comments
 (0)