Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

no divide by zero

Michael Yang4d677ee3894c
diff --git a/progress/bar.go b/progress/bar.go
index 9a81fd0fb..f69fb87b2 100644
--- a/progress/bar.go
+++ b/progress/bar.go
@@ -105,7 +105,12 @@ func (b *Bar) percent() float64 {
}
func (b *Bar) rate() float64 {
- return (float64(b.currentValue) - float64(b.initialValue)) / b.elapsed().Seconds()
+ elapsed := b.elapsed()
+ if elapsed.Seconds() > 0 {
+ return (float64(b.currentValue) - float64(b.initialValue)) / elapsed.Seconds()
+ }
+
+ return 0
}
func (b *Bar) elapsed() time.Duration {