mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-28 12:26:46 +08:00
fix(plugins): retain Host progress fallback after master merge
This commit is contained in:
@@ -159,6 +159,7 @@ export function asyncTaskToPluginInstallTask(
|
||||
stage,
|
||||
downloadCurrent: num(md.download_current),
|
||||
downloadTotal: num(md.download_total),
|
||||
reportedProgress: num(md.progress_percent),
|
||||
stageElapsedSeconds: 0,
|
||||
}),
|
||||
);
|
||||
@@ -326,6 +327,7 @@ export function PluginInstallTaskProvider({
|
||||
stage,
|
||||
downloadCurrent,
|
||||
downloadTotal,
|
||||
reportedProgress: num(md.progress_percent),
|
||||
stageElapsedSeconds: (Date.now() - stageStartedAt) / 1000,
|
||||
});
|
||||
const progress = Math.min(
|
||||
|
||||
@@ -106,6 +106,8 @@ export interface StageProgressInput {
|
||||
stage: InstallStage;
|
||||
downloadCurrent?: number;
|
||||
downloadTotal?: number;
|
||||
/** Host coarse stage progress, used only when measured bytes are absent. */
|
||||
reportedProgress?: number;
|
||||
/** Seconds spent in the current stage, used to bound fallback drift. */
|
||||
stageElapsedSeconds: number;
|
||||
}
|
||||
@@ -136,6 +138,13 @@ export function computeStageProgress(input: StageProgressInput): number {
|
||||
return clampToRange(Math.round(start + (end - start) * ratio), start, end);
|
||||
}
|
||||
|
||||
if (
|
||||
input.reportedProgress != null &&
|
||||
Number.isFinite(input.reportedProgress)
|
||||
) {
|
||||
return clampToRange(input.reportedProgress, start, end);
|
||||
}
|
||||
|
||||
// Nothing measurable to show yet: drift slowly, but never past this stage's
|
||||
// own ceiling (hence `end - start - 1`, leaving the final point to the real
|
||||
// stage transition).
|
||||
|
||||
Reference in New Issue
Block a user