From 3fbc0f94589ed4d33736f7ca9c0b934155b4b1af Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Wed, 31 Jul 2024 10:15:07 -0400 Subject: [PATCH] refactor --- backend/routes/generate_code.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.py index 04f5fa8..76b1fbe 100644 --- a/backend/routes/generate_code.py +++ b/backend/routes/generate_code.py @@ -158,9 +158,8 @@ async def stream_code(websocket: WebSocket): # Get the Anthropic API key from the request. Fall back to environment variable if not provided. # If neither is provided, we throw an error later only if Claude is used. - anthropic_api_key = None - if "anthropicApiKey" in params and params["anthropicApiKey"]: - anthropic_api_key = params["anthropicApiKey"] + anthropic_api_key = params.get("anthropicApiKey") + if anthropic_api_key: print("Using Anthropic API key from client-side settings dialog") else: anthropic_api_key = ANTHROPIC_API_KEY