@@ -11,6 +11,7 @@ import (
1111 "github.com/mudler/LocalAI/core/schema"
1212 "github.com/mudler/LocalAI/pkg/downloader"
1313 "github.com/mudler/LocalAI/pkg/functions"
14+ "github.com/rs/zerolog/log"
1415 "go.yaml.in/yaml/v2"
1516)
1617
@@ -21,12 +22,18 @@ type LlamaCPPImporter struct{}
2122func (i * LlamaCPPImporter ) Match (details Details ) bool {
2223 preferences , err := details .Preferences .MarshalJSON ()
2324 if err != nil {
25+ log .Error ().Err (err ).Msg ("failed to marshal preferences" )
2426 return false
2527 }
28+
2629 preferencesMap := make (map [string ]any )
27- err = json .Unmarshal (preferences , & preferencesMap )
28- if err != nil {
29- return false
30+
31+ if len (preferences ) > 0 {
32+ err = json .Unmarshal (preferences , & preferencesMap )
33+ if err != nil {
34+ log .Error ().Err (err ).Msg ("failed to unmarshal preferences" )
35+ return false
36+ }
3037 }
3138
3239 uri := downloader .URI (details .URI )
@@ -39,10 +46,6 @@ func (i *LlamaCPPImporter) Match(details Details) bool {
3946 return true
4047 }
4148
42- if uri .LooksLikeURL () && strings .HasSuffix (details .URI , ".gguf" ) {
43- return true
44- }
45-
4649 if uri .LooksLikeOCI () {
4750 return true
4851 }
@@ -59,6 +62,9 @@ func (i *LlamaCPPImporter) Match(details Details) bool {
5962}
6063
6164func (i * LlamaCPPImporter ) Import (details Details ) (gallery.ModelConfig , error ) {
65+
66+ log .Debug ().Str ("uri" , details .URI ).Msg ("llama.cpp importer matched" )
67+
6268 preferences , err := details .Preferences .MarshalJSON ()
6369 if err != nil {
6470 return gallery.ModelConfig {}, err
0 commit comments