mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
feat: Add /think-tokens
command to set thinking token budget
This commit is contained in:
parent
68c27f885f
commit
703e124277
1 changed files with 17 additions and 0 deletions
|
@ -1411,6 +1411,23 @@ class Commands:
|
|||
if user_input.strip():
|
||||
self.io.set_placeholder(user_input.rstrip())
|
||||
|
||||
def cmd_think_tokens(self, args):
|
||||
"Set the thinking token budget (supports formats like 8096, 8k, 10.5k, 0.5M)"
|
||||
if not args.strip():
|
||||
self.io.tool_error("Please specify a token budget (e.g., 8k, 10k, 0.5M).")
|
||||
return
|
||||
|
||||
value = args.strip()
|
||||
model = self.coder.main_model
|
||||
model.set_thinking_tokens(value)
|
||||
|
||||
# Try to display the actual value that was set
|
||||
if model.extra_params and "thinking" in model.extra_params:
|
||||
budget = model.extra_params["thinking"].get("budget_tokens")
|
||||
self.io.tool_output(f"Set thinking token budget to {budget:,} tokens.")
|
||||
else:
|
||||
self.io.tool_output(f"Set thinking token budget to {value}.")
|
||||
|
||||
def cmd_copy_context(self, args=None):
|
||||
"""Copy the current chat context as markdown, suitable to paste into a web UI"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue