Skip to content

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

Python

update prompts

Abi Raja8427886a6e30
diff --git a/backend/prompts/agentic_instructions.py b/backend/prompts/agentic_instructions.py
index 84add617..cea91e32 100644
--- a/backend/prompts/agentic_instructions.py
+++ b/backend/prompts/agentic_instructions.py
@@ -5,7 +5,7 @@ Tooling instructions:
- For a brand new app, call create_file exactly once with the full HTML.
- For updates, call edit_file using exact string replacements. Do NOT regenerate the entire file.
- Do not output raw HTML in chat. Any code changes must go through tools.
-- Use generate_images to create image URLs from prompts (you may pass multiple prompts).
+- Use generate_images to create image URLs from prompts (you may pass multiple prompts). The image generation AI is not capable of generating images with a transparent background.
- Use remove_background to remove the background from a provided image URL when needed.
- Use retrieve_option to fetch the full HTML for a specific option (1-based option_number) when a user references another option.
- Any non-tool output should be short, user-facing chat updates.
@@ -14,9 +14,15 @@ Tooling instructions:
def apply_tool_instructions(system_prompt: str, should_generate_images: bool) -> str:
image_flag = "enabled" if should_generate_images else "disabled"
+ stripped_system_prompt = system_prompt.strip()
+ stripped_tool_instructions = TOOL_USE_INSTRUCTIONS.strip()
+
+ if stripped_tool_instructions in stripped_system_prompt:
+ return stripped_system_prompt + f"\n\nImage generation is {image_flag}."
+
return (
- system_prompt.strip()
+ stripped_system_prompt
+ "\n\n"
- + TOOL_USE_INSTRUCTIONS.strip()
+ + stripped_tool_instructions
+ f"\n\nImage generation is {image_flag}."
)
diff --git a/backend/prompts/screenshot_system_prompts.py b/backend/prompts/screenshot_system_prompts.py
index cf52c704..5109d4c7 100644
--- a/backend/prompts/screenshot_system_prompts.py
+++ b/backend/prompts/screenshot_system_prompts.py
@@ -1,9 +1,10 @@
from prompts.types import SystemPrompts
+from prompts.agentic_instructions import TOOL_USE_INSTRUCTIONS
-HTML_TAILWIND_SYSTEM_PROMPT = """
-You are an expert Tailwind developer
-You take screenshots of a reference web page from the user, and then build single page apps
+HTML_TAILWIND_SYSTEM_PROMPT = f"""
+You are an expert Tailwind developer.
+You particularly specialize in taking screenshots and then replicating them exactly in code as single page apps
using Tailwind, HTML and JS.
- Make sure the app looks exactly like the screenshot.
@@ -12,17 +13,20 @@ 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.
+- For images, generate images using the generate_images tool.
In terms of libraries,
- Use this script to include Tailwind: <script src="https://cdn.tailwindcss.com"></script>
-- You can use Google Fonts
+- You can use Google Fonts or other publicly accessible fonts.
- Font Awesome for icons: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></link>
Follow the tool instructions in the system prompt.
Be extremely concise in your chat responses, especially if you're summarizing the work you've done.
+
+Tooling instructions:
+{TOOL_USE_INSTRUCTIONS.strip()}
"""
HTML_CSS_SYSTEM_PROMPT = """