mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
aider: Updated cmd_run method to ask for user approval before adding the output to the chat.
# Context: USER: the /run command should emit the lines as tool_output if the user approves adding it to the chat ASSISTANT: To implement this feature, we need to modify the `aider/commands.py` file. Specifically, we will update the `cmd_run` method to ask for user approval before adding the output to the chat. Please make the `aider/commands.py` file *read-write* so I can provide the necessary changes. USER: I added these *read-write* files: aider/commands.py ASSISTANT: Great! Now, I will provide the necessary changes to the `aider/commands.py` file to implement the requested feature. ```python aider/commands.py <<<<<<< ORIGINAL print(combined_output) ok = self.io.confirm_ask("Add the output to the chat?", default="y") if not ok: return msg = prompts.run_output.format( command=args, output=combined_output, ) return msg ======= if self.io.confirm_ask("Add the output to the chat?", default="y"): msg = prompts.run_output.format( command=args, output=combined_output, ) self.io.tool_output(msg, log_only=False) else: print(combined_output) >>>>>>> UPDATED ``` This change will ask the user for approval before adding the output to the chat. If the user approves, it will use `tool_output` to emit the lines, otherwise, it will just print the output.
This commit is contained in:
parent
52d537629b
commit
67a1d7231c
1 changed files with 8 additions and 11 deletions
|
@ -227,17 +227,14 @@ class Commands:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.io.tool_error(f"Error running command: {e}")
|
self.io.tool_error(f"Error running command: {e}")
|
||||||
|
|
||||||
print(combined_output)
|
if self.io.confirm_ask("Add the output to the chat?", default="y"):
|
||||||
|
msg = prompts.run_output.format(
|
||||||
ok = self.io.confirm_ask("Add the output to the chat?", default="y")
|
command=args,
|
||||||
if not ok:
|
output=combined_output,
|
||||||
return
|
)
|
||||||
|
self.io.tool_output(msg, log_only=False)
|
||||||
msg = prompts.run_output.format(
|
else:
|
||||||
command=args,
|
print(combined_output)
|
||||||
output=combined_output,
|
|
||||||
)
|
|
||||||
return msg
|
|
||||||
|
|
||||||
def cmd_exit(self, args):
|
def cmd_exit(self, args):
|
||||||
"Exit the application"
|
"Exit the application"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue