diff --git a/frontend/src/components/prompts/UploadFiles.vue b/frontend/src/components/prompts/UploadFiles.vue index 9ef816ad..d07a8145 100644 --- a/frontend/src/components/prompts/UploadFiles.vue +++ b/frontend/src/components/prompts/UploadFiles.vue @@ -12,7 +12,7 @@ }}
-
{{ speed.toFixed(2) }} MB/s
+
{{ speedMbytes }}/s
{{ formattedETA }} remaining
{{ sentPercent }}% Completed
@@ -96,13 +96,15 @@ const sentMbytes = computed(() => byteToMbyte(uploadStore.sentBytes)); const totalMbytes = computed(() => byteToMbyte(uploadStore.totalBytes)); +const speedMbytes = computed(() => byteToMbyte(speed.value)); + let lastSpeedUpdate: number = 0; const recentSpeeds: number[] = []; const calculateSpeed = (sentBytes: number, oldSentBytes: number) => { const elapsedTime = (Date.now() - (lastSpeedUpdate ?? 0)) / 1000; const bytesSinceLastUpdate = sentBytes - oldSentBytes; - const currentSpeed = bytesSinceLastUpdate / (1024 * 1024) / elapsedTime; + const currentSpeed = bytesSinceLastUpdate / elapsedTime; recentSpeeds.push(currentSpeed); if (recentSpeeds.length > 5) { @@ -126,7 +128,7 @@ const calculateEta = () => { } const remainingSize = uploadStore.totalBytes - uploadStore.sentBytes; - const speedBytesPerSecond = speed.value * 1024 * 1024; + const speedBytesPerSecond = speed.value; eta.value = remainingSize / speedBytesPerSecond; };