diff --git a/internal/ui/common/elements.go b/internal/ui/common/elements.go index 2cdb9993b611cba768b99ee528b41a7634c7ef61..506824a34dfdad0a9d8cedb870c2e4066c62fdb5 100644 --- a/internal/ui/common/elements.go +++ b/internal/ui/common/elements.go @@ -111,7 +111,10 @@ func formatTokensAndCost(t *styles.Styles, tokens, contextWindow int64, cost flo formattedTokens = strings.Replace(formattedTokens, ".0M", "M", 1) } - percentage := (float64(tokens) / float64(contextWindow)) * 100 + var percentage float64 + if contextWindow > 0 { + percentage = (float64(tokens) / float64(contextWindow)) * 100 + } formattedCost := t.ModelInfo.Cost.Render(fmt.Sprintf("$%.2f", cost))