Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
Fix gemini variant invalid argument
Abi Raja845c23ea0ad9
diff --git a/backend/agentic/state.py b/backend/agentic/state.pyindex b8d8bb2f..b497767c 100644--- a/backend/agentic/state.py+++ b/backend/agentic/state.py@@ -58,7 +58,6 @@ def seed_file_state_from_messages(system_text = extract_text_content(system_message)markers = ["Here is the code of the app:",- "Here is the code of the SVG:",]for marker in markers:if marker not in system_text:diff --git a/backend/prompts/__init__.py b/backend/prompts/__init__.pyindex 1eb5cc6c..330171d7 100644--- a/backend/prompts/__init__.py+++ b/backend/prompts/__init__.py@@ -21,10 +21,6 @@ For mobile screenshots, do not include the device frame or browser chrome; focusthe actual UI mockups."""-SVG_USER_PROMPT = """-Generate code for a SVG that looks exactly like the provided screenshot(s).-"""-async def create_prompt(stack: Stack,@@ -145,12 +141,7 @@ def assemble_imported_code_prompt(code: str, stack: Stack) -> list[ChatCompletionMessageParam]:system_content = IMPORTED_CODE_SYSTEM_PROMPTS[stack]-- user_content = (- "Here is the code of the app: " + code- if stack != "svg"- else "Here is the code of the SVG: " + code- )+ user_content = "Here is the code of the app: " + codereturn [{@@ -166,7 +157,7 @@ def assemble_prompt(text_prompt: str = "",) -> list[ChatCompletionMessageParam]:system_content = SYSTEM_PROMPTS[stack]- user_prompt = USER_PROMPT if stack != "svg" else SVG_USER_PROMPT+ user_prompt = USER_PROMPT# Append optional text instructions if providedif text_prompt.strip():diff --git a/backend/prompts/imported_code_prompts.py b/backend/prompts/imported_code_prompts.pyindex c146045d..013700b4 100644--- a/backend/prompts/imported_code_prompts.py+++ b/backend/prompts/imported_code_prompts.py@@ -123,17 +123,6 @@ In terms of libraries,Follow the tool instructions in the system prompt."""-IMPORTED_CODE_SVG_SYSTEM_PROMPT = """-You are an expert at building SVGs.--- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.-- Repeat elements as needed to match the screenshot. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "<!-- Repeat for each news item -->" or bad things will happen.-- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.-- You can use Google Fonts--Follow the tool instructions in the system prompt.-"""-IMPORTED_CODE_SYSTEM_PROMPTS = SystemPrompts(html_tailwind=IMPORTED_CODE_TAILWIND_SYSTEM_PROMPT,html_css=IMPORTED_CODE_HTML_CSS_SYSTEM_PROMPT,@@ -141,5 +130,4 @@ IMPORTED_CODE_SYSTEM_PROMPTS = SystemPrompts(bootstrap=IMPORTED_CODE_BOOTSTRAP_SYSTEM_PROMPT,ionic_tailwind=IMPORTED_CODE_IONIC_TAILWIND_SYSTEM_PROMPT,vue_tailwind=IMPORTED_CODE_VUE_TAILWIND_SYSTEM_PROMPT,- svg=IMPORTED_CODE_SVG_SYSTEM_PROMPT,)diff --git a/backend/prompts/screenshot_system_prompts.py b/backend/prompts/screenshot_system_prompts.pyindex d4cb6f52..cf52c704 100644--- a/backend/prompts/screenshot_system_prompts.py+++ b/backend/prompts/screenshot_system_prompts.py@@ -164,23 +164,6 @@ Follow the tool instructions in the system prompt."""-SVG_SYSTEM_PROMPT = """-You are an expert at building SVGs.-You take screenshots of a reference web page from the user, and then build a SVG that looks exactly like the screenshot.--- Make sure the SVG looks exactly like the screenshot.-- Pay close attention to background color, text color, font size, font family,-padding, margin, border, etc. Match the colors and sizes exactly.-- Use the exact text from the screenshot.-- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.-- Repeat elements as needed to match the screenshot. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "<!-- Repeat for each news item -->" or bad things will happen.-- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.-- You can use Google Fonts--Follow the tool instructions in the system prompt.-"""--SYSTEM_PROMPTS = SystemPrompts(html_css=HTML_CSS_SYSTEM_PROMPT,html_tailwind=HTML_TAILWIND_SYSTEM_PROMPT,@@ -188,5 +171,4 @@ SYSTEM_PROMPTS = SystemPrompts(bootstrap=BOOTSTRAP_SYSTEM_PROMPT,ionic_tailwind=IONIC_TAILWIND_SYSTEM_PROMPT,vue_tailwind=VUE_TAILWIND_SYSTEM_PROMPT,- svg=SVG_SYSTEM_PROMPT,)diff --git a/backend/prompts/text_prompts.py b/backend/prompts/text_prompts.pyindex 25dc1784..fe72cc48 100644--- a/backend/prompts/text_prompts.py+++ b/backend/prompts/text_prompts.py@@ -103,16 +103,6 @@ In terms of libraries,{FORMAT_INSTRUCTIONS}"""-SVG_SYSTEM_PROMPT = f"""-You are an expert at building SVGs.--{GENERAL_INSTRUCTIONS}--Return only the full code in <svg></svg> tags.-Do not include markdown "```" or "```svg" at the start or end.-"""--SYSTEM_PROMPTS = SystemPrompts(html_css=HTML_CSS_SYSTEM_PROMPT,html_tailwind=HTML_TAILWIND_SYSTEM_PROMPT,@@ -120,5 +110,4 @@ SYSTEM_PROMPTS = SystemPrompts(bootstrap=BOOTSTRAP_SYSTEM_PROMPT,ionic_tailwind=IONIC_TAILWIND_SYSTEM_PROMPT,vue_tailwind=VUE_TAILWIND_SYSTEM_PROMPT,- svg=SVG_SYSTEM_PROMPT,)diff --git a/backend/prompts/types.py b/backend/prompts/types.pyindex c3c29aed..e1361d07 100644--- a/backend/prompts/types.py+++ b/backend/prompts/types.py@@ -8,7 +8,6 @@ class SystemPrompts(TypedDict):bootstrap: strionic_tailwind: strvue_tailwind: str- svg: strclass PromptContent(TypedDict):@@ -25,5 +24,4 @@ Stack = Literal["bootstrap","ionic_tailwind","vue_tailwind",- "svg",]diff --git a/frontend/src/lib/stacks.ts b/frontend/src/lib/stacks.tsindex 89515dba..d87326da 100644--- a/frontend/src/lib/stacks.ts+++ b/frontend/src/lib/stacks.ts@@ -7,7 +7,6 @@ export enum Stack {BOOTSTRAP = "bootstrap",VUE_TAILWIND = "vue_tailwind",IONIC_TAILWIND = "ionic_tailwind",- SVG = "svg",}export const STACK_DESCRIPTIONS: {@@ -19,5 +18,4 @@ export const STACK_DESCRIPTIONS: {bootstrap: { components: ["Bootstrap"], inBeta: false },vue_tailwind: { components: ["Vue", "Tailwind"], inBeta: true },ionic_tailwind: { components: ["Ionic", "Tailwind"], inBeta: true },- svg: { components: ["SVG"], inBeta: true },};