mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-17 08:15:00 +00:00

* feat: Add backend gallery This PR add support to manage backends as similar to models. There is now available a backend gallery which can be used to install and remove extra backends. The backend gallery can be configured similarly as a model gallery, and API calls allows to install and remove new backends in runtime, and as well during the startup phase of LocalAI. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Add backends docs Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * wip: Backend Dockerfile for python backends Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * feat: drop extras images, build python backends separately Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fixup on all backends Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * test CI Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Tweaks Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Drop old backends leftovers Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Fixup CI Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Move dockerfile upper Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Fix proto Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Feature dropped for consistency - we prefer model galleries Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Add missing packages in the build image Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * exllama is ponly available on cublas Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * pin torch on chatterbox Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Fixups to index Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * CI Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Debug CI * Install accellerators deps Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Add target arch * Add cuda minor version Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Use self-hosted runners Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * ci: use quay for test images Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fixups for vllm and chatterbox Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Small fixups on CI Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * chatterbox is only available for nvidia Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Simplify CI builds Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Adapt test, use qwen3 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * chore(model gallery): add jina-reranker-v1-tiny-en-gguf Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(gguf-parser): recover from potential panics that can happen while reading ggufs with gguf-parser Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Use reranker from llama.cpp in AIO images Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Limit concurrent jobs Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
115 lines
2.6 KiB
Go
115 lines
2.6 KiB
Go
package elements
|
|
|
|
import (
|
|
"github.com/chasefleming/elem-go"
|
|
"github.com/chasefleming/elem-go/attrs"
|
|
"github.com/microcosm-cc/bluemonday"
|
|
)
|
|
|
|
func DoneModelProgress(galleryID, text string, showDelete bool) string {
|
|
return elem.Div(
|
|
attrs.Props{
|
|
"id": "action-div-" + dropBadChars(galleryID),
|
|
},
|
|
elem.H3(
|
|
attrs.Props{
|
|
"role": "status",
|
|
"id": "pblabel",
|
|
"tabindex": "-1",
|
|
"autofocus": "",
|
|
},
|
|
elem.Text(bluemonday.StrictPolicy().Sanitize(text)),
|
|
),
|
|
elem.If(showDelete, deleteButton(galleryID), reInstallButton(galleryID)),
|
|
).Render()
|
|
}
|
|
|
|
func DoneBackendProgress(galleryID, text string, showDelete bool) string {
|
|
return elem.Div(
|
|
attrs.Props{
|
|
"id": "action-div-" + dropBadChars(galleryID),
|
|
},
|
|
elem.H3(
|
|
attrs.Props{
|
|
"role": "status",
|
|
"id": "pblabel",
|
|
"tabindex": "-1",
|
|
"autofocus": "",
|
|
},
|
|
elem.Text(bluemonday.StrictPolicy().Sanitize(text)),
|
|
),
|
|
elem.If(showDelete, backendDeleteButton(galleryID), reInstallButton(galleryID)),
|
|
).Render()
|
|
}
|
|
|
|
func ErrorProgress(err, galleryName string) string {
|
|
return elem.Div(
|
|
attrs.Props{},
|
|
elem.H3(
|
|
attrs.Props{
|
|
"role": "status",
|
|
"id": "pblabel",
|
|
"tabindex": "-1",
|
|
"autofocus": "",
|
|
},
|
|
elem.Text("Error "+bluemonday.StrictPolicy().Sanitize(err)),
|
|
),
|
|
installButton(galleryName),
|
|
).Render()
|
|
}
|
|
|
|
func ProgressBar(progress string) string {
|
|
return elem.Div(attrs.Props{
|
|
"class": "progress",
|
|
"role": "progressbar",
|
|
"aria-valuemin": "0",
|
|
"aria-valuemax": "100",
|
|
"aria-valuenow": "0",
|
|
"aria-labelledby": "pblabel",
|
|
},
|
|
elem.Div(attrs.Props{
|
|
"id": "pb",
|
|
"class": "progress-bar",
|
|
"style": "width:" + progress + "%",
|
|
}),
|
|
).Render()
|
|
}
|
|
|
|
func StartModelProgressBar(uid, progress, text string) string {
|
|
return progressBar(uid, "browse/job/", progress, text)
|
|
}
|
|
|
|
func StartBackendProgressBar(uid, progress, text string) string {
|
|
return progressBar(uid, "browse/backend/job/", progress, text)
|
|
}
|
|
|
|
func progressBar(uid, url, progress, text string) string {
|
|
if progress == "" {
|
|
progress = "0"
|
|
}
|
|
return elem.Div(
|
|
attrs.Props{
|
|
"hx-trigger": "done",
|
|
"hx-get": url + uid,
|
|
"hx-swap": "outerHTML",
|
|
"hx-target": "this",
|
|
},
|
|
elem.H3(
|
|
attrs.Props{
|
|
"role": "status",
|
|
"id": "pblabel",
|
|
"tabindex": "-1",
|
|
"autofocus": "",
|
|
},
|
|
elem.Text(bluemonday.StrictPolicy().Sanitize(text)), //Perhaps overly defensive
|
|
elem.Div(attrs.Props{
|
|
"hx-get": url + "progress/" + uid,
|
|
"hx-trigger": "every 600ms",
|
|
"hx-target": "this",
|
|
"hx-swap": "innerHTML",
|
|
},
|
|
elem.Raw(ProgressBar(progress)),
|
|
),
|
|
),
|
|
).Render()
|
|
}
|