mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
fix: Improve default input handling and model selection logic
This commit is contained in:
parent
c8b9e2ff37
commit
1e1fef52c4
2 changed files with 8 additions and 4 deletions
10
aider/io.py
10
aider/io.py
|
@ -698,7 +698,12 @@ class InputOutput:
|
|||
options += "/(D)on't ask again"
|
||||
valid_responses.append("don't")
|
||||
|
||||
question += options + " [Yes]: "
|
||||
if default.lower().startswith("y"):
|
||||
question += options + " [Yes]: "
|
||||
elif default.lower().startswith("n"):
|
||||
question += options + " [No]: "
|
||||
else:
|
||||
question += options + f" [{default}]: "
|
||||
|
||||
if subject:
|
||||
self.tool_output()
|
||||
|
@ -732,13 +737,12 @@ class InputOutput:
|
|||
question,
|
||||
style=style,
|
||||
complete_while_typing=False,
|
||||
default=default,
|
||||
)
|
||||
else:
|
||||
res = input(question)
|
||||
|
||||
if not res:
|
||||
res = "y" # Default to Yes if no input
|
||||
res = default
|
||||
break
|
||||
res = res.lower()
|
||||
good = any(valid_response.startswith(res) for valid_response in valid_responses)
|
||||
|
|
|
@ -757,7 +757,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
("OPENAI_API_KEY", "gpt-4o"),
|
||||
("GEMINI_API_KEY", "flash"),
|
||||
]
|
||||
args.model = "gpt-4o-2024-08-06" # default
|
||||
|
||||
for env_key, model_name in model_key_pairs:
|
||||
if os.environ.get(env_key):
|
||||
args.model = model_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue