Skip to content

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

Python

Inline user prompt and support stack

Abi Raja2e415b2b3185
diff --git a/backend/prompts/builders.py b/backend/prompts/builders.py
index 5b9ebab7..dcce2553 100644
--- a/backend/prompts/builders.py
+++ b/backend/prompts/builders.py
@@ -58,6 +58,7 @@ async def build_prompt_messages(
video_url = video_urls[0]
prompt_messages = build_video_prompt_messages(
video_data_url=video_url,
+ stack=stack,
text_prompt=prompt.get("text", ""),
)
else:
diff --git a/backend/prompts/text_prompt_builder.py b/backend/prompts/text_prompt_builder.py
index 7f97efa1..9e67d010 100644
--- a/backend/prompts/text_prompt_builder.py
+++ b/backend/prompts/text_prompt_builder.py
@@ -18,6 +18,7 @@ Selected stack: {stack}.
- Make sure to make it look modern and sleek.
- Use modern, professional fonts and colors.
- Follow UX best practices."""
+
return [
{
"role": "system",
diff --git a/backend/prompts/video_prompt_builder.py b/backend/prompts/video_prompt_builder.py
index 204a3121..0e2804c7 100644
--- a/backend/prompts/video_prompt_builder.py
+++ b/backend/prompts/video_prompt_builder.py
@@ -1,12 +1,14 @@
from openai.types.chat import ChatCompletionContentPartParam, ChatCompletionMessageParam
+from prompts.prompt_types import Stack
from prompts import system_prompt
def build_video_prompt_messages(
video_data_url: str,
+ stack: Stack,
text_prompt: str,
) -> list[ChatCompletionMessageParam]:
- user_text = """
+ user_text = f"""
You have been given a video of a user interacting with a web app. You need to re-create the same app exactly such that the same user interactions will produce the same results in the app you build.
- Watch the entire video carefully and understand all the user interactions and UI state changes.
@@ -21,7 +23,7 @@ def build_video_prompt_messages(
Analyze this video and generate the code.
- Selected stack: HTML, jQuery and Tailwind CSS.
+ Selected stack: {stack}.
"""
if text_prompt.strip():
user_text = user_text + "\n\nAdditional instructions: " + text_prompt
diff --git a/backend/tests/test_prompts.py b/backend/tests/test_prompts.py
index 66222ecd..0c7f5edc 100644
--- a/backend/tests/test_prompts.py
+++ b/backend/tests/test_prompts.py
@@ -323,7 +323,7 @@ class TestCreatePrompt:
"messages": [
{
"role": "system",
- "content": "<CONTAINS:You are an expert frontend developer.>",
+ "content": "<CONTAINS:You are a coding agent that's an expert at building front-ends.>",
},
{
"role": "user",