mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +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:
|
else:
|
||||||
self.mdstream = None
|
self.mdstream = None
|
||||||
|
|
||||||
|
self.usage_report = None
|
||||||
exhausted = False
|
exhausted = False
|
||||||
interrupted = False
|
interrupted = False
|
||||||
try:
|
try:
|
||||||
|
@ -892,6 +893,9 @@ class Coder:
|
||||||
self.partial_response_content = self.get_multi_response_content(True)
|
self.partial_response_content = self.get_multi_response_content(True)
|
||||||
self.multi_response_content = ""
|
self.multi_response_content = ""
|
||||||
|
|
||||||
|
if self.usage_report:
|
||||||
|
self.io.tool_output(self.usage_report)
|
||||||
|
|
||||||
if exhausted:
|
if exhausted:
|
||||||
self.show_exhausted_error()
|
self.show_exhausted_error()
|
||||||
self.num_exhausted_context_windows += 1
|
self.num_exhausted_context_windows += 1
|
||||||
|
@ -1256,7 +1260,7 @@ class Coder:
|
||||||
tokens += f", ${cost:.6f} cost"
|
tokens += f", ${cost:.6f} cost"
|
||||||
self.total_cost += cost
|
self.total_cost += cost
|
||||||
|
|
||||||
self.io.tool_output(tokens)
|
self.usage_report = tokens
|
||||||
|
|
||||||
def get_multi_response_content(self, final=False):
|
def get_multi_response_content(self, final=False):
|
||||||
cur = self.multi_response_content
|
cur = self.multi_response_content
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue