Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Merge pull request #348 from naman1608/type-fixes

Abi Raja561ac0b088c0
diff --cc backend/routes/generate_code.py
index 3fb92f1f,fc7330ef..379042ef
--- a/backend/routes/generate_code.py
+++ b/backend/routes/generate_code.py
@@@ -120,19 -120,8 +120,19 @@@ async def stream_code(websocket: WebSoc
)
return
+ # 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"]
+ print("Using Anthropic API key from client-side settings dialog")
+ else:
+ anthropic_api_key = ANTHROPIC_API_KEY
+ if anthropic_api_key:
+ print("Using Anthropic API key from environment variable")
+
# Get the OpenAI Base URL from the request. Fall back to environment variable if not provided.
- openai_base_url = None
+ openai_base_url: Union[str, None] = None
# Disable user-specified OpenAI Base URL in prod
if not os.environ.get("IS_PROD"):
if "openAiBaseURL" in params and params["openAiBaseURL"]: