mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
fix: detect and show in-progress downloads on settings load
This commit is contained in:
@@ -65,10 +65,31 @@ export const LocalInferenceSettings = () => {
|
||||
// All models are now LocalModelResponse with tier for featured
|
||||
const featured = response.data.filter((m): m is LocalModelResponse => 'tier' in m);
|
||||
setFeaturedModels(featured);
|
||||
|
||||
// Start polling for any models that are already downloading
|
||||
featured.forEach((model) => {
|
||||
if (model.status.state === 'Downloading') {
|
||||
// Initialize with current progress from the model status
|
||||
const status = model.status;
|
||||
setDownloads((prev) => {
|
||||
const next = new Map(prev);
|
||||
next.set(model.id, {
|
||||
bytes_downloaded: status.bytes_downloaded,
|
||||
total_bytes: status.total_bytes,
|
||||
progress_percent: status.progress_percent,
|
||||
speed_bps: status.speed_bps,
|
||||
status: 'downloading',
|
||||
});
|
||||
return next;
|
||||
});
|
||||
pollDownloadProgress(model.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load models:', error);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user