Skip to content

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

Python

Add HTML/CSS system prompt and update stack descriptions

Julian Toro7c1fb7a54d4c
diff --git a/backend/prompts/screenshot_system_prompts.py b/backend/prompts/screenshot_system_prompts.py
index fca91baa..7de6dcaf 100644
--- a/backend/prompts/screenshot_system_prompts.py
+++ b/backend/prompts/screenshot_system_prompts.py
@@ -1,5 +1,28 @@
from prompts.types import SystemPrompts
+HTML_CSS_SYSTEM_PROMPT = """
+You are an expert CSS developer
+You take screenshots of a reference web page from the user, and then build single page apps
+using CSS, HTML and JS.
+You might also be given a screenshot(The second image) of a web page that you have already built, and asked to
+update it to look more like the reference image(The first image).
+
+- Make sure the app 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.
+
+In terms of libraries,
+
+- You can use Google 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>
+
+Return only the full code in <html></html> tags.
+Do not include markdown "```" or "```html" at the start or end.
+"""
HTML_TAILWIND_SYSTEM_PROMPT = """
You are an expert Tailwind developer
@@ -176,6 +199,7 @@ 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,
react_tailwind=REACT_TAILWIND_SYSTEM_PROMPT,
bootstrap=BOOTSTRAP_SYSTEM_PROMPT,
diff --git a/backend/prompts/types.py b/backend/prompts/types.py
index 90684430..7d4ca2d2 100644
--- a/backend/prompts/types.py
+++ b/backend/prompts/types.py
@@ -2,6 +2,7 @@ from typing import Literal, TypedDict
class SystemPrompts(TypedDict):
+ html_css: str
html_tailwind: str
react_tailwind: str
bootstrap: str
@@ -11,6 +12,7 @@ class SystemPrompts(TypedDict):
Stack = Literal[
+ "html_css",
"html_tailwind",
"react_tailwind",
"bootstrap",
diff --git a/frontend/src/lib/stacks.ts b/frontend/src/lib/stacks.ts
index b8b372e2..8e3a26a0 100644
--- a/frontend/src/lib/stacks.ts
+++ b/frontend/src/lib/stacks.ts
@@ -1,5 +1,6 @@
// Keep in sync with backend (prompts/types.py)
export enum Stack {
+ HTML_CSS = "html_css",
HTML_TAILWIND = "html_tailwind",
REACT_TAILWIND = "react_tailwind",
BOOTSTRAP = "bootstrap",
@@ -11,6 +12,7 @@ export enum Stack {
export const STACK_DESCRIPTIONS: {
[key in Stack]: { components: string[]; inBeta: boolean };
} = {
+ html_css: { components: ["HTML", "Css"], inBeta: false },
html_tailwind: { components: ["HTML", "Tailwind"], inBeta: false },
react_tailwind: { components: ["React", "Tailwind"], inBeta: false },
bootstrap: { components: ["Bootstrap"], inBeta: false },