Skip to content

Commit 3e8b167

Browse files
kukudixiaomingyushihai
andauthored
fix: lacks the status, name and file attributes in progressInfo (#1405)
Co-authored-by: yushihai <sd.yushihai@aisino.com>
1 parent e0b3004 commit 3e8b167

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/utils/hub.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,16 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
625625
) {
626626
if (!result) {
627627
// We haven't yet read the response body, so we need to do so now.
628-
await cache.put(cacheKey, /** @type {Response} */(response), options.progress_callback);
628+
// Ensure progress updates include consistent metadata.
629+
const wrapped_progress = options.progress_callback
630+
? (data) => dispatchCallback(options.progress_callback, {
631+
status: 'progress',
632+
name: path_or_repo_id,
633+
file: filename,
634+
...data,
635+
})
636+
: undefined;
637+
await cache.put(cacheKey, /** @type {Response} */(response), wrapped_progress);
629638
} else {
630639
// NOTE: We use `new Response(buffer, ...)` instead of `response.clone()` to handle LFS files
631640
await cache.put(cacheKey, new Response(result, {

0 commit comments

Comments
 (0)