mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
fix: Handle missing model info values gracefully
This commit is contained in:
parent
72572f06d9
commit
e48fecee14
3 changed files with 6 additions and 8 deletions
|
@ -344,7 +344,7 @@ class Commands:
|
|||
total_cost = 0.0
|
||||
for tk, msg, tip in res:
|
||||
total += tk
|
||||
cost = tk * self.coder.main_model.info.get("input_cost_per_token", 0)
|
||||
cost = tk * (self.coder.main_model.info.get("input_cost_per_token") or 0)
|
||||
total_cost += cost
|
||||
msg = msg.ljust(col_width)
|
||||
self.io.tool_output(f"${cost:7.4f} {fmt(tk)} {msg} {tip}") # noqa: E231
|
||||
|
@ -352,7 +352,7 @@ class Commands:
|
|||
self.io.tool_output("=" * (width + cost_width + 1))
|
||||
self.io.tool_output(f"${total_cost:7.4f} {fmt(total)} tokens total") # noqa: E231
|
||||
|
||||
limit = self.coder.main_model.info.get("max_input_tokens", 0)
|
||||
limit = self.coder.main_model.info.get("max_input_tokens") or 0
|
||||
if not limit:
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue