From 3e77df7587d7ea5d78b90dba7c5ef5b22ab293ae Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 25 Jul 2023 09:25:01 -0300 Subject: [PATCH] /tokens should warn when <1k tokens left --- aider/commands.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aider/commands.py b/aider/commands.py index df58bf428..66e76b809 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -152,8 +152,13 @@ class Commands: limit = self.coder.main_model.max_context_tokens remaining = limit - total - if remaining > 0: + if remaining > 1024: self.io.tool_output(f"{fmt(remaining)} tokens remaining in context window") + elif remaining > 0: + self.io.tool_error( + f"{fmt(remaining)} tokens remaining in context window (use /drop or /clear to make" + " space)" + ) else: self.io.tool_error(f"{fmt(remaining)} tokens remaining, window exhausted!") self.io.tool_output(f"{fmt(limit)} tokens max context window size")