aider: Added an elif clause for which == "chat_files" and a final else clause to raise a ValueError if the value of which is not valid.

# Context:
USER: nice! in the change the else: to elseif which==chat_files and throw a valueerror as a final else clause
ASSISTANT: To update the `commit()` function with the requested changes, we will modify the `if` statement to include an `elif` clause for `which == "chat_files"` and add a final `else` clause to raise a `ValueError`.

```python
aider/coder.py
<<<<<<< ORIGINAL
        if which == "repo_files":
            all_files = [os.path.join(self.root, f) for f in self.get_all_relative_files()]
            dirty_fnames, relative_dirty_fnames = get_dirty_files(all_files)
        else:
            dirty_fnames, relative_dirty_fnames = get_dirty_files(self.abs_fnames)
=======
        if which == "repo_files":
            all_files = [os.path.join(self.root, f) for f in self.get_all_relative_files()]
            dirty_fnames, relative_dirty_fnames = get_dirty_files(all_files)
        elif which == "chat_files":
            dirty_fnames, relative_dirty_fnames = get_dirty_files(self.abs_fnames)
        else:
            raise ValueError(f"Invalid value for 'which': {which}")
>>>>>>> UPDATED
```

This change adds an `elif` clause for `which == "chat_files"` and a final `else` clause to raise a `ValueError` if the value of `which` is not valid.
This commit is contained in:
Paul Gauthier 2023-05-11 09:13:25 -07:00
parent da40aaa6ca
commit cee1dfd3b9

View file

@ -438,8 +438,10 @@ class Coder:
if which == "repo_files":
all_files = [os.path.join(self.root, f) for f in self.get_all_relative_files()]
dirty_fnames, relative_dirty_fnames = get_dirty_files(all_files)
else:
elif which == "chat_files":
dirty_fnames, relative_dirty_fnames = get_dirty_files(self.abs_fnames)
else:
raise ValueError(f"Invalid value for 'which': {which}")
repo = self.repo
if not repo:
return