From 332f24a56d5709594d58f5b11ae416ebbd734940 Mon Sep 17 00:00:00 2001 From: Charlie Tonneslan Date: Sun, 22 Mar 2026 12:49:28 -0400 Subject: [PATCH] Extract _prompt_custom_model_id helper to avoid duplication Moved the custom model input logic into a shared helper function as suggested in review. --- cli/utils.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/cli/utils.py b/cli/utils.py index f8af4559..8c7abab0 100644 --- a/cli/utils.py +++ b/cli/utils.py @@ -193,16 +193,22 @@ def select_shallow_thinking_agent(provider) -> str: exit(1) if choice == "__custom__": - choice = questionary.text( - "Enter your model ID (e.g. anthropic/claude-sonnet-4):" - ).ask() - if not choice: - console.print("\n[red]No model entered. Exiting...[/red]") - exit(1) + choice = _prompt_custom_model_id("anthropic/claude-sonnet-4") return choice +def _prompt_custom_model_id(example: str) -> str: + """Prompt user for a custom model ID and exit if none provided.""" + model_id = questionary.text( + f"Enter your model ID (e.g. {example}):" + ).ask() + if not model_id: + console.print("\n[red]No model entered. Exiting...[/red]") + exit(1) + return model_id + + def select_deep_thinking_agent(provider) -> str: """Select deep thinking llm engine using an interactive selection.""" @@ -270,12 +276,7 @@ def select_deep_thinking_agent(provider) -> str: exit(1) if choice == "__custom__": - choice = questionary.text( - "Enter your model ID (e.g. openai/gpt-5.2):" - ).ask() - if not choice: - console.print("\n[red]No model entered. Exiting...[/red]") - exit(1) + choice = _prompt_custom_model_id("openai/gpt-5.2") return choice