@@ -1160,15 +1160,32 @@ func huggingFaceUploadCmd(c *cli.Context, hfArgs []string) error {
11601160 if repoID == "" {
11611161 return cliutils .PrintHelpAndReturnError ("Repository ID cannot be empty." , c )
11621162 }
1163- revision := ""
1164- if c .String ("revision" ) != "" {
1165- revision = c .String ("revision" )
1163+ serverDetails , err := coreConfig .GetDefaultServerConf ()
1164+ if err != nil {
1165+ return err
1166+ }
1167+ if serverDetails == nil {
1168+ return fmt .Errorf ("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id" )
1169+ }
1170+ buildConfiguration , err := cliutils .CreateBuildConfigurationWithModule (c )
1171+ if err != nil {
1172+ return err
1173+ }
1174+ revision := c .String ("revision" )
1175+ if revision == "" {
1176+ revision = "main"
11661177 }
11671178 repoType := c .String ("repo-type" )
11681179 if repoType == "" {
11691180 repoType = "model"
11701181 }
1171- huggingFaceUploadCmd := huggingfaceCommands .NewHuggingFaceUpload ().SetFolderPath (folderPath ).SetRepoId (repoID ).SetRepoType (repoType ).SetRevision (revision )
1182+ huggingFaceUploadCmd := huggingfaceCommands .NewHuggingFaceUpload ().
1183+ SetFolderPath (folderPath ).
1184+ SetRepoId (repoID ).
1185+ SetRepoType (repoType ).
1186+ SetRevision (revision ).
1187+ SetServerDetails (serverDetails ).
1188+ SetBuildConfiguration (buildConfiguration )
11721189 return commands .Exec (huggingFaceUploadCmd )
11731190}
11741191
@@ -1177,18 +1194,24 @@ func huggingFaceDownloadCmd(c *cli.Context, hfArgs []string) error {
11771194 if len (hfArgs ) < 1 {
11781195 return cliutils .PrintHelpAndReturnError ("Model/Dataset name is required." , c )
11791196 }
1180- const eTagTimeout = 86400
1197+ const defaultETagTimeout = 86400
11811198 repoID := hfArgs [0 ]
11821199 if repoID == "" {
11831200 return cliutils .PrintHelpAndReturnError ("Model/Dataset name cannot be empty." , c )
11841201 }
1185- revision := ""
1186- if c .String ("revision" ) != "" {
1187- revision = c .String ("revision" )
1202+ serverDetails , err := coreConfig .GetDefaultServerConf ()
1203+ if err != nil {
1204+ return err
1205+ }
1206+ if serverDetails == nil {
1207+ return fmt .Errorf ("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id" )
11881208 }
1189- etagTimeout := eTagTimeout
1209+ buildConfiguration , err := cliutils .CreateBuildConfigurationWithModule (c )
1210+ if err != nil {
1211+ return err
1212+ }
1213+ etagTimeout := defaultETagTimeout
11901214 if c .String ("etag-timeout" ) != "" {
1191- var err error
11921215 etagTimeout , err = strconv .Atoi (c .String ("etag-timeout" ))
11931216 if err != nil {
11941217 return errorutils .CheckErrorf ("invalid etag-timeout value: %s" , c .String ("etag-timeout" ))
@@ -1198,7 +1221,17 @@ func huggingFaceDownloadCmd(c *cli.Context, hfArgs []string) error {
11981221 if repoType == "" {
11991222 repoType = "model"
12001223 }
1201- huggingFaceDownloadCmd := huggingfaceCommands .NewHuggingFaceDownload ().SetRepoId (repoID ).SetRepoType (repoType ).SetRevision (revision ).SetEtagTimeout (etagTimeout )
1224+ revision := c .String ("revision" )
1225+ if revision == "" {
1226+ revision = "main"
1227+ }
1228+ huggingFaceDownloadCmd := huggingfaceCommands .NewHuggingFaceDownload ().
1229+ SetRepoId (repoID ).
1230+ SetRepoType (repoType ).
1231+ SetRevision (revision ).
1232+ SetEtagTimeout (etagTimeout ).
1233+ SetServerDetails (serverDetails ).
1234+ SetBuildConfiguration (buildConfiguration )
12021235 return commands .Exec (huggingFaceDownloadCmd )
12031236}
12041237
0 commit comments