mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00: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:
parent
79dfba98d3
commit
cea9d2ae71
2 changed files with 6 additions and 2 deletions
|
@ -54,7 +54,9 @@ class FileContentCompleter(Completer):
|
||||||
|
|
||||||
|
|
||||||
class InputOutput:
|
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.pretty = pretty
|
||||||
self.yes = yes
|
self.yes = yes
|
||||||
self.input_history_file = input_history_file
|
self.input_history_file = input_history_file
|
||||||
|
@ -123,6 +125,8 @@ class InputOutput:
|
||||||
style=style,
|
style=style,
|
||||||
reserve_space_for_menu=4,
|
reserve_space_for_menu=4,
|
||||||
complete_style=CompleteStyle.MULTI_COLUMN,
|
complete_style=CompleteStyle.MULTI_COLUMN,
|
||||||
|
input=self.input,
|
||||||
|
output=self.output,
|
||||||
)
|
)
|
||||||
if line.strip() == "{" and not multiline_input:
|
if line.strip() == "{" and not multiline_input:
|
||||||
multiline_input = True
|
multiline_input = True
|
||||||
|
|
|
@ -88,7 +88,7 @@ def main(args=None, input=None, output=None):
|
||||||
fnames = args.files
|
fnames = args.files
|
||||||
pretty = args.pretty
|
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(
|
coder = Coder(
|
||||||
args.model, fnames, pretty, args.show_diffs, args.auto_commits, io,
|
args.model, fnames, pretty, args.show_diffs, args.auto_commits, io,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue