mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 19:55:00 +00:00
style: Run linter on onboarding module
This commit is contained in:
parent
1b2a4db1ed
commit
15fe0afe62
1 changed files with 20 additions and 12 deletions
|
@ -59,10 +59,14 @@ def select_default_model(args, io, analytics):
|
||||||
return selected_model
|
return selected_model
|
||||||
|
|
||||||
# No API keys found - Offer OpenRouter OAuth
|
# No API keys found - Offer OpenRouter OAuth
|
||||||
io.tool_warning("No API key environment variables found (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY...).")
|
io.tool_warning(
|
||||||
|
"No API key environment variables found (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY...)."
|
||||||
|
)
|
||||||
# Use confirm_ask which handles non-interactive cases
|
# Use confirm_ask which handles non-interactive cases
|
||||||
if io.confirm_ask(
|
if io.confirm_ask(
|
||||||
"Authenticate with OpenRouter via browser to get an API key?", default="y", group="openrouter_oauth"
|
"Authenticate with OpenRouter via browser to get an API key?",
|
||||||
|
default="y",
|
||||||
|
group="openrouter_oauth",
|
||||||
):
|
):
|
||||||
analytics.event("oauth_flow_initiated", provider="openrouter")
|
analytics.event("oauth_flow_initiated", provider="openrouter")
|
||||||
openrouter_key = start_openrouter_oauth_flow(io, analytics)
|
openrouter_key = start_openrouter_oauth_flow(io, analytics)
|
||||||
|
@ -138,7 +142,9 @@ def exchange_code_for_key(code, code_verifier, io):
|
||||||
io.tool_error("Error: Request to OpenRouter timed out during code exchange.")
|
io.tool_error("Error: Request to OpenRouter timed out during code exchange.")
|
||||||
return None
|
return None
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
io.tool_error(f"Error exchanging code for OpenRouter key: {e.status_code} {e.response.reason}")
|
io.tool_error(
|
||||||
|
f"Error exchanging code for OpenRouter key: {e.status_code} {e.response.reason}"
|
||||||
|
)
|
||||||
io.tool_error(f"Response: {e.response.text}")
|
io.tool_error(f"Response: {e.response.text}")
|
||||||
return None
|
return None
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
|
@ -246,7 +252,9 @@ def start_openrouter_oauth_flow(io, analytics):
|
||||||
code_verifier, code_challenge = generate_pkce_codes()
|
code_verifier, code_challenge = generate_pkce_codes()
|
||||||
auth_url = f"https://openrouter.ai/auth?callback_url={callback_url}&code_challenge={code_challenge}&code_challenge_method=S256"
|
auth_url = f"https://openrouter.ai/auth?callback_url={callback_url}&code_challenge={code_challenge}&code_challenge_method=S256"
|
||||||
|
|
||||||
io.tool_output("\nPlease open the following URL in your web browser to authorize Aider with OpenRouter:")
|
io.tool_output(
|
||||||
|
"\nPlease open the following URL in your web browser to authorize Aider with OpenRouter:"
|
||||||
|
)
|
||||||
io.tool_output(auth_url)
|
io.tool_output(auth_url)
|
||||||
io.tool_output("\nWaiting for authentication... (Timeout: 2 minutes)")
|
io.tool_output("\nWaiting for authentication... (Timeout: 2 minutes)")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue