33 * @description Centralized configuration management for the RoboCOIN application
44 */
55
6+ import HubDatasetNamesManager from './hub-dataset-names.js' ;
7+
68/**
79 * @typedef {Object } GridConfig
810 * @property {number } minCardWidth - Minimum card width in pixels
@@ -190,7 +192,11 @@ class ConfigManager {
190192 return fallback ;
191193 }
192194
193- return normalized ;
195+ // HuggingFace browser URLs use /tree/main; raw file fetches need /resolve/main.
196+ if ( / h u g g i n g f a c e \. c o \/ d a t a s e t s \/ [ ^ / ] + \/ [ ^ / ] + $ / i. test ( normalized ) ) {
197+ return `${ normalized } /resolve/main` ;
198+ }
199+ return normalized . replace ( / \/ t r e e \/ m a i n $ / i, '/resolve/main' ) ;
194200 }
195201
196202 /**
@@ -290,7 +296,9 @@ class ConfigManager {
290296 assets : {
291297 useLocalAssets : this . getJsonValue ( 'assets.useLocalAssets' , false ) ,
292298 localAssetsPath : this . getJsonValue ( 'assets.localAssetsPath' , '../robocoin_datamanager_assets' ) ,
293- defaultRemoteAssetsRoot : this . getJsonValue ( 'assets.defaultRemoteAssetsRoot' , 'https://huggingface.co/datasets/RogersPyke/robocoin_datamanager_assets/resolve/main' )
299+ defaultRemoteAssetsRoot : this . getJsonValue ( 'assets.defaultRemoteAssetsRoot' , 'https://huggingface.co/datasets/RogersPyke/robocoin_datamanager_assets/resolve/main' ) ,
300+ useBundledConsolidated : this . getJsonValue ( 'assets.useBundledConsolidated' , false ) ,
301+ bundledConsolidatedPath : this . getJsonValue ( 'assets.bundledConsolidatedPath' , './assets/info/consolidated_datasets.json' )
294302 } ,
295303 layout : {
296304 contentPadding : getValue ( '--content-padding' , 'defaults.layout.contentPadding' , 12 )
@@ -347,7 +355,8 @@ class ConfigManager {
347355 assetsRoot,
348356 info : infoPath , // JSON index files following standard structure
349357 datasetInfo : datasetInfoPath ,
350- videos : videosPath
358+ videos : videosPath ,
359+ bundledConsolidated : this . getJsonValue ( 'assets.bundledConsolidatedPath' , './assets/info/consolidated_datasets.json' )
351360 } ,
352361 // Download command format configuration
353362 // Loaded from config.json for easy editing
@@ -509,7 +518,8 @@ class ConfigManager {
509518 */
510519 static generateDownloadCommand ( hub , datasets , datasetMap = undefined ) {
511520 const config = this . getConfig ( ) . downloadCommand ;
512-
521+ const hubDatasets = HubDatasetNamesManager . resolveHubNames ( datasets , hub ) ;
522+
513523 // First line: storage estimate comment (no blank line)
514524 const storageComment = this . buildRequiredStorageComment ( datasets , datasetMap ) ;
515525
@@ -521,8 +531,8 @@ class ConfigManager {
521531
522532 // Format: --ds_lists + each dataset on new line with continuation
523533 command += `${ config . datasetsParam } ` ;
524- if ( datasets . length > 0 ) {
525- const dsListContent = datasets . join ( config . datasetSeparator ) ;
534+ if ( hubDatasets . length > 0 ) {
535+ const dsListContent = hubDatasets . join ( config . datasetSeparator ) ;
526536 command += `${ dsListContent } ${ config . lineBreak } ` ;
527537 } else {
528538 command += `${ config . lineBreak } ` ;
0 commit comments