@@ -16,8 +16,8 @@ var _ Importer = &LlamaCPPImporter{}
1616
1717type LlamaCPPImporter struct {}
1818
19- func (i * LlamaCPPImporter ) Match (uri string , request schema. ImportModelRequest ) bool {
20- preferences , err := request .Preferences .MarshalJSON ()
19+ func (i * LlamaCPPImporter ) Match (details Details ) bool {
20+ preferences , err := details .Preferences .MarshalJSON ()
2121 if err != nil {
2222 return false
2323 }
@@ -31,11 +31,11 @@ func (i *LlamaCPPImporter) Match(uri string, request schema.ImportModelRequest)
3131 return true
3232 }
3333
34- return strings .HasSuffix (uri , ".gguf" )
34+ return strings .HasSuffix (details . URI , ".gguf" )
3535}
3636
37- func (i * LlamaCPPImporter ) Import (uri string , request schema. ImportModelRequest ) (gallery.ModelConfig , error ) {
38- preferences , err := request .Preferences .MarshalJSON ()
37+ func (i * LlamaCPPImporter ) Import (details Details ) (gallery.ModelConfig , error ) {
38+ preferences , err := details .Preferences .MarshalJSON ()
3939 if err != nil {
4040 return gallery.ModelConfig {}, err
4141 }
@@ -47,12 +47,12 @@ func (i *LlamaCPPImporter) Import(uri string, request schema.ImportModelRequest)
4747
4848 name , ok := preferencesMap ["name" ].(string )
4949 if ! ok {
50- name = filepath .Base (uri )
50+ name = filepath .Base (details . URI )
5151 }
5252
5353 description , ok := preferencesMap ["description" ].(string )
5454 if ! ok {
55- description = "Imported from " + uri
55+ description = "Imported from " + details . URI
5656 }
5757
5858 modelConfig := config.ModelConfig {
@@ -62,7 +62,7 @@ func (i *LlamaCPPImporter) Import(uri string, request schema.ImportModelRequest)
6262 Backend : "llama-cpp" ,
6363 PredictionOptions : schema.PredictionOptions {
6464 BasicModelRequest : schema.BasicModelRequest {
65- Model : filepath .Base (uri ),
65+ Model : filepath .Base (details . URI ),
6666 },
6767 },
6868 TemplateConfig : config.TemplateConfig {
@@ -86,8 +86,8 @@ func (i *LlamaCPPImporter) Import(uri string, request schema.ImportModelRequest)
8686 ConfigFile : string (data ),
8787 Files : []gallery.File {
8888 {
89- URI : uri ,
90- Filename : filepath .Base (uri ),
89+ URI : details . URI ,
90+ Filename : filepath .Base (details . URI ),
9191 },
9292 },
9393 }, nil
0 commit comments