@@ -50,9 +50,17 @@ export default function DownloadProgressBox({
50
50
100 ,
51
51
) ;
52
52
53
- const progressPercent = Math . round ( progress ) ;
54
- const downloaded = downloadProgress ?. job_data ?. downloaded || 0 ;
55
- const total = downloadProgress ?. job_data ?. total_size_of_model_in_mb || 0 ;
53
+ const progressPercent = Number . isFinite ( progress ) ? Math . round ( progress ) : 0 ;
54
+ const downloaded = Number . isFinite (
55
+ Number ( downloadProgress ?. job_data ?. downloaded ) ,
56
+ )
57
+ ? Number ( downloadProgress ?. job_data ?. downloaded )
58
+ : 0 ;
59
+ const total = Number . isFinite (
60
+ Number ( downloadProgress ?. job_data ?. total_size_of_model_in_mb ) ,
61
+ )
62
+ ? Number ( downloadProgress ?. job_data ?. total_size_of_model_in_mb )
63
+ : 0 ;
56
64
const downloadedBytes = downloaded * 1024 * 1024 ;
57
65
const totalBytes = total * 1024 * 1024 ;
58
66
@@ -73,10 +81,9 @@ export default function DownloadProgressBox({
73
81
74
82
< Box mt = { 1 } >
75
83
< Typography level = "body-xs" sx = { { mb : 1 , color : 'text.secondary' } } >
76
- { downloaded !== 0
77
- ? formatBytes ( downloadedBytes )
78
- : 'Download Starting' }
79
- { total > 0 && ` / ${ formatBytes ( totalBytes ) } ` }
84
+ { downloaded > 0
85
+ ? `${ formatBytes ( downloadedBytes ) } ${ total > 0 ? ` / ${ formatBytes ( totalBytes ) } ` : '' } `
86
+ : 'Downloading...' }
80
87
< ArrowDownIcon size = "16px" style = { { verticalAlign : 'middle' } } />
81
88
</ Typography >
82
89
< Divider sx = { { mb : 1 } } />
@@ -115,7 +122,9 @@ export default function DownloadProgressBox({
115
122
: theme . vars . palette . text . primary ,
116
123
} ) }
117
124
>
118
- { progressPercent } %
125
+ { Number . isFinite ( progressPercent )
126
+ ? `${ progressPercent } %`
127
+ : 'Loading...' }
119
128
</ Typography >
120
129
</ Box >
121
130
) }
0 commit comments