mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +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"
|
options += "/(D)on't ask again"
|
||||||
valid_responses.append("don't")
|
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:
|
if subject:
|
||||||
self.tool_output()
|
self.tool_output()
|
||||||
|
@ -732,13 +737,12 @@ class InputOutput:
|
||||||
question,
|
question,
|
||||||
style=style,
|
style=style,
|
||||||
complete_while_typing=False,
|
complete_while_typing=False,
|
||||||
default=default,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
res = input(question)
|
res = input(question)
|
||||||
|
|
||||||
if not res:
|
if not res:
|
||||||
res = "y" # Default to Yes if no input
|
res = default
|
||||||
break
|
break
|
||||||
res = res.lower()
|
res = res.lower()
|
||||||
good = any(valid_response.startswith(res) for valid_response in valid_responses)
|
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"),
|
("OPENAI_API_KEY", "gpt-4o"),
|
||||||
("GEMINI_API_KEY", "flash"),
|
("GEMINI_API_KEY", "flash"),
|
||||||
]
|
]
|
||||||
args.model = "gpt-4o-2024-08-06" # default
|
|
||||||
for env_key, model_name in model_key_pairs:
|
for env_key, model_name in model_key_pairs:
|
||||||
if os.environ.get(env_key):
|
if os.environ.get(env_key):
|
||||||
args.model = model_name
|
args.model = model_name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue