From 7097e62582e40950ca076cec92423e541ee98bc7 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 18 Mar 2025 12:27:48 -0700 Subject: [PATCH] refactor: Consolidate model setting checks into a loop --- aider/main.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/aider/main.py b/aider/main.py index 4d13a0a1d..231c6981b 100644 --- a/aider/main.py +++ b/aider/main.py @@ -797,25 +797,20 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F # Show warnings about unsupported settings after all model settings are fully resolved if args.check_model_accepts_settings: warned = False - if args.reasoning_effort is not None and ( - not main_model.accepts_settings or "reasoning_effort" not in main_model.accepts_settings - ): - warn_setting = "reasoning_effort" - io.tool_warning( - f"Warning: The model {main_model.name} may not support the '{warn_setting}'" - " setting." - ) - warned = True - - if args.thinking_tokens is not None and ( - not main_model.accepts_settings or "thinking_tokens" not in main_model.accepts_settings - ): - warn_setting = "thinking_tokens" - io.tool_warning( - f"Warning: The model {main_model.name} may not support the '{warn_setting}'" - " setting." - ) - warned = True + settings_to_check = [ + {"arg": args.reasoning_effort, "name": "reasoning_effort"}, + {"arg": args.thinking_tokens, "name": "thinking_tokens"} + ] + + for setting in settings_to_check: + if setting["arg"] is not None and ( + not main_model.accepts_settings or setting["name"] not in main_model.accepts_settings + ): + io.tool_warning( + f"Warning: The model {main_model.name} may not support the '{setting['name']}'" + " setting." + ) + warned = True if warned: if not io.confirm_ask(