The open source coding agent.
TypeScript
fix: Prevent division by zero in context percentage calculation (#1055)
Tom88b58fd6a0bb
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.goindex 436bf7107b1..739f6910994 100644--- a/packages/tui/internal/components/chat/messages.go+++ b/packages/tui/internal/components/chat/messages.go@@ -451,7 +451,10 @@ func formatTokensAndCost(formattedTokens = strings.Replace(formattedTokens, ".0M", "M", 1)}- percentage := (float64(tokens) / float64(contextWindow)) * 100+ percentage := 0.0+ if contextWindow > 0 {+ percentage = (float64(tokens) / float64(contextWindow)) * 100+ }if isSubscriptionModel {return fmt.Sprintf(