mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
fix: Improve confirm_ask function in io.py
This commit is contained in:
parent
0b33892137
commit
e5b0fe3dfd
2 changed files with 9 additions and 16 deletions
11
aider/io.py
11
aider/io.py
|
@ -418,8 +418,6 @@ class InputOutput:
|
|||
return True
|
||||
return text.lower() in valid_responses
|
||||
|
||||
error_message = f"Please answer with one of: {', '.join(valid_responses)}"
|
||||
|
||||
if self.yes is True:
|
||||
res = "n" if explicit_yes_required else "y"
|
||||
elif self.yes is False:
|
||||
|
@ -432,12 +430,17 @@ class InputOutput:
|
|||
res = prompt(
|
||||
question,
|
||||
style=Style.from_dict(style),
|
||||
validator=validator,
|
||||
)
|
||||
if not res:
|
||||
res = "y" # Default to Yes if no input
|
||||
break
|
||||
# todo: break if res.lower() is a prefix a `valid_responses`
|
||||
res = res.lower()
|
||||
good = any(valid_response.startswith(res) for valid_response in valid_responses)
|
||||
if good:
|
||||
break
|
||||
|
||||
error_message = f"Please answer with one of: {', '.join(valid_responses)}"
|
||||
self.tool_error(error_message)
|
||||
|
||||
res = res.lower()[0]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue