mirror of
https://github.com/mudler/LocalAI.git
synced 2026-04-01 05:36:49 -04:00
* feat(ui): move to React Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Add import model Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * syntax highlight Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Minor fixups Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
// DEPRECATED: This tool downloads static assets for the legacy Alpine.js UI.
|
|
// The new React UI (core/http/react-ui/) bundles all dependencies via npm.
|
|
// Remove this file when the legacy UI (core/http/views/) is removed.
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/mudler/LocalAI/pkg/downloader"
|
|
"github.com/mudler/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 {
|
|
uri := downloader.URI(asset.URL)
|
|
if err := uri.DownloadFile(filepath.Join(destPath, asset.FileName), asset.SHA, 1, 1, utils.DisplayDownloadFunction); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
fmt.Println("Finished downloading assets")
|
|
}
|