/tokens should warn when <1k tokens left

This commit is contained in:
Paul Gauthier 2023-07-25 09:25:01 -03:00
parent b849d16ec7
commit 3e77df7587

View file

@ -152,8 +152,13 @@ class Commands:
limit = self.coder.main_model.max_context_tokens limit = self.coder.main_model.max_context_tokens
remaining = limit - total remaining = limit - total
if remaining > 0: if remaining > 1024:
self.io.tool_output(f"{fmt(remaining)} tokens remaining in context window") 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: else:
self.io.tool_error(f"{fmt(remaining)} tokens remaining, window exhausted!") self.io.tool_error(f"{fmt(remaining)} tokens remaining, window exhausted!")
self.io.tool_output(f"{fmt(limit)} tokens max context window size") self.io.tool_output(f"{fmt(limit)} tokens max context window size")