mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
Add FileHistory to get_input method in Coder class.
# Context: USER: have get_input(self): use a FileHistory with the history_file ASSISTANT: To use a FileHistory with the history_file in the get_input(self) method, we need to import FileHistory from prompt_toolkit.history and use it when calling the prompt function. Here's the change: ```python coder.py <<<<<<< ORIGINAL from prompt_toolkit import prompt from prompt_toolkit.completion import Completer, Completion ======= from prompt_toolkit import prompt from prompt_toolkit.completion import Completer, Completion from prompt_toolkit.history import FileHistory >>>>>>> UPDATED ... class Coder: ... def get_input(self): ... while True: try: completer_instance = FileContentCompleter(self.fnames) if multiline_input: line = prompt(". ", completer=completer_instance, history=FileHistory(self.history_file)) else: line = prompt("> ", completer=completer_instance, history=FileHistory(self.history_file)) except EOFError: return ``` This change imports FileHistory and adds it as an argument to the prompt function calls in the get_input method.
This commit is contained in:
parent
fe222d8943
commit
bc2c59368b
1 changed files with 2 additions and 1 deletions
1
coder.py
1
coder.py
|
@ -6,6 +6,7 @@ import re
|
||||||
import traceback
|
import traceback
|
||||||
from prompt_toolkit import prompt
|
from prompt_toolkit import prompt
|
||||||
from prompt_toolkit.completion import Completer, Completion
|
from prompt_toolkit.completion import Completer, Completion
|
||||||
|
from prompt_toolkit.history import FileHistory
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.prompt import Confirm, Prompt
|
from rich.prompt import Confirm, Prompt
|
||||||
from colorama import Fore, Style
|
from colorama import Fore, Style
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue