mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
UI: flag trust_remote_code
to users // favicon support (#2253)
* attempt to indicate trust_remote_code in some way * bonus: favicon support! --------- Signed-off-by: Dave Lee <dave@gray101.com>
This commit is contained in:
parent
fea9522982
commit
d3ddc9e4aa
4 changed files with 31 additions and 4 deletions
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/gofiber/contrib/fiberzerolog"
|
"github.com/gofiber/contrib/fiberzerolog"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||||
|
"github.com/gofiber/fiber/v2/middleware/favicon"
|
||||||
"github.com/gofiber/fiber/v2/middleware/filesystem"
|
"github.com/gofiber/fiber/v2/middleware/filesystem"
|
||||||
"github.com/gofiber/fiber/v2/middleware/recover"
|
"github.com/gofiber/fiber/v2/middleware/recover"
|
||||||
|
|
||||||
|
@ -182,8 +183,16 @@ func App(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *confi
|
||||||
}
|
}
|
||||||
routes.RegisterJINARoutes(app, cl, ml, appConfig, auth)
|
routes.RegisterJINARoutes(app, cl, ml, appConfig, auth)
|
||||||
|
|
||||||
|
httpFS := http.FS(embedDirStatic)
|
||||||
|
|
||||||
|
app.Use(favicon.New(favicon.Config{
|
||||||
|
URL: "/favicon.ico",
|
||||||
|
FileSystem: httpFS,
|
||||||
|
File: "static/favicon.ico",
|
||||||
|
}))
|
||||||
|
|
||||||
app.Use("/static", filesystem.New(filesystem.Config{
|
app.Use("/static", filesystem.New(filesystem.Config{
|
||||||
Root: http.FS(embedDirStatic),
|
Root: httpFS,
|
||||||
PathPrefix: "static",
|
PathPrefix: "static",
|
||||||
Browse: true,
|
Browse: true,
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -327,11 +327,19 @@ func ListModels(models []*gallery.GalleryModel, installing *xsync.SyncedMap[stri
|
||||||
m.Icon = NoImage
|
m.Icon = NoImage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
divProperties := attrs.Props{
|
||||||
|
"class": "flex justify-center items-center",
|
||||||
|
}
|
||||||
|
|
||||||
|
_, trustRemoteCodeExists := m.Overrides["trust_remote_code"]
|
||||||
|
if trustRemoteCodeExists {
|
||||||
|
// should this be checking for trust_remote_code: false? I don't think we ever use that value.
|
||||||
|
divProperties["class"] = divProperties["class"] + " remote-code"
|
||||||
|
}
|
||||||
|
|
||||||
elems = append(elems,
|
elems = append(elems,
|
||||||
|
|
||||||
elem.Div(attrs.Props{
|
elem.Div(divProperties,
|
||||||
"class": "flex justify-center items-center",
|
|
||||||
},
|
|
||||||
elem.A(attrs.Props{
|
elem.A(attrs.Props{
|
||||||
"href": "#!",
|
"href": "#!",
|
||||||
// "class": "justify-center items-center",
|
// "class": "justify-center items-center",
|
||||||
|
|
BIN
core/http/static/favicon.ico
Normal file
BIN
core/http/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -72,6 +72,16 @@ body {
|
||||||
margin: 0.5rem;
|
margin: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.remote-code { /* Attempt to make this stand out */
|
||||||
|
outline-style: solid;
|
||||||
|
outline-color: red;
|
||||||
|
outline-width: 0.33rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remote-code::after {
|
||||||
|
content: "\0026A0 Trust Remote Code Required \0026A0"
|
||||||
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
list-style-type: disc; /* Adds bullet points */
|
list-style-type: disc; /* Adds bullet points */
|
||||||
padding-left: 1.25rem; /* Indents the list from the left margin */
|
padding-left: 1.25rem; /* Indents the list from the left margin */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue