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:

<source>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
</source>
This commit is contained in:
Paul Gauthier 2023-08-10 15:40:54 -03:00
parent 2872137005
commit 2077bdcd79

View file

@ -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)