mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-27 22:15:00 +00:00
feat(webui): statically embed js/css assets (#2348)
* feat(webui): statically embed js/css assets Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * update font assets Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
5a3db730b9
commit
8ccd5ab040
51 changed files with 20497 additions and 11 deletions
46
core/dependencies_manager/manager.go
Normal file
46
core/dependencies_manager/manager.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/go-skynet/LocalAI/pkg/downloader"
|
||||
"github.com/go-skynet/LocalAI/pkg/utils"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type Asset struct {
|
||||
FileName string `yaml:"filename"`
|
||||
URL string `yaml:"url"`
|
||||
SHA string `yaml:"sha"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
// read the YAML file which contains a list of assets
|
||||
// and download them in the asset path
|
||||
assets := []Asset{}
|
||||
|
||||
assetFile := os.Args[1]
|
||||
destPath := os.Args[2]
|
||||
|
||||
// read the YAML file
|
||||
f, err := os.ReadFile(assetFile)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// unmarshal the YAML data into a struct
|
||||
if err := yaml.Unmarshal(f, &assets); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// download the assets
|
||||
for _, asset := range assets {
|
||||
if err := downloader.DownloadFile(asset.URL, filepath.Join(destPath, asset.FileName), asset.SHA, 1, 1, utils.DisplayDownloadFunction); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("Finished downloading assets")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue