fix(ui): not all models have an Icon (#4913)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2025-02-27 10:52:19 +01:00 committed by GitHub
parent 1461fd8777
commit 3bf2e9d065
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -94,7 +94,7 @@ SOFTWARE.
<!-- Model info --> <!-- Model info -->
<div class="space-y-2"> <div class="space-y-2">
<div class="flex items-center"> <div class="flex items-center">
<img src="{{$galleryConfig.Icon}}" class="rounded-lg w-8 h-8 mr-2"> {{ if $galleryConfig.Icon }}<img src="{{$galleryConfig.Icon}}" class="rounded-lg w-8 h-8 mr-2">{{end}}
<h3 class="text-md font-medium">{{ $model }}</h3> <h3 class="text-md font-medium">{{ $model }}</h3>
</div> </div>
<button data-twe-ripple-init data-twe-ripple-color="light" class="w-full text-left flex items-center px-3 py-2 text-xs rounded text-white bg-gray-700 hover:bg-gray-600 transition-colors" data-modal-target="model-info-modal" data-modal-toggle="model-info-modal"> <button data-twe-ripple-init data-twe-ripple-color="light" class="w-full text-left flex items-center px-3 py-2 text-xs rounded text-white bg-gray-700 hover:bg-gray-600 transition-colors" data-modal-target="model-info-modal" data-modal-toggle="model-info-modal">
@ -229,7 +229,7 @@ SOFTWARE.
<i class="fa-solid fa-comments mr-2"></i> <i class="fa-solid fa-comments mr-2"></i>
{{ if $model }} {{ if $model }}
{{ $galleryConfig:= index $allGalleryConfigs $model}} {{ $galleryConfig:= index $allGalleryConfigs $model}}
<img src="{{$galleryConfig.Icon}}" class="rounded-lg w-8 h-8 mr-2"> {{ if $galleryConfig.Icon }}<img src="{{$galleryConfig.Icon}}" class="rounded-lg w-8 h-8 mr-2">{{end}}
{{ end }} {{ end }}
<h1 class="text-lg font-semibold"> <h1 class="text-lg font-semibold">
Chat {{ if .Model }} with {{.Model}} {{ end }} Chat {{ if .Model }} with {{.Model}} {{ end }}
@ -262,7 +262,7 @@ SOFTWARE.
</template> </template>
<template x-if="message.role != 'user'"> <template x-if="message.role != 'user'">
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<img src="{{$galleryConfig.Icon}}" class="rounded-lg mt-2 max-w-8 max-h-8"> {{ if $galleryConfig.Icon }}<img src="{{$galleryConfig.Icon}}" class="rounded-lg mt-2 max-w-8 max-h-8">{{end}}
<div class="flex flex-col flex-1"> <div class="flex flex-col flex-1">
<span class="text-xs font-semibold text-gray-400">{{if .Model}}{{.Model}}{{else}}Assistant{{end}}</span> <span class="text-xs font-semibold text-gray-400">{{if .Model}}{{.Model}}{{else}}Assistant{{end}}</span>
<div class="flex-1 text-white flex items-center space-x-2"> <div class="flex-1 text-white flex items-center space-x-2">
@ -355,7 +355,7 @@ SOFTWARE.
<!-- Body --> <!-- Body -->
<div class="p-4 md:p-5 space-y-4"> <div class="p-4 md:p-5 space-y-4">
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
<img class="lazy rounded-t-lg max-h-48 max-w-96 object-cover mt-3 entered loaded" src="{{$galleryConfig.Icon}}" loading="lazy"/> {{ if $galleryConfig.Icon }}<img class="lazy rounded-t-lg max-h-48 max-w-96 object-cover mt-3 entered loaded" src="{{$galleryConfig.Icon}}" loading="lazy"/>{{end}}
</div> </div>
<p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">{{ $galleryConfig.Description }}</p> <p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">{{ $galleryConfig.Description }}</p>
<hr> <hr>