MCPcopy
hub / github.com/mudler/LocalAI / GetGalleryConfigFromURL

Function GetGalleryConfigFromURL

core/gallery/gallery.go:24–35  ·  view source on GitHub ↗
(url string, basePath string)

Source from the content-addressed store, hash-verified

22)
23
24func GetGalleryConfigFromURL[T any](url string, basePath string) (T, error) {
25 var config T
26 uri := downloader.URI(url)
27 err := uri.ReadWithCallback(basePath, func(url string, d []byte) error {
28 return yaml.Unmarshal(d, &config)
29 })
30 if err != nil {
31 xlog.Error("failed to get gallery config for url", "error", err, "url", url)
32 return config, err
33 }
34 return config, nil
35}
36
37func GetGalleryConfigFromURLWithContext[T any](ctx context.Context, url string, basePath string) (T, error) {
38 var config T

Callers 1

RegisterUIAPIRoutesFunction · 0.92

Calls 3

URITypeAlias · 0.92
ReadWithCallbackMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected