mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
feat: show token count in command output confirmation prompt
This commit is contained in:
parent
884b52b710
commit
bba0cc8dc5
1 changed files with 7 additions and 2 deletions
|
@ -918,11 +918,16 @@ class Commands:
|
||||||
if combined_output is None:
|
if combined_output is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# tokenize the output, and ask "Add xx k-tokens of command output to the chat?" # ai!
|
# Calculate token count of output
|
||||||
|
token_count = self.coder.main_model.token_count(combined_output)
|
||||||
|
k_tokens = token_count / 1000
|
||||||
|
|
||||||
if add_on_nonzero_exit:
|
if add_on_nonzero_exit:
|
||||||
add = exit_status != 0
|
add = exit_status != 0
|
||||||
else:
|
else:
|
||||||
add = self.io.confirm_ask("Add command output to the chat?")
|
add = self.io.confirm_ask(
|
||||||
|
f"Add {k_tokens:.1f}k tokens of command output to the chat?"
|
||||||
|
)
|
||||||
|
|
||||||
if add:
|
if add:
|
||||||
num_lines = len(combined_output.strip().splitlines())
|
num_lines = len(combined_output.strip().splitlines())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue