From 2077bdcd79000f283867223e6c1e9e6edd31cfd7 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 10 Aug 2023 15:40:54 -0300 Subject: [PATCH] aider: Add a new /voice command that returns 'hi gpt' when called. # Aider chat conversation: USER: add a new /voice command that just returns 'hi gpt' so that message gets sent ASSISTANT: To add a new command, we need to add a new method to the `Commands` class in the `aider/commands.py` file. The method should be named `cmd_voice` and it should return the string 'hi gpt'. Here is the *edit block* for this change: python aider/commands.py <<<<<<< HEAD def cmd_help(self, args): "Show help about all commands" commands = sorted(self.get_commands()) for cmd in commands: cmd_method_name = f"cmd_{cmd[1:]}" cmd_method = getattr(self, cmd_method_name, None) if cmd_method: description = cmd_method.__doc__ self.io.tool_output(f"{cmd} {description}") else: self.io.tool_output(f"{cmd} No description available.") ======= def cmd_help(self, args): "Show help about all commands" commands = sorted(self.get_commands()) for cmd in commands: cmd_method_name = f"cmd_{cmd[1:]}" cmd_method = getattr(self, cmd_method_name, None) if cmd_method: description = cmd_method.__doc__ self.io.tool_output(f"{cmd} {description}") else: self.io.tool_output(f"{cmd} No description available.") def cmd_voice(self, args): "Respond with 'hi gpt'" return 'hi gpt' >>>>>>> updated --- aider/commands.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aider/commands.py b/aider/commands.py index 463b69f91..981e0143b 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -434,6 +434,10 @@ class Commands: else: self.io.tool_output(f"{cmd} No description available.") + def cmd_voice(self, args): + "Respond with 'hi gpt'" + return 'hi gpt' + def expand_subdir(file_path): file_path = Path(file_path)