wip: Updated print statements and appended new line character to session start message.

This commit is contained in:
Paul Gauthier 2023-05-12 15:03:12 -07:00
parent 10376a9175
commit 69d5e8a624
3 changed files with 22 additions and 11 deletions

View file

@ -491,7 +491,8 @@ class Coder:
raise ValueError(f"Invalid value for 'which': {which}")
if self.show_diffs or ask:
self.io.tool(diffs)
# don't use io.tool() because we don't want to log or further colorize
print(diffs)
context = self.get_context_from_history(history)
if message:

View file

@ -66,7 +66,7 @@ class InputOutput:
self.console = Console(force_terminal=True, no_color=True)
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self.append_chat_history(f'# New session started at {current_time}', False)
self.append_chat_history(f'\n# New session started at {current_time}', False)
def canned_input(self, show_prompt):
console = Console()
@ -138,7 +138,11 @@ class InputOutput:
print()
prefix = "####"
hist = inp.splitlines()
if inp:
hist = inp.splitlines()
else:
hist = ['<blank>']
hist = f" \n{prefix} ".join(hist)
hist = f"""---
@ -159,21 +163,27 @@ class InputOutput:
else:
res = prompt(question + " ", default=default)
hist = f"*{question.strip()} {res}*"
hist = f"_{question.strip()} {res.strip()}_"
self.append_chat_history(hist, True)
if not res:
if not res or not res.strip():
return
return res.lower().startswith("y")
return res.strip().lower().startswith("y")
def prompt_ask(self, question, default=None):
if self.yes:
return True
return prompt(question + " ", default=default)
res = 'yes'
else:
res = prompt(question + " ", default=default)
hist = f"_{question.strip()} {res.strip()}_"
self.append_chat_history(hist, True)
return res
def tool_error(self, message):
if message.strip():
hist = f"*{message.strip()}*"
hist = f"_{message.strip()}_"
self.append_chat_history(hist, True)
message = Text(message)
@ -182,7 +192,7 @@ class InputOutput:
def tool(self, *messages):
if messages:
hist = " ".join(messages)
hist = f"*{hist.strip()}*"
hist = f"_{hist.strip()}_"
self.append_chat_history(hist, True)
messages = list(map(Text, messages))

View file

@ -77,7 +77,7 @@ aider/coder.py
Please note that I couldn't find the `self.io.tool_error()` method in the provided code. You may need to create this method in the appropriate class or provide the correct method name to replace the `self.console.print()` calls.
_Applied edit to aider/coder.py_
*Applied edit to aider/coder.py*
*Applied edit to aider/coder.py*
*Applied edit to aider/coder.py*
*Applied edit to aider/coder.py*