Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTML/CSS system prompt and update stack descriptions #227

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions backend/prompts/screenshot_system_prompts.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -176,6 +199,7 @@


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,
Expand Down
2 changes: 2 additions & 0 deletions backend/prompts/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class SystemPrompts(TypedDict):
html_css: str
html_tailwind: str
react_tailwind: str
bootstrap: str
Expand All @@ -11,6 +12,7 @@ class SystemPrompts(TypedDict):


Stack = Literal[
"html_css",
"html_tailwind",
"react_tailwind",
"bootstrap",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/stacks.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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 },
Expand Down