mirror of
https://github.com/Aider-AI/aider.git
synced 2026-02-06 20:26:38 +01:00
aider: Updated InputOutput class to accept input and output arguments and passed them to prompt_toolkit.prompt() function.
# Context:
USER: we need to pass those into InputOutput and to prompt_toolkit right?
ASSISTANT: Yes, you're right. We need to pass the `input` and `output` arguments to the `InputOutput` class and then to the `prompt_toolkit.prompt()` function. Here's how to modify the `aider/getinput.py` and `aider/main.py` files:
In `aider/getinput.py`, update the `InputOutput` class to accept `input` and `output` arguments:
```python
aider/getinput.py
<<<<<<< ORIGINAL
class InputOutput:
def __init__(self, pretty, yes, input_history_file, chat_history_file):
=======
class InputOutput:
def __init__(self, pretty, yes, input_history_file, chat_history_file, input=None, output=None):
self.input = input
self.output = output
>>>>>>> UPDATED
```
Now, update the `prompt()` function calls in the `get_input()` method to use the `input` and `output` arguments:
```python
aider/getinput.py
<<<<<<< ORIGINAL
line = prompt(
show,
completer=completer_instance,
history=FileHistory(self.input_history_file),
style=style,
reserve_space_for_menu=4,
complete_style=CompleteStyle.MULTI_COLUMN,
)
=======
line = prompt(
show,
completer=completer_instance,
history=FileHistory(self.input_history_file),
style=style,
reserve_space_for_menu=4,
complete_style=CompleteStyle.MULTI_COLUMN,
input=self.input,
output=self.output,
)
>>>>>>> UPDATED
```
In `aider/main.py`, pass the `input` and `output` arguments to the `InputOutput` class:
```python
aider/main.py
<<<<<<< ORIGINAL
io = InputOutput(args.pretty, args.yes, args.input_history_file, args.chat_history_file)
=======
io = InputOutput(args.pretty, args.yes, args.input_history_file, args.chat_history_file, input=input, output=output)
>>>>>>> UPDATED
```
These changes will ensure that the `input` and `output` arguments are passed to the `InputOutput` class and then to the `prompt_toolkit.prompt()` function.
This commit is contained in:
@@ -54,7 +54,9 @@ class FileContentCompleter(Completer):
|
||||
|
||||
|
||||
class InputOutput:
|
||||
def __init__(self, pretty, yes, input_history_file, chat_history_file):
|
||||
def __init__(self, pretty, yes, input_history_file, chat_history_file, input=None, output=None):
|
||||
self.input = input
|
||||
self.output = output
|
||||
self.pretty = pretty
|
||||
self.yes = yes
|
||||
self.input_history_file = input_history_file
|
||||
@@ -123,6 +125,8 @@ class InputOutput:
|
||||
style=style,
|
||||
reserve_space_for_menu=4,
|
||||
complete_style=CompleteStyle.MULTI_COLUMN,
|
||||
input=self.input,
|
||||
output=self.output,
|
||||
)
|
||||
if line.strip() == "{" and not multiline_input:
|
||||
multiline_input = True
|
||||
|
||||
@@ -88,7 +88,7 @@ def main(args=None, input=None, output=None):
|
||||
fnames = args.files
|
||||
pretty = args.pretty
|
||||
|
||||
io = InputOutput(args.pretty, args.yes, args.input_history_file, args.chat_history_file)
|
||||
io = InputOutput(args.pretty, args.yes, args.input_history_file, args.chat_history_file, input=input, output=output)
|
||||
|
||||
coder = Coder(
|
||||
args.model, fnames, pretty, args.show_diffs, args.auto_commits, io,
|
||||
|
||||
Reference in New Issue
Block a user