fix: infinity showed when haven't get total size (#2066)

Signed-off-by: James <james@jan.ai>
Co-authored-by: James <james@jan.ai>
This commit is contained in:
NamH 2024-02-18 15:14:48 +07:00 committed by GitHub
parent 56034d682a
commit 20eb5eccae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,8 +130,8 @@ export const setDownloadStateAtom = atom(
0
)
modelDownloadState.size.transferred = transferredSize
modelDownloadState.percent = transferredSize / parentTotalSize
modelDownloadState.percent =
parentTotalSize === 0 ? 0 : transferredSize / parentTotalSize
currentState[state.modelId] = modelDownloadState
}