mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 00:54:23 +00:00
Embed webui
This commit is contained in:
23
webui/webui.go
Normal file
23
webui/webui.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package webui
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
//go:embed dist/*
|
||||
var webuiFS embed.FS
|
||||
|
||||
func SetupWebUI(r chi.Router) error {
|
||||
distFS, err := fs.Sub(webuiFS, "dist")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fileServer := http.FileServer(http.FS(distFS))
|
||||
r.Handle("/*", fileServer)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user