mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
Add usage reporting to the Coder class
This commit is contained in:
parent
afe50cab3d
commit
fe50400bf3
1 changed files with 5 additions and 1 deletions
|
@ -851,6 +851,7 @@ class Coder:
|
|||
else:
|
||||
self.mdstream = None
|
||||
|
||||
self.usage_report = None
|
||||
exhausted = False
|
||||
interrupted = False
|
||||
try:
|
||||
|
@ -892,6 +893,9 @@ class Coder:
|
|||
self.partial_response_content = self.get_multi_response_content(True)
|
||||
self.multi_response_content = ""
|
||||
|
||||
if self.usage_report:
|
||||
self.io.tool_output(self.usage_report)
|
||||
|
||||
if exhausted:
|
||||
self.show_exhausted_error()
|
||||
self.num_exhausted_context_windows += 1
|
||||
|
@ -1256,7 +1260,7 @@ class Coder:
|
|||
tokens += f", ${cost:.6f} cost"
|
||||
self.total_cost += cost
|
||||
|
||||
self.io.tool_output(tokens)
|
||||
self.usage_report = tokens
|
||||
|
||||
def get_multi_response_content(self, final=False):
|
||||
cur = self.multi_response_content
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue