mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
feat: add read-only files to the tokens report
This commit is contained in:
parent
77985f00cf
commit
f9bc52daea
1 changed files with 10 additions and 0 deletions
|
@ -329,6 +329,16 @@ class Commands:
|
||||||
tokens = self.coder.main_model.token_count(content)
|
tokens = self.coder.main_model.token_count(content)
|
||||||
res.append((tokens, f"{relative_fname}", "use /drop to drop from chat"))
|
res.append((tokens, f"{relative_fname}", "use /drop to drop from chat"))
|
||||||
|
|
||||||
|
# read-only files
|
||||||
|
for fname in self.coder.abs_read_only_fnames:
|
||||||
|
relative_fname = self.coder.get_rel_fname(fname)
|
||||||
|
content = self.io.read_text(fname)
|
||||||
|
if content is not None and not is_image_file(relative_fname):
|
||||||
|
# approximate
|
||||||
|
content = f"{relative_fname}\n```\n" + content + "```\n"
|
||||||
|
tokens = self.coder.main_model.token_count(content)
|
||||||
|
res.append((tokens, f"{relative_fname} (read-only)", ""))
|
||||||
|
|
||||||
self.io.tool_output(
|
self.io.tool_output(
|
||||||
f"Approximate context window usage for {self.coder.main_model.name}, in tokens:"
|
f"Approximate context window usage for {self.coder.main_model.name}, in tokens:"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue