Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
support Claude 3.7 Sonnet and make it the one of the default models for creation
Abi Raja9fae969f73de
diff --git a/backend/evals/core.py b/backend/evals/core.pyindex 0fab5948..dac30dce 100644--- a/backend/evals/core.py+++ b/backend/evals/core.py@@ -26,6 +26,7 @@ async def generate_code_core(model == Llm.CLAUDE_3_SONNETor model == Llm.CLAUDE_3_5_SONNET_2024_06_20or model == Llm.CLAUDE_3_5_SONNET_2024_10_22+ or model == Llm.CLAUDE_3_7_SONNET_2025_02_19):if not ANTHROPIC_API_KEY:raise Exception("Anthropic API key not found")@@ -58,4 +59,4 @@ async def generate_code_core(model=model,)- return completion+ return completion["code"]diff --git a/backend/evals/runner.py b/backend/evals/runner.pyindex 938e5f20..aa6dd206 100644--- a/backend/evals/runner.py+++ b/backend/evals/runner.py@@ -68,8 +68,12 @@ async def run_image_evals(# File name is derived from the original filename in evals with an added output numberoutput_filename = f"{os.path.splitext(filename)[0]}_{output_number}.html"output_filepath = os.path.join(output_subfolder, output_filename)- with open(output_filepath, "w") as file:- file.write(content)+ try:+ with open(output_filepath, "w") as file:+ file.write(content)+ except Exception as e:+ print(f"Error writing file {output_filepath}: {content} {e}")+ continueoutput_files.append(output_filename)return output_filesdiff --git a/backend/llm.py b/backend/llm.pyindex 244f0944..948b4155 100644--- a/backend/llm.py+++ b/backend/llm.py@@ -27,6 +27,7 @@ class Llm(Enum):CLAUDE_3_HAIKU = "claude-3-haiku-20240307"CLAUDE_3_5_SONNET_2024_06_20 = "claude-3-5-sonnet-20240620"CLAUDE_3_5_SONNET_2024_10_22 = "claude-3-5-sonnet-20241022"+ CLAUDE_3_7_SONNET_2025_02_19 = "claude-3-7-sonnet-20250219"GEMINI_2_0_FLASH_EXP = "gemini-2.0-flash-exp"O1_2024_12_17 = "o1-2024-12-17"@@ -167,7 +168,7 @@ async def stream_claude_response_native(api_key: str,callback: Callable[[str], Awaitable[None]],include_thinking: bool = False,- model: Llm = Llm.CLAUDE_3_OPUS,+ model: Llm = Llm.CLAUDE_3_7_SONNET_2025_02_19,) -> Completion:start_time = time.time()client = AsyncAnthropic(api_key=api_key)diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.pyindex 4afb413a..2f214ce4 100644--- a/backend/routes/generate_code.py+++ b/backend/routes/generate_code.py@@ -255,10 +255,10 @@ async def stream_code(websocket: WebSocket):# we decide which models to runvariant_models = []- # For creation, use Claude Sonnet 3.6 but it can be lazy- # so for updates, we use Claude Sonnet 3.5+ # For creation, use Claude Sonnet 3.7+ # For updates, we use Claude Sonnet 3.5 until we have tested Claude Sonnet 3.7if generation_type == "create":- claude_model = Llm.CLAUDE_3_5_SONNET_2024_10_22+ claude_model = Llm.CLAUDE_3_7_SONNET_2025_02_19else:claude_model = Llm.CLAUDE_3_5_SONNET_2024_06_20@@ -311,15 +311,16 @@ async def stream_code(websocket: WebSocket):elif (model == Llm.CLAUDE_3_5_SONNET_2024_06_20or model == Llm.CLAUDE_3_5_SONNET_2024_10_22+ or model == Llm.CLAUDE_3_7_SONNET_2025_02_19):if anthropic_api_key is None:await throw_error("Anthropic API key is missing.")raise Exception("Anthropic API key is missing.")- # For creation, use Claude Sonnet 3.6 but it can be lazy- # so for updates, we use Claude Sonnet 3.5+ # For creation, use Claude Sonnet 3.7+ # For updates, we use Claude Sonnet 3.5 until we have tested Claude Sonnet 3.7if params["generationType"] == "create":- claude_model = Llm.CLAUDE_3_5_SONNET_2024_10_22+ claude_model = Llm.CLAUDE_3_7_SONNET_2025_02_19else:claude_model = Llm.CLAUDE_3_5_SONNET_2024_06_20